In following line, the code is calling updateTime
directly; causing recursive call.
root.after(500, updateTime(var))
# ^ ^
Pass the function and argument without calling it will solve your problem.
root.after(500, updateTime, var)
Alternatively you can use lambda
:
root.after(500, lambda: updateTime(var))
BTW, using time.strftime
, updateTime
can be reduced:
def updateTime(var):
var.set(time.strftime('%H:%M:%S'))
root.after(500, updateTime, var)