I started learning python a few days ago and I have been messing around with Tkinter. I have been making a cookie-clicker type of game to practice what I learned. Everything worked except for a button that when clicked should start adding 1 point every 30 seconds.
I isolated the problem to this this:
from tkinter import *
import time
cookies_clicked = 0
cursors = 0
main_window = Tk()
main_window.title("Cookie Clicker")
main_window.geometry("900x500")
def click():
global cookies_clicked
global cursors
cursors += 1
while 0 == 0:
print("test")# this is for me to check if the loop is working
cookies_clicked += cursors
time.sleep(30)
up_1 = Button(main_window, text="Upgrade 1", command=click)
up_1.place(x=410, y=100)
main_window.mainloop()
I know the loop is working when I click the button because "test" is printed every 30 seconds, but the Tkinter window stops responding completely.