An event scheduler for asyncgui programs
Project description
Clock
import asyncgui
from asyncgui_ext.clock import Clock
clock = Clock()
async def async_fn():
await clock.sleep(20) # Waits for 20 time units
print("Hello")
asyncgui.start(async_fn())
clock.advance(10) # Advances the clock by 10 time units.
clock.advance(10) # Total of 20 time units. The async_fn will wake up, and prints 'Hello'.
The example above effectively illustrate how this module works but it's not practical.
In a real-world program, you probably want to call clock.advance() in a main loop.
For example, if you are using PyGame, you may want to do:
pygame_clock = pygame.time.Clock()
clock = asyncgui_ext.clock.Clock()
# main loop
while running:
...
dt = pygame_clock.tick(fps)
clock.advance(dt)
Installation
Pin the minor version.
poetry add asyncgui-ext-clock@~0.6
pip install "asyncgui-ext-clock>=0.6,<0.7"
Tested on
- CPython 3.10
- CPython 3.11
- CPython 3.12
- CPython 3.13
- PyPy 3.10
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncgui_ext_clock-0.6.1.tar.gz.
File metadata
- Download URL: asyncgui_ext_clock-0.6.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.4 Linux/5.4.0-216-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd754f594bef07fd588c01cbda045f7a137134a964ab3324fa2bf73d204c3f2f
|
|
| MD5 |
7085e87369c50c6f5cc2ddb3713dc7f3
|
|
| BLAKE2b-256 |
57a0ac6d835888b97b1ccbe77e8ef210cbc0afeb29fffda337c7ce864c86ebc0
|
File details
Details for the file asyncgui_ext_clock-0.6.1-py3-none-any.whl.
File metadata
- Download URL: asyncgui_ext_clock-0.6.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.4 Linux/5.4.0-216-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f63300e89ddb8a1c95b586c5a2ba577b27211ecc4af7cc563c60fb5dd9d044
|
|
| MD5 |
4d4e91ab671e72e3eda613d96e888c08
|
|
| BLAKE2b-256 |
df9e7e7eb2b5b779a9c9686e9b0b7648cf595c211c31ed5113038577babfa3f3
|