I have a simple tkinter window. It consists of a small window, a timer, and a button to set timer. I don't want to go in details with the code.
I want to change the background of all the widgets in my window(buttons, label, Etc.).
My first thought is to use a global variable which I will set to "red"
for example, and associate all the widgets background
option with the global variable. Then, on button press I will change the global variable to "green"
(so that the background of all widgets change) but nothing happens.
My understanding was the .mainloop()
sort of updated the window. How can I have the widgets to change background color when my variable change without restarting my application?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…