def mainloop(self):
    "Creates a synthetic main loop so that threads can still run."
    while True:
        try:
            self.update()
        except tkinter.TclError:
            break
        else:
            time.sleep(tkinter._tkinter.getbusywaitinterval() / 1000)
Creates a synthetic main loop so that threads can still run.
recipes/Python/578153_safetkinterpy/recipe-578153.py