[英]How to change foreground color of a ttk button that is disabled?
當我禁用按鈕時,顏色會自動變為黑色。 這是代碼:
from tkinter import *
from tkinter import ttk
root=Tk()
style=ttk.Style()
style.configure('TButton', foreground='red')
bu1=ttk.Button(root, text="Hello world")
bu1.grid(row=0, column=0)
bu2=ttk.Button(root, text="Hello world2")
bu2.grid(row=1, column=0)
bu1.state(['disabled'])
bu2.state(['disabled'])
root.mainloop()
有什么幫助嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.