diff --git a/async_tkinter_loop/mixins.py b/async_tkinter_loop/mixins.py index 6a445b2..e1b571d 100644 --- a/async_tkinter_loop/mixins.py +++ b/async_tkinter_loop/mixins.py @@ -1,3 +1,4 @@ +import asyncio import sys import tkinter as tk @@ -5,12 +6,12 @@ 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)