From e67b00b81d675eb4ee7ae0121470398f05d41915 Mon Sep 17 00:00:00 2001 From: Nicola <61830443+nicola02nb@users.noreply.github.com> Date: Sun, 16 Nov 2025 12:10:48 +0100 Subject: [PATCH 1/2] Add event_loop parameter to async_mainloop methods --- async_tkinter_loop/mixins.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/async_tkinter_loop/mixins.py b/async_tkinter_loop/mixins.py index 6a445b2..75dbbce 100644 --- a/async_tkinter_loop/mixins.py +++ b/async_tkinter_loop/mixins.py @@ -1,16 +1,17 @@ import sys import tkinter as tk +import asyncio from async_tkinter_loop import async_mainloop class AsyncTk: - def async_mainloop(self: tk.Tk) -> None: - async_mainloop(self) + def async_mainloop(self: tk.Tk, event_loop: asyncio.AbstractEventLoop | None = None) -> None: + async_mainloop(self, event_loop=event_loop) class AsyncCTk(AsyncTk): - def async_mainloop(self) -> None: + def async_mainloop(self, event_loop: asyncio.AbstractEventLoop | None = None) -> None: # Based on the code from CustomTkinter by Tom Schimansky # Source https://github.com/TomSchimansky/CustomTkinter/blob/d719950f80eb2768db96bd4cc627523e99603b1b/customtkinter/windows/ctk_tk.py#L155 if not self._window_exists: @@ -22,4 +23,4 @@ def async_mainloop(self) -> None: self._window_exists = True - super().async_mainloop() + super().async_mainloop(event_loop=event_loop) From c7e9ee3969899f587c2d3bd36cff7cabcaeb965f Mon Sep 17 00:00:00 2001 From: Nicola <61830443+nicola02nb@users.noreply.github.com> Date: Sun, 16 Nov 2025 15:23:35 +0100 Subject: [PATCH 2/2] Remove redundant asyncio import --- async_tkinter_loop/mixins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/async_tkinter_loop/mixins.py b/async_tkinter_loop/mixins.py index 75dbbce..e1b571d 100644 --- a/async_tkinter_loop/mixins.py +++ b/async_tkinter_loop/mixins.py @@ -1,6 +1,6 @@ +import asyncio import sys import tkinter as tk -import asyncio from async_tkinter_loop import async_mainloop