2010-07-01 142 views

回答

1

你应该能够得到一个KEYUP/keydown事件,而不是一个按键事件。

然后你要做的就是保存一个已关闭的按钮列表,并在调用keyup时移除该按钮。

0

使用GetKeyState查看是否按下了另一个键。当按Ctrl-Shift-q时尝试退出:

import win32con 

def OnKeyboardEvent(event): 
    if event.Ascii == 81 and 
     win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000 and 
     win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000: 
     LogFile.close() 
     exit() 
    LogFile.write(str(event.Key)) 

return True 
相关问题