def StartKeyCapture(self): self.hookManager = pyHook.HookManager() self.hookManager.KeyDown = self.OnKeypressCallback self.hookManager.HookKeyboard() pythoncom.PumpMessages()