I've created a simple function with a Tkinter module to create a timer. But I face some issues and can't get it work : with an answer.get(), I want to know how long the counter will be working, but sec -= 1 prevents the function to carry on. What am I doing wrong, please ?
Thank you for your help, here's a part of the code :
def timer():
labelUn.config(text='Enter the required number of seconds:')
def launchTimer():
sec=int(answer.get())
def launch():
nonglobal sec
if sec>0:
sec -= 1
labelUn.config(text=sec)
print(sec)
root.after(1000, launch)
if sec<=0:
labelUn.config(text="that's it!")
print(sec)
return
button1.config(command=launch)
button1.config(command=launchTimer)