Skip to content

Commit d525072

Browse files
authored
Use ParamSpec from typing_exensions (#69)
1 parent 71da107 commit d525072

File tree

3 files changed

+192
-189
lines changed

3 files changed

+192
-189
lines changed

async_tkinter_loop/async_tkinter_loop.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import _tkinter
12
import asyncio
23
import tkinter
34
from functools import wraps
4-
from tkinter import TclError
55
from typing import Any, Callable, Coroutine
66

7-
import _tkinter
7+
from tkinter import TclError
8+
from typing_extensions import ParamSpec
89

910

1011
async def main_loop(root: tkinter.Tk) -> None:
@@ -48,7 +49,10 @@ def async_mainloop(root: tkinter.Tk) -> None:
4849
get_event_loop().run_until_complete(main_loop(root))
4950

5051

51-
def async_handler(async_function: Callable[..., Coroutine[Any, Any, None]], *args, **kwargs) -> Callable[..., None]:
52+
P = ParamSpec("P")
53+
54+
55+
def async_handler(async_function: Callable[P, Coroutine[Any, Any, None]], *args, **kwargs) -> Callable[P, None]:
5256
"""
5357
A helper function which allows to use async functions as command handlers (e.g. button click handlers) or event
5458
handlers.

0 commit comments

Comments
 (0)