def init(): hm = pyHook.HookManager() hm.KeyDown = on_event hm.HookKeyboard() pythoncom.PumpMessages()