def start(timer):
global minuti
canvas.itemconfig(second_text, text=f"0{timer}")
window.after(1000, start, timer + 1)
if len(str(timer)) < 2:
print(timer)
canvas.itemconfig(second_text, text=f"0{timer}")
else:
canvas.itemconfig(second_text, text=timer)
if timer / 10 == 1:
timer = 0
minuti = minuti + 1
if len(str(minuti)) < 2:
canvas.itemconfig(minute_text, text=f"0{minuti}")
else:
canvas.itemconfig(minute_text, text=minuti)
Hello, I have this code, and when the timer is equal to 10 I want to reset it to 0. The code above is not working properly, the line of code "timer = 0" is saying "Local variable 'timer' value is not used". I think is a Scope problem, but i'm not sure.
Can somebody help me??
PS: i've tried to change : timer = 0 with window.after(1000, start, timer - 10) and is working... Can somebody explain why this is working? Thanks.