def run(self): try: if not self.init: self.setup() self.message_pump() finally: HotKey.unregister_all() WindowsTimer.unregister_all()
def message_pump(self): quit_key = HotKey(lambda: 0, key=self.kill_key) msg = wintypes.MSG() while user32.GetMessageA(byref(msg), None, 0, 0) != 0: if msg.message == win32con.WM_HOTKEY: if msg.wParam == quit_key.id: break HotKey.on_hotkey(msg.wParam) elif msg.message == win32con.WM_TIMER: WindowsTimer.on_WM_TIMER(msg.wParam) user32.TranslateMessage(byref(msg)) user32.DispatchMessageA(byref(msg))
def __init__(self, material_queue, word_queue, product_queue): super(GUI, self).__init__(None, title, size) self.material_queue = material_queue self.word_queue = word_queue self.product_queue = product_queue self.item_queue = queue.Queue() self.Bind(wx.EVT_CLOSE, self.close_handler) self.words = init_list() self.bind() wx.CallLater(delta, self.respond) if HotKey: HotKey(self)