Copy from official site:
pyHook is a python wrapper for global input hooks in Windows. Specifically it wraps the Windows SetWindowsHookEx API function using low-level keyboard (WH_KEYBOARD_LL) and mouse (WH_MOUSE_LL) hooks. The pyHook package provides callbacks for global mouse and keyboard events in Windows. Python applications register can event handlers for user input events such as left mouse down, left mouse up, key down, etc. and set the keyboard and/or mouse hook. The underlying C library reports information like the time of the event, the name of the window in which the event occurred, the value of the event, any keyboard modifiers, etc. Events can be logged and/or filtered.
Make sure you are under "Visual Studio 2008 Command Prompt".
python setup.py build_ext --swig=path-to-swig.exe
pip install .
Fixed unicode decoding bug of window title. This bug may cause crashing on exit randomly. Usually with console output:
TypeError: MouseSwitch() takes exactly 9 arguments (1 given)
or
TypeError: KeyboardSwitch() takes exactly 9 arguments (1 given)
Original pyHook will cause "cannot find _cpyHook module" error when using PyInstaller or cx-freeze to freeze python app. You need manually rename pyHook._cpyHook
to _cpyHook
. Now it's compatible with cx-freeze.