# 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/4d/51/29572a6e53966ca7f24af676ac250287c18ea34d61430f7b429e5fa26714/asyncpygame-0.1.2.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": "PyGame meets async/await",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/asyncgui/asyncpygame",
"Repository": "https://github.com/asyncgui/asyncpygame"
},
"split_keywords": [
"async",
" pygame"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "78188c0c00af141a9a5edd2c615ed91d6833c6f17089c2dc7a327ba1d1f185c3",
"md5": "9a805534a60161e1361bf6ecdc5b044b",
"sha256": "c1eca6f92b1d50599a46f965bc29d96fc3ad2bd761efa7c098c290a11748a0ac"
},
"downloads": -1,
"filename": "asyncpygame-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9a805534a60161e1361bf6ecdc5b044b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 10246,
"upload_time": "2024-10-03T01:53:22",
"upload_time_iso_8601": "2024-10-03T01:53:22.913719Z",
"url": "https://files.pythonhosted.org/packages/78/18/8c0c00af141a9a5edd2c615ed91d6833c6f17089c2dc7a327ba1d1f185c3/asyncpygame-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4d5129572a6e53966ca7f24af676ac250287c18ea34d61430f7b429e5fa26714",
"md5": "6dd7a7557e60a91e5049174e3b52357d",
"sha256": "70e02b2c369d9d8c0e5bc5bf26eaff2caec4d69d66e0fcfdffd897dc28d9b5a6"
},
"downloads": -1,
"filename": "asyncpygame-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "6dd7a7557e60a91e5049174e3b52357d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 8739,
"upload_time": "2024-10-03T01:53:24",
"upload_time_iso_8601": "2024-10-03T01:53:24.162130Z",
"url": "https://files.pythonhosted.org/packages/4d/51/29572a6e53966ca7f24af676ac250287c18ea34d61430f7b429e5fa26714/asyncpygame-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-03 01:53:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asyncgui",
"github_project": "asyncpygame",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "asyncpygame"
}