from ctypes import * import pythoncom import pyHook def KeyStroke(event) print "[%s]" % event.Key, #输出键盘按下的键 return True k1 = pyHook.HookManager() k1.KeyDown = KeyStroke k1.HookKeyboard() pythoncom.PumpMessages()
原文地址:http://knowledgeq.blog.51cto.com/9549168/1951944