From 12a72ab0405da1223279fb6baecc3f4937b84784 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sat, 30 May 2026 02:06:04 +0300 Subject: [PATCH 1/2] Add types for tkinter.Canvas.canvasx and tkinter.Canvas.canvasy --- stdlib/tkinter/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 9f1c346cdc19..b0accbae05ef 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1534,8 +1534,8 @@ class Canvas(Widget, XView, YView): def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = None) -> None: ... - def canvasx(self, screenx, gridspacing=None): ... - def canvasy(self, screeny, gridspacing=None): ... + def canvasx(self, screenx: float, gridspacing: float | None = None) -> float: ... + def canvasy(self, screeny: float, gridspacing: float | None = None) -> float: ... @overload def coords(self, tagOrId: str | int, /) -> list[float]: ... From dbe24a13cf9dec8460d8fc5f4cfbbfa0d51041e7 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sat, 30 May 2026 02:23:11 +0300 Subject: [PATCH 2/2] float | str, just like in other methods --- stdlib/tkinter/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index b0accbae05ef..43a67f7fa5a9 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1534,8 +1534,8 @@ class Canvas(Widget, XView, YView): def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = None) -> None: ... - def canvasx(self, screenx: float, gridspacing: float | None = None) -> float: ... - def canvasy(self, screeny: float, gridspacing: float | None = None) -> float: ... + def canvasx(self, screenx: float | str, gridspacing: float | str | None = None) -> float: ... + def canvasy(self, screeny: float | str, gridspacing: float | str | None = None) -> float: ... @overload def coords(self, tagOrId: str | int, /) -> list[float]: ...