2010-07-01 138 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 
相關問題