I have used time.sleep(5) to see if the changes are reflected in the window. The window opens in blue color. After I click on the 'Go' button it changes to yellow. But why does it not change to green when it enters the function 'func2'?
import time
import tkinter
global win
def func1():
global win
win = tkinter.Tk()
win.geometry("300x200")
win.configure(bg='blue')
time.sleep(5)
button_win = tkinter.Button(win,text='Go',command=func2)
button_win.pack()
print('mainloop')
win.mainloop()
def func2():
print("func2")
global win
win.configure(bg = 'green')
time.sleep(5)
print("in func1")
time.sleep(5)
print("func3 call")
func3()
def func3():
global win
time.sleep(5)
win.configure(bg = 'yellow')
func1()
OUTPUT in console
mainloop
(I click on 'Go' button)
func2
in func1
func3 call