https://github.com/asyncgui/asyncpygame
Async/await-based framework for PyGame
https://github.com/asyncgui/asyncpygame
pygame
Last synced: 4 months ago
JSON representation
Async/await-based framework for PyGame
- Host: GitHub
- URL: https://github.com/asyncgui/asyncpygame
- Owner: asyncgui
- License: mit
- Created: 2023-11-14T11:35:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-30T05:52:17.000Z (about 1 year ago)
- Last Synced: 2025-10-26T07:21:59.697Z (8 months ago)
- Topics: pygame
- Language: Python
- Homepage: https://asyncgui.github.io/asyncpygame/
- Size: 643 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AsyncPygame
Let's say you want to do:
1. `print('A')`
1. wait for 1000ms
1. `print('B')`
1. wait for a mouse button to be pressed
1. `print('C')`
in that order.
The `asyncpygame` module allows you to implement that like this:
```python
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')
```
[Youtube](https://youtu.be/kvy0_aVUFLM)
[API Reference](https://asyncgui.github.io/asyncpygame/)
Currently, there are no proper tutorials available.
Please refer to the examples.
## Installation
Pin the minor version.
```text
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