Asynchronous keyboard input
Project description
askin
Asynchronous Keyboard Input
askin is a Python package that provides a simple way to get keyboard input asynchronously.
Installation
pip install askin
Usage
from askin import KeyboardController
class KeyState:
def __init__(self):
self.value = 0
async def update(self, key: str):
if key == "a":
self.value += 1
elif key == "b":
self.value -= 1
async def key_handler(key: str):
key_state.update(key)
async def main():
key_state = KeyState()
controller = KeyboardController(key_handler=key_state.update, timeout=0.001)
await controller.start()
try:
while True:
print(key_state.value)
await asyncio.sleep(0.1)
finally:
await controller.stop()
if __name__ == "__main__":
asyncio.run(main())
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
askin-0.0.1.tar.gz
(5.1 kB
view details)
File details
Details for the file askin-0.0.1.tar.gz.
File metadata
- Download URL: askin-0.0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
508c29658144427b568189e5b52b46dc3e99f69ca91f0c56b8680c5faf7e6bbb
|
|
| MD5 |
9303636d98bac54566add5100f5e0a89
|
|
| BLAKE2b-256 |
4462d9908fcb84c2227bc723d3a238dd78a40440b371cc412d177195990df4c6
|
Provenance
The following attestation bundles were made for askin-0.0.1.tar.gz:
Publisher:
publish.yml on WT-MM/asKin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
askin-0.0.1.tar.gz -
Subject digest:
508c29658144427b568189e5b52b46dc3e99f69ca91f0c56b8680c5faf7e6bbb - Sigstore transparency entry: 195243871
- Sigstore integration time:
-
Permalink:
WT-MM/asKin@2fff55a255568afebf1318483c64e210e2ca42da -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/WT-MM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2fff55a255568afebf1318483c64e210e2ca42da -
Trigger Event:
release
-
Statement type: