# getchlib - library for reading key presses
## Overview
`getchlib` is library for reading key presses and assigning hotkeys.
### Features
1. Full Unicode support
1. Blocking and non-blocking key press reading
1. Cross-platform support
1. Basic hotkeys ( `CTRL-V` or `ALT-A` ) are defined
1. Not interruptable key press reading support ( cannot be interrupted by `CTRL-C`, returns key code instead )
### Installation
```
pip install getchlib
```
## Usage
### Key Presses
#### Blocking
```python
import getchlib
key=getchlib.getkey()
```
Waits until user presses a key.
#### Non-Blocking
```python
import getchlib
key=getchlib.getkey(False)
```
Returns first key pressed in time specified by its second argument `tout` ( 0.01 by default ).
#### Not interruptable
```python
import getchlib
key=getchlib.getkey(catch=True)
```
### Hotkeys
```python
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener()
f.add_hotkey('ctrl-x',function)
f.start()
```
***NOTE***:*f.start() runs on foreground*
#### Not interruptable
```python
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***
PyPI 官网下载 | getchlib-1.0.6.tar.gz
版权申诉
182 浏览量
2022-01-27
20:13:02
上传
评论
收藏 11KB GZ 举报
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
最新资源
- html动态爱心代码一(附源码)
- c40539bc-071a-486c-9d52-9d0c18d62dac 4.html
- 基于物理的非视域成像(NLOS)算法,利用了nerf+python源码+文档说明
- yuluer知更鸟.7z(1).001
- 基于Qt实现医院信息管理系统c++源码+文档说明+数据库(期末大作业)
- 基于python实现的医院信息管理系统完整源码+sql数据库+详细注释(高分课程设计)
- 基于python的眼底图像视杯视盘分割项目源码+文档说明+截图演示+详细注释(高分课程设计)
- ImageBasedModellingEdu-贰壹贰叁零
- DFFmeasurement-数据预处理
- ImageBasedModellingEdu-回文素数c语言
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈