Note from the tutorial that you need a return value at the end of your handler:
def OnKeyboardEvent(event):
if event.Alt == 32 and event.KeyID == 49:
print 'HERE WILL BE THE CODE'
# return True to pass the event to other handlers
return True
I agree it's ambiguous from the docs whether that's required, but you do need to return True or False (or possibly any integer value), with any "false" value (e.g. 0) blocking the event such that no subsequent handlers get it. (This lets you swallow certain keystrokes conditionally, as in the Event Filtering section of the tutorial.)
(This wasn't as easy to figure out as it might look! :-) )
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…