How to call a method / function periodically? (time.sleep fails) [duplicate]
问题 This question already has answers here : How do I create an automatically updating GUI using Tkinter? (4 answers) Closed last year . How can I call update periodically? I tried the following but it skips showing GUI for the limit seconds and then shows only the last update: import tkinter as tk import time root = tk.Tk() widget = tk.Label(root, text="Initial text") widget.pack() def update(): global widget limit = 3 period = 1 for each in range(limit): widget['text'] = each time.sleep(period)