defKey-1.0.1
توضیحات
Non-blocking keybinds using threads
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | defKey-1.0.1 |
| نام | defKey |
| نسخه کتابخانه | 1.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Riley/a11ce |
| ایمیل نویسنده | a11ce@protonmail.com |
| آدرس صفحه اصلی | https://github.com/a11ce/defKey |
| آدرس اینترنتی | https://pypi.org/project/defKey/ |
| مجوز | - |
# defKey
> Non-blocking keybinds using threads.
## Setup
- Download with `pip3 install defKey`
- Import with `import defKey`
## Usage
defKey allows the binding of keys to Python functions. When activated, defKey spawns a new thread which catches all keypresses (thus breaking `input()`) and, if they have been bound, spawns a new thread which executes the bound function. This is best for games and TUI programs.
### Example
```
from defKey import defKey
def hello():
print("hello")
def goodbye():
print("goodbye")
def actualGoodbye():
defKey.stop()
defKey.bind("h", hello)
defKey.bind("g", goodbye)
defKey.bind("q", actualGoodbye)
defKey.start()
```
You must call `defKey.stop()` before using `input()`. Binds will be retained and defKey can be restarted after.
---
All contributions are welcome by pull request or issue.
defKey is licensed under GNU General Public License v3.0. See [LICENSE](../master/LICENSE) for full text.
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl defKey-1.0.1:
pip install defKey-1.0.1.whl
نصب پکیج tar.gz defKey-1.0.1:
pip install defKey-1.0.1.tar.gz