code: def run(self):
          
          self.state = True
          self.hm.KeyAll = self.handler
          self.hm.HookKeyboard()
          while self.state:
              time.sleep(0.01)
              pythoncom.PumpWaitingMessages()
docs: Begin listening for keyboard input events.