Skip to main content

PyGame meets async/await

Project description

AsyncPygame

Let's say you want to do:

  1. print('A')
  2. wait for 1000ms
  3. print('B')
  4. wait for a mouse button to be pressed
  5. 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')

Youtube
API Reference

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


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)

Uploaded Source

Built Distribution

asyncpygame-0.1.2-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page