-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
92 lines (89 loc) · 2.25 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import setuptools
setuptools.setup(
name="getchlib",
version="1.1.2",
description="Library for reading key presses",
long_description="""
# 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 )
1. Keys like arrow up, arrow left, arrow down, arrow right are defined (for full list, view getchlib.keynames.raw)
### 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)
```
#### Echo argument (new in v1.0.3)
With `echo=True` characters readed are echoed to the screen.
```python
key=getchlib.getkey(echo=True)
```
### Hotkeys
```python
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener()
f.add_hotkey('ctrl-x',function)
f.start()
```
#### Not interruptable
```python
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener(catch=True)
f.add_hotkey('a',function)
f.start()
```
#### Non-blocking (linux only)
```python
import getchlib
def function():
print('hello')
f=getchlib.HotKeyListener(catch=True)
f.add_hotkey('a',function)
...
f.terminate()
```
## License
*`getchlib` is licensed under* ***GPL License***
""",
long_description_content_type="text/markdown",
author="Adam Jenca",
packages=["getchlib", "getchlib.keynames"],
url="https://pypi.org/project/getchlib/",
author_email="jenca.a@gjh.sk",
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
],
)