pythoncom泵消息在python中

2024-06-01 13:35:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我在用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.pump消息线程中的函数?在


Tags: eventlog密码loggingdeffilenamethread记录器