{"id":19577190,"url":"https://github.com/asyncgui/asyncgui-ext-clock","last_synced_at":"2025-04-27T06:32:13.583Z","repository":{"id":218047231,"uuid":"745380291","full_name":"asyncgui/asyncgui-ext-clock","owner":"asyncgui","description":"Event Scheduler","archived":false,"fork":false,"pushed_at":"2024-10-09T15:21:22.000Z","size":584,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-10T12:52:06.524Z","etag":null,"topics":["async"],"latest_commit_sha":null,"homepage":"https://asyncgui.github.io/asyncgui-ext-clock/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asyncgui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-19T07:59:28.000Z","updated_at":"2024-10-09T15:21:24.000Z","dependencies_parsed_at":"2024-01-19T12:41:02.263Z","dependency_job_id":"51410eaf-ed79-4b7d-88da-972bbc5b0035","html_url":"https://github.com/asyncgui/asyncgui-ext-clock","commit_stats":null,"previous_names":["asyncgui/asyncgui-ext-clock"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyncgui%2Fasyncgui-ext-clock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyncgui%2Fasyncgui-ext-clock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyncgui%2Fasyncgui-ext-clock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyncgui%2Fasyncgui-ext-clock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asyncgui","download_url":"https://codeload.github.com/asyncgui/asyncgui-ext-clock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224062795,"owners_count":17249291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async"],"created_at":"2024-11-11T07:05:09.306Z","updated_at":"2025-04-27T06:32:13.577Z","avatar_url":"https://github.com/asyncgui.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clock\n\n*Event scheduler designed for asyncgui programs.*\n\n```python\nimport asyncgui\nfrom asyncgui_ext.clock import Clock\n\nclock = Clock()\n\nasync def async_fn():\n    await clock.sleep(20)  # Waits for 20 time units\n    print(\"Hello\")\n\nasyncgui.start(async_fn())\nclock.tick(10)  # Advances the clock by 10 time units.\nclock.tick(10)  # Total of 20 time units. The task above will wake up, and prints 'Hello'.\n```\n\nThe example above effectively illustrate how this module works but it's not practical.\nIn a real-world program, you probably want to call ``clock.tick()`` in a loop or schedule it to be called repeatedly using another scheduling API.\nFor example, if you are using `PyGame`, you may want to do:\n\n```python\npygame_clock = pygame.time.Clock()\nclock = asyncgui_ext.clock.Clock()\n\n# main loop\nwhile running:\n    ...\n\n    dt = pygame_clock.tick(fps)\n    clock.tick(dt)\n```\n\nAnd if you are using `Kivy`, you may want to do:\n\n```python\nfrom kivy.clock import Clock\n\nclock = asyncui_ext.clock.Clock()\nClock.schedule_interval(clock.tick, 0)\n```\n\n## Installation\n\nPin the minor version.\n\n```\npoetry add asyncgui-ext-clock@~0.5\npip install \"asyncgui-ext-clock\u003e=0.5,\u003c0.6\"\n```\n\n## Tested on\n\n- CPython 3.10\n- CPython 3.11\n- CPython 3.12\n- CPython 3.13\n- PyPy 3.10\n\n## Misc\n\n- [YouTube Demo](https://youtu.be/kPVzO8fF0yg) (with Kivy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasyncgui%2Fasyncgui-ext-clock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasyncgui%2Fasyncgui-ext-clock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasyncgui%2Fasyncgui-ext-clock/lists"}