Help with pyHook error.
- by Shady
Hey,
I'm trying to make a global hotkey with pyhook in python that is supposed to work only with the alt key pressed.
here is the source:
import pyHook
import pythoncom
hm = pyHook.HookManager()
def OnKeyboardEvent(event):
if event.Alt == 32 and event.KeyID == 49:
print 'HERE WILL BE THE CODE'
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()
but when I execute, only works with the second press of the second key (number 1 = 49)... and give this error:
http://img580.imageshack.us/img580/1858/errord.png
How can I solve it? For work at the first pressed time.