# 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
Raw data
{
"_id": null,
"home_page": "https://github.com/asyncgui/asyncpygame",
"name": "asyncpygame",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "async, pygame",
"author": "Natt\u014dsai Mit\u014d",
"author_email": "flow4re2c@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/a0/cfbcb93e490e56c2b1e45f415b922082588144e2d64f519082bc56a01902/asyncpygame-0.1.3.tar.gz",
"platform": null,
"description": "# AsyncPygame\n\nLet's say you want to do:\n\n1. `print('A')`\n1. wait for 1000ms\n1. `print('B')`\n1. wait for a mouse button to be pressed\n1. `print('C')`\n\nin that order.\nThe `asyncpygame` module allows you to implement that like this:\n\n```python\nasync def what_you_want_to_do(*, clock, sdlevent, **kwargs):\n print('A')\n await clock.sleep(1000)\n print('B')\n e = await sdlevent.wait(MOUSEBUTTONDOWN)\n print('C')\n```\n\n[Youtube](https://youtu.be/kvy0_aVUFLM) \n[API Reference](https://asyncgui.github.io/asyncpygame/)\n\nCurrently, there are no proper tutorials available.\nPlease refer to the examples.\n\n## Installation\n\nPin the minor version.\n\n```text\npoetry add asyncpygame@~0.1\npip install \"asyncpygame>=0.1,<0.2\"\n```\n\n\n## Tested on\n\n- CPython 3.10 + pygame-ce 2.5\n- CPython 3.11 + pygame-ce 2.5\n- CPython 3.12 + pygame-ce 2.5\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Async/await-based framework for PyGame",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/asyncgui/asyncpygame",
"Repository": "https://github.com/asyncgui/asyncpygame"
},
"split_keywords": [
"async",
" pygame"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f2348879da4a9795cabd7a4bf1f758373dd00edc59269305a16993c20836be24",
"md5": "50df0904870f08c543837f4406e817c8",
"sha256": "485f8eefbab2dd382d188fd583b6dcfe0cfd109be4f3bb30c29af1bba3171dd0"
},
"downloads": -1,
"filename": "asyncpygame-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "50df0904870f08c543837f4406e817c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11013,
"upload_time": "2024-11-06T09:25:06",
"upload_time_iso_8601": "2024-11-06T09:25:06.440982Z",
"url": "https://files.pythonhosted.org/packages/f2/34/8879da4a9795cabd7a4bf1f758373dd00edc59269305a16993c20836be24/asyncpygame-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47a0cfbcb93e490e56c2b1e45f415b922082588144e2d64f519082bc56a01902",
"md5": "0b23f03aaf8a85df1478ac24fb62a685",
"sha256": "83a521b8d5b76cebbe6c8ee63f485870e850973494808f9cbb1f58fe4f6d547c"
},
"downloads": -1,
"filename": "asyncpygame-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "0b23f03aaf8a85df1478ac24fb62a685",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 9532,
"upload_time": "2024-11-06T09:25:07",
"upload_time_iso_8601": "2024-11-06T09:25:07.480354Z",
"url": "https://files.pythonhosted.org/packages/47/a0/cfbcb93e490e56c2b1e45f415b922082588144e2d64f519082bc56a01902/asyncpygame-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-06 09:25:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asyncgui",
"github_project": "asyncpygame",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "asyncpygame"
}