如何在 tkinter 的按钮小部件中使用 activeforeground 选项 python
How to use activeforeground option in button widget of tkinter python
嗯,我是 Tkinter 的新手,我的问题很简单,在按钮小部件中有 activeforeground 选项,我想知道如何使用它。
您在 tkinter 中指定一个 Button,如下所示:Button(<parent>, text=<text>, activeforeground=<colour>,....)
由于 activeforeground 是关键字参数,您只需将其放在括号中并为其指定颜色即可。或者你到底想做什么?
这是一个带有按钮的简单window,你可以在这里看到activeforeground是如何实现的,以及当你点击按钮时会发生什么。
import tkinter
from tkinter import*
root = tkinter.Tk()
Button1 = tkinter.Button(root,text="click me!",activeforeground="red") #<---- HERE
Button1.place(relx=0.5,rely=0.5,anchor=CENTER)
root.mainloop()
此页面提供了不同关键字的列表:
https://www.tutorialspoint.com/python/tk_button.htm
嗯,我是 Tkinter 的新手,我的问题很简单,在按钮小部件中有 activeforeground 选项,我想知道如何使用它。
您在 tkinter 中指定一个 Button,如下所示:Button(<parent>, text=<text>, activeforeground=<colour>,....)
由于 activeforeground 是关键字参数,您只需将其放在括号中并为其指定颜色即可。或者你到底想做什么?
这是一个带有按钮的简单window,你可以在这里看到activeforeground是如何实现的,以及当你点击按钮时会发生什么。
import tkinter
from tkinter import*
root = tkinter.Tk()
Button1 = tkinter.Button(root,text="click me!",activeforeground="red") #<---- HERE
Button1.place(relx=0.5,rely=0.5,anchor=CENTER)
root.mainloop()
此页面提供了不同关键字的列表: https://www.tutorialspoint.com/python/tk_button.htm