Library for reading key presses
Project description
getchlib - library for reading key presses
Overview
getchlib
is library for reading key presses and assigning hotkeys.
Features
- Full Unicode support
- Blocking and non-blocking key press reading
- Cross-platform support
- Basic hotkeys (
CTRL-V
orALT-A
) are defined - Not interruptable key press reading support ( cannot be interrupted by
CTRL-C
, returns key code instead )
Installation
pip install getchlib
Usage
Key Presses
Blocking
import getchlib
key=getchlib.getkey()
Waits until user presses a key.
Non-Blocking
import getchlib
key=getchlib.getkey(False)
Returns first key pressed in time specified by its second argument tout
( 0.01 by default ).
Not interruptable
import getchlib
key=getchlib.getkey(catch=True)
Echo argument (new in v1.0.3)
With echo=True
characters readed are echoed to the screen.
key=getchlib.getkey(echo=True)
Hotkeys
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener()
f.add_hotkey('ctrl-x',function)
f.start()
Not interruptable
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener(catch=True)
f.add_hotkey('a',function)
f.start()
License
getchlib
is licensed under GPL License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
getchlib-1.0.7.tar.gz
(12.3 kB
view details)
File details
Details for the file getchlib-1.0.7.tar.gz
.
File metadata
- Download URL: getchlib-1.0.7.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86721a8c8ca25716882364963ba0ec3a32024a7765266b4fa7fd858a9fb323a9 |
|
MD5 | 88ad4850ec66334220d701ba8bf11866 |
|
BLAKE2b-256 | afec5860417655dae02de063ee606d015b9bc5b4fc612d5d251d8192d4365780 |