PyHook to catch mouse events
neruyume at hotmail.com
Mon Jan 23 07:06:39 EST 2012
Using PyHook to record mouse events, one has to add quite a few lines to set up a hook, and as far as I have experienced, if one uses time.sleep() or some other function that spends some time doing something, the program freezes my computer completely while doing this (the cursor starts moving slowly, and so on).
Also: Ctrl+c does not work, I have to click the cross to exit the program, which is horrible when combined with the freezing mentioned earlier.
Is there a way to avoid the program freezing up? Using the win32api somehow, rather than PyHook? (I only know how to generate input with win32api, not catch output).
import pythoncom, pyHook
def OnMouseEvent(self, event):
#time.sleep(1) #If I uncomment this, running the program will freeze stuff, as mentioned earlier.
recordit = record()
hm = pyHook.HookManager()
hm.MouseAll = recordit.OnMouseEvent
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list