Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Commit

Permalink
Add an _Image protocol to tkinter. (python#4766)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen152 authored Nov 13, 2020
1 parent a42f545 commit 8c20938
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion stdlib/3/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ _Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[st
_EntryValidateCommand = Union[
Callable[[], bool], str, _TkinterSequence[str]
] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P']
_ImageSpec = Union[Image, str] # str can be from e.g. tkinter.image_names()
_ImageSpec = Union[_Image, str] # str can be from e.g. tkinter.image_names()
_Padding = Union[
_ScreenUnits,
Tuple[_ScreenUnits],
Expand Down Expand Up @@ -2831,6 +2831,12 @@ class OptionMenu(Menubutton):
# configure, config, cget are inherited from Menubutton
# destroy and __getitem__ are overrided, signature does not change

class _Image(Protocol):
tk: _tkinter.TkappType
def __del__(self) -> None: ...
def height(self) -> int: ...
def width(self) -> int: ...

class Image:
name: Any
tk: _tkinter.TkappType
Expand Down

0 comments on commit 8c20938

Please sign in to comment.