{"id":23467356,"url":"https://github.com/davidhozic/tkinter-async-execute","last_synced_at":"2025-04-14T12:23:58.784Z","repository":{"id":189343399,"uuid":"680489657","full_name":"davidhozic/Tkinter-Async-Execute","owner":"davidhozic","description":"A small library, which provides a non-blocking way to run an asyncio event loop alongside Tkinter in a seperate thread,  thread-safe functions for thread-safe interaction, and an execution progress widget.","archived":false,"fork":false,"pushed_at":"2025-03-16T17:17:00.000Z","size":63,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T01:45:51.292Z","etag":null,"topics":["async-execution-window","asyncio","asyncio-api-wrapper","events","pop-up","thread-safe","tkinter"],"latest_commit_sha":null,"homepage":"https://tkinter-async-execute.readthedocs.io/","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/davidhozic.png","metadata":{"files":{"readme":"README.rst","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":"2023-08-19T12:12:15.000Z","updated_at":"2025-03-16T17:16:06.000Z","dependencies_parsed_at":"2025-03-10T12:34:16.870Z","dependency_job_id":null,"html_url":"https://github.com/davidhozic/Tkinter-Async-Execute","commit_stats":null,"previous_names":["davidhozic/tkinter-async-execute"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhozic%2FTkinter-Async-Execute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhozic%2FTkinter-Async-Execute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhozic%2FTkinter-Async-Execute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhozic%2FTkinter-Async-Execute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidhozic","download_url":"https://codeload.github.com/davidhozic/Tkinter-Async-Execute/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248878925,"owners_count":21176402,"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-execution-window","asyncio","asyncio-api-wrapper","events","pop-up","thread-safe","tkinter"],"created_at":"2024-12-24T12:30:40.968Z","updated_at":"2025-04-14T12:23:58.722Z","avatar_url":"https://github.com/davidhozic.png","language":"Python","readme":"======================\nTkinter-Async-Execute\n======================\n\nTkinter-Async-Execute is a small library, that provides a way to run an ``asyncio`` event loop alongside Tkinter in\na separate thread.\n\nIt provides a way to execute methods of tkinter widgets from inside async functions and ability to call async functions\nfrom functions (commands / events) running in tkinter's thread. The former can be called from any thread (or async function)\nand the latter only from functions (commands / events) in tkinter's thread.\n\nTo show progress of an async function, submitted from tkinter, an async execution window widget is available,\nwhich will display any text printed with the ``print()`` function (or any stdout write requests).\n\n\nInstallation\n==============\n.. code-block:: bash\n\n    pip install tkinter-async-execute\n\nDocumentation\n=============\nAll documentation is available on https://tkinter-async-execute.readthedocs.io/.\n\n\nExample\n=============\n.. code-block:: python\n\n    from tkinter import ttk\n    import tkinter as tk\n    import asyncio\n\n    import tk_async_execute as tae\n\n\n    async def async_function():\n        # Call tkinter widget methods.\n        print(\"Disabling button\")\n        tae.tk_execute(bnt.config, state=\"disabled\")  # Thread safe exection\n        await asyncio.sleep(5)\n        print(\"Enabling button\")\n        tae.tk_execute(bnt.config, state=\"normal\")\n        await asyncio.sleep(2)\n\n        # Change tkinter text\n        print(\"Renaming button\")\n        tae.tk_execute(bnt.config, text=\"Example 2\")\n        await asyncio.sleep(2)\n\n\n    def button_clicked():\n        # Call async function\n        tae.async_execute(async_function(), wait=True, visible=True, pop_up=True, callback=None, master=root)\n\n        # Close application\n        root.quit()\n\n\n    if __name__ == \"__main__\":\n        root = tk.Tk()\n        bnt = ttk.Button(root, text=\"Click me\", command=button_clicked, width=20)\n        bnt.pack()\n\n        tae.start()  # Starts the asyncio event loop in a different thread.\n        root.mainloop()  # Main Tkinter loop\n        tae.stop()  # Stops the event loop and closes it.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidhozic%2Ftkinter-async-execute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidhozic%2Ftkinter-async-execute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidhozic%2Ftkinter-async-execute/lists"}