def mainloop(self): try: NSThread.mainThread().setThreadPriority_(1.0) except AttributeError: pass except: unhandled_exc_handler() threading.currentThread().signal_stop = self.exit_mainloop self.cocoa_ui_kit.mainloop()