What is the difference between
def after_func():
while True:
now_time.configure(text=datetime.datetime.now().strftime('%H: %M: %S'))
time.sleep(1)
root = Tk()
now_time = Label(text=datetime.datetime.now().strftime('%H: %M: %S'))
now_time.pack()
root.after(10, after_func)
root.mainloop()
and
def after_func():
now_time.configure(text=datetime.datetime.now().strftime('%H: %M: %S'))
root.after(1000, after_func)
root = Tk()
now_time = Label(text=datetime.datetime.now().strftime('%H: %M: %S'))
now_time.pack()
root.after(10, after_func)
root.mainloop()
Why does the first one give a not responding message while the second one results in a clock that updates every one second? In my opinion the two codes should yield the same result.