[英]How to change ttk button background and foreground when hover it in tkinter
[英]How to preserve button background and foreground color on tkinter button when pressed?
我在tkinter中有一個按鈕,已將bg / fg着色為。
我對它的外觀感到滿意,但是當按下按鈕時,顏色會恢復為我不滿意的灰色背景上的默認黑色文本。
begin_button = tk.Button(bottom_frame, text='Click me!', bg='blue', fg='red', font='Helvetica 10', command=begin)
按下按鈕時,是否有簡單的方法將顏色固定到位? 我不介意按鈕下沉(實際上非常不錯),但是顏色變化對我不利。
您可以調整activebackground
和activeforeground
,它們在激活時負責按鈕的bg / fg顏色。
begin_button = tk.Button(root, text='Click me!', bg='blue', fg='red', font='Helvetica 10',
activebackground="blue",activeforeground="red")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.