Python: Tkinter only opening after keyboard interrupt Python: Tkinter only opening after keyboard interrupt tkinter tkinter

Python: Tkinter only opening after keyboard interrupt


You should call mainloop function to make Tkinter event loop start.

If you need run code periodically, use after instead of infinite while loop.

...def fun1():    r = random.randrange(len(facts))    lbl = Label(gui,text=facts[r]).pack()    gui.after(5000, fun1)gui.after(5000, fun1) # <--- Call `fun1` function after 5000 ms.mainloop()