Windows global hooks in pure Python
The implementation uses foreign function interface (FFI) provided by standard Python module ctypes and inspired by pyHook, pyhooked and other similar modules (the code was re-written from scratch). It tends to be a superset of pyHook but in pure Python only so it doesn’t require compilation.
- Current set of hooks implemented:
More detailed documentation about Windows hooks can be found in MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632589.aspx
This module can be used as a stand alone or along with pywinauto. The fork of this code (at some moment) was used in standalone library pyhooked 0.8 maintained by Ethan Smith.
Hook for low level keyboard and mouse events
Hook mouse and/or keyboard events
Verify if any of hooks are active
Listen for events
Stop the listening loop
Unhook keyboard events
Unhook mouse events
KeyboardEvent(current_key=None, event_type=None, pressed_key=None)¶
Created when a keyboard event happened
MouseEvent(current_key=None, event_type=None, mouse_x=0, mouse_y=0)¶
Created when a mouse event happened