Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ParamSpec from typing_exensions #69

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions async_tkinter_loop/async_tkinter_loop.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import _tkinter
import asyncio
import tkinter
from functools import wraps
from tkinter import TclError
from typing import Any, Callable, Coroutine

import _tkinter
from tkinter import TclError
from typing_extensions import ParamSpec


async def main_loop(root: tkinter.Tk) -> None:
Expand Down Expand Up @@ -48,7 +49,10 @@ def async_mainloop(root: tkinter.Tk) -> None:
get_event_loop().run_until_complete(main_loop(root))


def async_handler(async_function: Callable[..., Coroutine[Any, Any, None]], *args, **kwargs) -> Callable[..., None]:
P = ParamSpec("P")


def async_handler(async_function: Callable[P, Coroutine[Any, Any, None]], *args, **kwargs) -> Callable[P, None]:
"""
A helper function which allows to use async functions as command handlers (e.g. button click handlers) or event
handlers.
Expand Down
Loading