Keyboard
From charlesreid1
Contents
Notes
Link: https://github.com/boppreh/keyboard
Fork that adds support for Mac keyboards (very useful set of 0x commands for particular keys): https://github.com/willwade/PyUserInput/blob/master/pykeyboard/mac.py
The keyboard library allows you to control the keyboard directly from Python.
Installing
pip install keyboard
This raised some problem with Quartz, so I ran:
$ pip install pyobjc $ pip install pyobjc-framework-Quartz # should be redundant, but just in case...
Using
A short example of what you can do with the library:
import keyboard keyboard.press_and_release('shift+s, space') keyboard.write('The quick brown fox jumps over the lazy dog.') # Press PAGE UP then PAGE DOWN to type "foobar". keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar')) # Blocks until you press esc. keyboard.wait('esc') # Record events until 'esc' is pressed. recorded = keyboard.record(until='esc') # Then replay back at three times the speed. keyboard.play(recorded, speed_factor=3) # Type @@ then press space to replace with abbreviation. keyboard.add_abbreviation('@@', 'my.long.email@example.com') # Block forever. keyboard.wait()
Flags
Python a powerful programming language
Scientific Python: Data analysis libraries: Scipy · Numpy · Pandas · Statsmodel Machine learning libraries: Sklearn Neural network libraries: Tensorflow · Keras Plotting/viz: Matplotlib · Seaborn · Jupyter Solving partial differential equations and bessel functions: Fipy · Bessel Functions
Web and Networking Python: Web programming: Flask · Webapps · Mechanize · Scrapy · Gunicorn Wifi: Wireless/Python · Scapy IPython and Jupyter: Jupyter
Drawing, Geometry, and Shapes: Shapely (for drawing shapes): Shapely Geography library: Geos
General Useful Python Utilities: Python Remote Objects: Pyro Logging (create multi-channel log messages): Logging Keyboard (control keyboard from Python): Keyboard
Black Hat Python: Network scanning: Python/Scanner
|