Add an _Image protocol to tkinter. (#4766)

This commit is contained in:
Rebecca Chen
2020-11-13 11:59:29 -08:00
committed by GitHub
parent a42f545215
commit 8c20938ba1

View File

@@ -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],
@@ -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