I'm trying to make a simple coutdown timer that will count down from 15 seconds and update the window by writing the second we are on at the moment. This is my code.
from tkinter import *
import time
def Timer():
time_left = 15
while time_left > 0:
timeLabel = Label(root, text=time_left)
timeLabel.pack()
time_left -= 1
time.sleep(1)
print (time_left)
Timer()
root.mainloop()
I only put the print statement there to know if it's working, which it is. In the console it's updating every second counting down from 15. But the tkinter window doesn't even open. It only opens when the While loop finishes and I just get a big list from 15 down to 1 instead of it opening in the beginning and updating every second. Why?