pynput This library allows you to control and monitor input devices. Currently, mouse and keyboard input and monitoring are supported. See here for the full documentation.