Help with pyHook error.
Posted
by Shady
on Stack Overflow
See other posts from Stack Overflow
or by Shady
Published on 2010-06-15T21:12:08Z
Indexed on
2010/06/15
21:12 UTC
Read the original article
Hit count: 347
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.
© Stack Overflow or respective owner