I want to stop pythoncom working
问题 I was writing a code about keylogging by pyHook. The following codes are example: import pythoncom as pc, pyHook as ph def KeyboardHook(event): print chr(event.Ascii) return True hm = ph.HookManager() hm.KeyDown = KeyboardHook hm.HookKeyboard() pc.PumpMessages() I want to stop pythoncom's PumpMessages method for a while later (for example five seconds). But I couldn't find any answer to it. I use: Windows 7, Python2.7 Thanks for answer. 回答1: You will have to use pythoncom.PumpWaitingMessages