Python,Tkinter,标签颜色的变化 [英] Python, Tkinter, Change of label color

查看:32
本文介绍了Python,Tkinter,标签颜色的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法可以更改按钮中文本的颜色?

Is there a simple way to change the color of a text in a button?

我使用 button['text'] = 'input text here' 来更改按下后按钮文本的内容.button['color'] = 'red' 是否存在类似的颜色变化?

I use button['text'] = 'input text here' to change what the button text will be after the push. Does something similar exist for the change of color, button['color'] = 'red'?

推荐答案

使用 foreground 选项设置按钮中文本的颜色.

示例:

Use the foreground option to set a color of the text in a button.

Example:

button.configure(foreground="red")

这篇关于Python,Tkinter,标签颜色的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆