diff --git a/async_tkinter_loop/async_tkinter_loop.py b/async_tkinter_loop/async_tkinter_loop.py index 2338212..64d6a72 100644 --- a/async_tkinter_loop/async_tkinter_loop.py +++ b/async_tkinter_loop/async_tkinter_loop.py @@ -14,9 +14,7 @@ async def main_loop(root: tk.Tk) -> None: code. Args: - ---- root: tkinter root window object - """ while True: # Process all pending events @@ -35,10 +33,8 @@ def get_event_loop() -> asyncio.AbstractEventLoop: """ A helper function which returns an event loop using current event loop policy. - Returns - ------- + Returns: event loop - """ return asyncio.get_event_loop_policy().get_event_loop() @@ -48,9 +44,7 @@ def async_mainloop(root: tk.Tk) -> None: A function, which is a substitute to the standard `root.mainloop()`. Args: - ---- root: tkinter root object - """ get_event_loop().run_until_complete(main_loop(root)) @@ -58,19 +52,21 @@ def async_mainloop(root: tk.Tk) -> None: P = ParamSpec("P") -def async_handler(async_function: Callable[P, Coroutine[Any, Any, None]], *args, **kwargs) -> Callable[P, None]: +def async_handler( + async_function: Callable[P, Coroutine[Any, Any, None]], + *args: Any, # noqa: ANN401 + **kwargs: Any, # noqa: ANN401 +) -> Callable[P, None]: """ A helper function which allows to use async functions as command handlers (e.g. button click handlers) or event handlers. Args: - ---- async_function: async function args: positional parameters which will be passed to the async function kwargs: keyword parameters which will be passed to the async function Returns: - ------- A sync function, which runs the original async function in an async event loop. Usage examples: @@ -105,7 +101,6 @@ async def some_async_function(): button = tk.Button("Press me", command=some_async_function) ``` - """ @wraps(async_function) diff --git a/examples/custom_tkinter.py b/examples/custom_tkinter.py index 6dd2473..bed886c 100644 --- a/examples/custom_tkinter.py +++ b/examples/custom_tkinter.py @@ -1,5 +1,4 @@ -"""A simple example how to use async code with CustomTkinter -""" +"""A simple example how to use async code with CustomTkinter""" import asyncio