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.

pip install "asyncgui-ext-clock>=0.6,<0.7"

Tested on

  • CPython 3.10
  • CPython 3.11
  • CPython 3.12
  • CPython 3.13
  • CPython 3.14
  • 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.2.tar.gz (5.5 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.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file asyncgui_ext_clock-0.6.2.tar.gz.

File metadata

  • Download URL: asyncgui_ext_clock-0.6.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asyncgui_ext_clock-0.6.2.tar.gz
Algorithm Hash digest
SHA256 b7b8a16b7a1d2c45afdc633e7bb01cf57a58193af91da5726b2a1d666a3b3500
MD5 2f9ba4cbddd396dc7010b0e9218faff5
BLAKE2b-256 bdf2a62d987cce8e685c8c09895dc27b157e86f9d4a6b48964739dc39a3fc54f

See more details on using hashes here.

Provenance

The following attestation bundles were made for asyncgui_ext_clock-0.6.2.tar.gz:

Publisher: release.yml on asyncgui/asyncgui-ext-clock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asyncgui_ext_clock-0.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for asyncgui_ext_clock-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ad5af0bfe591a513a778a9a47f0ece82f2470ed4e1066c04fed37754a970a5d
MD5 bd59a22ace4946764fab1320e29016e3
BLAKE2b-256 436753b8cbd3687e711c1cf27ab258ca7659c3c47d7e9a4278945694fcd41816

See more details on using hashes here.

Provenance

The following attestation bundles were made for asyncgui_ext_clock-0.6.2-py3-none-any.whl:

Publisher: release.yml on asyncgui/asyncgui-ext-clock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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