# 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***
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/getchlib/",
"name": "getchlib",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Adam Jenca",
"author_email": "jenca.a@gjh.sk",
"download_url": "https://files.pythonhosted.org/packages/ea/67/f4feeb9b3af0acdad8a1951b109f20873785090e3e3d1ac80116630c44fe/getchlib-1.1.1.tar.gz",
"platform": null,
"description": "\n# getchlib - library for reading key presses\n\n## Overview\n`getchlib` is library for reading key presses and assigning hotkeys.\n### Features\n1. Full Unicode support\n1. Blocking and non-blocking key press reading\n1. Cross-platform support\n1. Basic hotkeys ( `CTRL-V` or `ALT-A` ) are defined\n1. Not interruptable key press reading support ( cannot be interrupted by `CTRL-C`, returns key code instead )\n1. Keys like arrow up, arrow left, arrow down, arrow right are defined (for full list, view getchlib.keynames.raw)\n### Installation\n```\npip install getchlib\n```\n## Usage\n### Key Presses\n#### Blocking\n```python\nimport getchlib\nkey=getchlib.getkey()\n```\nWaits until user presses a key.\n#### Non-Blocking\n```python\nimport getchlib\nkey=getchlib.getkey(False)\n```\nReturns first key pressed in time specified by its second argument `tout` ( 0.01 by default ).\n#### Not interruptable \n```python\nimport getchlib\nkey=getchlib.getkey(catch=True)\n```\n#### Echo argument (new in v1.0.3)\nWith `echo=True` characters readed are echoed to the screen.\n```python\nkey=getchlib.getkey(echo=True)\n\n```\n### Hotkeys\n```python\nimport getchlib\ndef function():\n\tprint('hello')\nf=getchlib.HotKeyListener()\nf.add_hotkey('ctrl-x',function)\nf.start()\n```\n#### Not interruptable\n```python\nimport getchlib\ndef function():\n\tprint('hello')\nf=getchlib.HotKeyListener(catch=True)\nf.add_hotkey('a',function)\nf.start()\n```\n#### Non-blocking (linux only)\n```python\nimport getchlib\ndef function():\n\tprint('hello')\nf=getchlib.HotKeyListener(catch=True)\nf.add_hotkey('a',function)\n...\nf.terminate()\n```\n## License\n*`getchlib` is licensed under* ***GPL License***\n",
"bugtrack_url": null,
"license": null,
"summary": "Library for reading key presses",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://pypi.org/project/getchlib/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3232e545a0bd7af9fe5a5ca108045b3e4fa73709a89e70c1b0c04eb0770391b0",
"md5": "cc9c9bf38056801a578ac377314b5b54",
"sha256": "2525a8ba63f81a99be67184bc4ca476deb5f702d3dc79987a0289d72777025b9"
},
"downloads": -1,
"filename": "getchlib-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cc9c9bf38056801a578ac377314b5b54",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13816,
"upload_time": "2024-07-07T15:34:07",
"upload_time_iso_8601": "2024-07-07T15:34:07.116246Z",
"url": "https://files.pythonhosted.org/packages/32/32/e545a0bd7af9fe5a5ca108045b3e4fa73709a89e70c1b0c04eb0770391b0/getchlib-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ea67f4feeb9b3af0acdad8a1951b109f20873785090e3e3d1ac80116630c44fe",
"md5": "0dd8d107dd25d0a2b8755f64a32e5ee6",
"sha256": "6b05ca7ffee2aca9da326fae0c0ea8ded0f2df58f94f4b926100e80d5e8628f8"
},
"downloads": -1,
"filename": "getchlib-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "0dd8d107dd25d0a2b8755f64a32e5ee6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12437,
"upload_time": "2024-07-07T15:34:08",
"upload_time_iso_8601": "2024-07-07T15:34:08.728472Z",
"url": "https://files.pythonhosted.org/packages/ea/67/f4feeb9b3af0acdad8a1951b109f20873785090e3e3d1ac80116630c44fe/getchlib-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-07 15:34:08",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "getchlib"
}