Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncgui_ext_clock-0.6.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncgui_ext_clock-0.6.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

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

Hashes for asyncgui_ext_clock-0.6.1.tar.gz
Algorithm Hash digest
SHA256 fd754f594bef07fd588c01cbda045f7a137134a964ab3324fa2bf73d204c3f2f
MD5 7085e87369c50c6f5cc2ddb3713dc7f3
BLAKE2b-256 57a0ac6d835888b97b1ccbe77e8ef210cbc0afeb29fffda337c7ce864c86ebc0

See more details on using hashes here.

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

Hashes for asyncgui_ext_clock-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50f63300e89ddb8a1c95b586c5a2ba577b27211ecc4af7cc563c60fb5dd9d044
MD5 4d4e91ab671e72e3eda613d96e888c08
BLAKE2b-256 df9e7e7eb2b5b779a9c9686e9b0b7648cf595c211c31ed5113038577babfa3f3

See more details on using hashes here.

Supported by

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