PyGame meets async/await
Project description
AsyncPygame
Let's say you want to do:
print('A')
- wait for 1000ms
print('B')
- wait for a mouse button to be pressed
print('C')
in that order.
The asyncpygame
module allows you to implement that like this:
async def what_you_want_to_do(*, clock, sdlevent, **kwargs):
print('A')
await clock.sleep(1000)
print('B')
e = await sdlevent.wait(MOUSEBUTTONDOWN)
print('C')
Currently, there are no proper tutorials available. Please refer to the examples.
Installation
Pin the minor version.
poetry add asyncpygame@~0.1
pip install "asyncpygame>=0.1,<0.2"
Tested on
- CPython 3.10 + pygame-ce 2.5
- CPython 3.11 + pygame-ce 2.5
- CPython 3.12 + pygame-ce 2.5
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
asyncpygame-0.1.2.tar.gz
(8.7 kB
view hashes)
Built Distribution
Close
Hashes for asyncpygame-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1eca6f92b1d50599a46f965bc29d96fc3ad2bd761efa7c098c290a11748a0ac |
|
MD5 | 9a805534a60161e1361bf6ecdc5b044b |
|
BLAKE2b-256 | 78188c0c00af141a9a5edd2c615ed91d6833c6f17089c2dc7a327ba1d1f185c3 |