Anonymous nanotube

About pyHook

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.


System Requirements

  • Windows 2000 or later (low-level hooks are not supported in earlier versions of Windows)
  • Python 2.4 or later
  • PyWin32 (formerly known as win32all extensions)


Binary releases

This project provides compiled releases of the pyHook library in the file releases section of the project site. It is advised that you use the latest release. If you choose to use the precompiled installer, all you have to do is double-click the installer and follow the install wizard.

Source releases

The project also makes source code releases, also posted in the file releases section. You can if you wish get the source zip, and compile the code yourself, using these instructions. This will produce a binary installer for you, just like the ones released by the project.

You can also pull the latest code from git, if you are feeling adventurous.

Planned Features

  • Switch to using Unicode instead of Ascii, to be more useful to non-English locales
  • Fix the dead-keys bug


pyHook is licensed under the MIT Licence.


The original author of this library is Peter Parente (though he no longer maintains this project.)

Need help?

If you need help, please post on the help forum of the project site.


Wiki: PyHook_Build_Instructions
Wiki: PyHook_Tutorial