Python provides a library named
keyboard which is used to get full control of the keyboard. It’s a small Python library which can hook global events, register hotkeys, simulate key presses and much more.
- It helps to enter keys, record the keyboard activities and block the keys until a specified key is entered and simulate the keys.
- It captures all keys, even onscreen keyboard events are also captured.
- Keyboard module supports complex hotkeys.
- Using this module we can listen and send keyboard events.
- It works on both windows and linux operating system.
Install using this command:
pip install keyboard
GEEKS FOR GEEKS RK rk
Example #2: Keyboard module to enter hotkeys.
ark you entered hotkey
Example #3: Keyboard module also used to record all the keyboard activities and replay them using play method.
Reference : https://pypi.org/project/keyboard/
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Mouse and keyboard automation using Python
- Simple Keyboard Racing with Python
- Python | Vkeyboard (virtual keyboard) in kivy
- Python VLC MediaPlayer – Enabling Keyboard Input
- Keyboard Shortcuts for Ubuntu | Set - 1
- PyQt5 QSpinBox - Checking if user can change value using keyboard or not
- PyQt5 QCalendarWidget -Grabbing Keyboard input
- PyQt5 QCalendarWidget - Releasing Grabbed Keyboard input
- PyQt5 QCalendarWidget - Keyboard Grabber Property
- PYGLET – Setting Exclusive Keyboard for Window
- MySQL-Connector-Python module in Python
- twitter-text-python (ttp) module - Python
- Import module in Python
- OS Module in Python with Examples
- struct module in Python
- Secrets | Python module to Generate secure random numbers
- Python calendar module | formatmonth() method
- Python | Writing to an excel file using openpyxl module
- Count frequencies of all elements in array in Python using collections module
- OS Path module in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.