How do you run your own code alongside Tkinter’s event loop?
Use the after method on the Tk object: from tkinter import * root = Tk() def task(): print(“hello”) root.after(2000, task) # reschedule event in 2 seconds root.after(2000, task) root.mainloop() Here’s the declaration and documentation for the after method: def after(self, ms, func=None, *args): “””Call function once after given time. MS specifies the time in milliseconds. … Read more