Skip to content

Commit 8c20938

Browse files
authored
Add an _Image protocol to tkinter. (#4766)
1 parent a42f545 commit 8c20938

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

stdlib/3/tkinter/__init__.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ _Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[st
9595
_EntryValidateCommand = Union[
9696
Callable[[], bool], str, _TkinterSequence[str]
9797
] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P']
98-
_ImageSpec = Union[Image, str] # str can be from e.g. tkinter.image_names()
98+
_ImageSpec = Union[_Image, str] # str can be from e.g. tkinter.image_names()
9999
_Padding = Union[
100100
_ScreenUnits,
101101
Tuple[_ScreenUnits],
@@ -2831,6 +2831,12 @@ class OptionMenu(Menubutton):
28312831
# configure, config, cget are inherited from Menubutton
28322832
# destroy and __getitem__ are overrided, signature does not change
28332833

2834+
class _Image(Protocol):
2835+
tk: _tkinter.TkappType
2836+
def __del__(self) -> None: ...
2837+
def height(self) -> int: ...
2838+
def width(self) -> int: ...
2839+
28342840
class Image:
28352841
name: Any
28362842
tk: _tkinter.TkappType

0 commit comments

Comments
 (0)