I have a very strange problem. When I press stop, the code does not stop. see:
import tkinter as tk
x=tk.Tk()
stops=False
def stop():
stops=True
print("STOPPED")
tk.Button(x,command=stop,text="Stop").pack()
while not stops:
print(stops)
x.update()
x.update_idletasks()
If I press stop, why does still it keep on printing?
the stops
variable is not edited in the while loop, so why doesn't it stop?
I have also tried adding this to the end of the while loop:
if stops:
break
But it still does not stop. Why?