def quit(self): """Shuts down the World.""" # tell other threads that the world is gone self.exists = False # destroy closes the window self.destroy() # quit terminates mainloop (but since mainloop can get called # recursively, quitting once might not be enough!) Gui.quit(self)