I was recently trying to create a pomodoro app using tkinter and customtkinter but my app is crashing when I click on the play button.
def counting_down():
minute_left = int(timer.get()) - 1
second = 59
for i in range(60*minute_left):
time.sleep(1)
count_label = customtkinter.CTkLabel(root, text=str(minute_left), font=("Times New Roman", 20, "bold"))
count_label.place(x=120, y=300)
count_label2 = customtkinter.CTkLabel(root, text=second, font=("Times New Roman", 20, "bold"))
count_label2.place(x=145, y=300)
second -= 1
if second < 0:
second = 59
minute_left -= 1
count_label.destroy()
count_label = customtkinter.CTkLabel(root, text=str(minute_left), font=("Times New Roman", 20, "bold"))
count_label.place(x=120, y=300)
count_label2.destroy()
count_label2 = customtkinter.CTkLabel(root, text=second, font=("Times New Roman", 20, "bold"))
count_label2.place(x=145, y=300)
if minute_left == 0 and second == 0:
count_label2.destroy()
count_label.destroy()
count_label = customtkinter.CTkLabel(root, text="FINISHED", font=("Times New Roman", 20, "bold"))
count_label.place(x=135, y=300)
this is the function and I use it in my play button
play_button = customtkinter.CTkButton(root, text="PLAY", width=70, command=counting_down)
play_button.place(x=75, y=200)
I tried to click on the play button and then program didn't respond, so I terminate the code then I got an error about a python crash