tags:

views:

27

answers:

0

this is my script:

import pyHook
import pythoncom

hookManager = pyHook.HookManager()

def onKeyboardEvent(event):
     if event.KeyID == 113: # F2
        #do something#
     return True

hookManager.KeyDown = onKeyboardEvent
hookManager.HookKeyboard()
pythoncom.PumpMessages()

after the key specified on the keyboard event, or the F2 key as my script, is pressed for several times, the script stop working...

Anyone knows why? or how to solve it?

I have to restart the script every time this happens, and I have to press the key a lot in my script...