keyboard_listener
Keyboard Listener is a module that allows you to create custom hotkeys (combinations) or custom keywords and bind them to custom functions in Python. It's really easy to use and can be installed via pip:
pip install keyboard_listener
Combinations are custom hotkeys that are bound to functions. When the combination is pressed, the function is executed. Combos are really easy to set up and can be seen in the example below.
Keywords are custom strings that when entered (or rather, when their characters are entered in sequence) trigger a function to be executed. Keywords are also shown in the example below.
KeyboardListener object needs to be instantiated with the custom combinations and custom keywords dictionaries before running. Please refer to the below example to see how to set those up. If no dictionaries are passed, the program will assume no combinations or keywords are set up.
Example:
from keyboard_listener import KeyboardListener, Combo, KeyWord
def function_1(arguments):
# do something
def function_2(arguments):
# do something else
combinations = {
'function 1': Combo(['alt'], 'f', function_1, arguments),
#Function 1 is executed when the user presses Alt+F
'function 2': Combo(['ctr','alt'], 'g', function_2, arguments),
#Function 2 is executed when the user presses Alt+G
'function 3': Combo(['shift','alt'], 'H', function_2, arguments),
#Be mindful when setting up Combos that include 'shift'. If the Combo includes the shift key, the character must be uppercase.
}
keywords = {
'keyword_1': KeyWord('keyword1', function_1, arguments),
#Function 1 is executed when the user types 'keyword1'
'keyword_2': KeyWord('keyword1', function_2, arguments)
#Function 2 is executed when the user types 'keyword2'
}
keyboard_listener = KeyboardListener(combinations=combinations, keywords=keywords)
keyboard_listener.run()
Metadata
Release files for keyboard-listener 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keyboard-listener-0.0.7.tar.gz | 3.4 kB | Without provenance | Details for keyboard-listener-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keyboard_listener-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for keyboard_listener-0.0.7-py3-none-any.whl |
Total release size: 19.5 kB
Release files / keyboard-listener-0.0.7.tar.gz
| Download URL | keyboard-listener-0.0.7.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
849ce710d243cefc98cccea3cd13d41a6e5a7886d9aabd56ab54f99d90437e64
|
|
BLAKE2b-256 checksum How to use checksums |
c12c5bc5e3660ad2bc27ee61467116e0867d8af61a4b05e299793d2fbd04a527
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
|
Release files / keyboard_listener-0.0.7-py3-none-any.whl
| Download URL | keyboard_listener-0.0.7-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10bd9e03aaaea6d8173020109f6f4b1833f3d230abb0ea1a47583d6bf1b0129b
|
|
BLAKE2b-256 checksum How to use checksums |
815788272c461f5c261834cafa5e9275a6648b2433c4458ce22729bf49493e7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
|
Security for keyboard-listener 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.