From 2691d74796133f9d84170bfc4036b44dfc29cad6 Mon Sep 17 00:00:00 2001 From: Akuli Date: Tue, 5 Jan 2021 14:21:35 +0200 Subject: [PATCH] tkinter: use bool instead of Literal[0, 1] (#4901) --- stdlib/3/tkinter/__init__.pyi | 2 +- stdlib/3/tkinter/font.pyi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index 173c73dc8..5ac1180b7 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -627,7 +627,7 @@ _InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False) class _PackInfo(_InMiscTotal): # 'before' and 'after' never appear in _PackInfo anchor: _Anchor - expand: Literal[0, 1] + expand: bool fill: Literal["none", "x", "y", "both"] side: Literal["left", "right", "top", "bottom"] # Paddings come out as int or tuple of int, even though any _ScreenUnits diff --git a/stdlib/3/tkinter/font.pyi b/stdlib/3/tkinter/font.pyi index 67f3ca3b5..791a8a847 100644 --- a/stdlib/3/tkinter/font.pyi +++ b/stdlib/3/tkinter/font.pyi @@ -18,14 +18,14 @@ class _FontDict(TypedDict): size: int weight: Literal["normal", "bold"] slant: Literal["roman", "italic"] - underline: Literal[0, 1] - overstrike: Literal[0, 1] + underline: bool + overstrike: bool class _MetricsDict(TypedDict): ascent: int descent: int linespace: int - fixed: Literal[0, 1] + fixed: bool class Font: name: str @@ -56,7 +56,7 @@ class Font: @overload def cget(self, option: Literal["slant"]) -> Literal["roman", "italic"]: ... @overload - def cget(self, option: Literal["underline", "overstrike"]) -> Literal[0, 1]: ... + def cget(self, option: Literal["underline", "overstrike"]) -> bool: ... @overload def cget(self, option: str) -> Any: ... __getitem__ = cget @@ -69,7 +69,7 @@ class Font: @overload def actual(self, option: Literal["slant"], displayof: Optional[tkinter.Misc] = ...) -> Literal["roman", "italic"]: ... @overload - def actual(self, option: Literal["underline", "overstrike"], displayof: Optional[tkinter.Misc] = ...) -> Literal[0, 1]: ... + def actual(self, option: Literal["underline", "overstrike"], displayof: Optional[tkinter.Misc] = ...) -> bool: ... @overload def actual(self, option: None, displayof: Optional[tkinter.Misc] = ...) -> _FontDict: ... @overload @@ -89,7 +89,7 @@ class Font: @overload def metrics(self, __option: Literal["ascent", "descent", "linespace"], *, displayof: Optional[tkinter.Misc] = ...) -> int: ... @overload - def metrics(self, __option: Literal["fixed"], *, displayof: Optional[tkinter.Misc] = ...) -> Literal[0, 1]: ... + def metrics(self, __option: Literal["fixed"], *, displayof: Optional[tkinter.Misc] = ...) -> bool: ... @overload def metrics(self, *, displayof: Optional[tkinter.Misc] = ...) -> _MetricsDict: ... def measure(self, text: str, displayof: Optional[tkinter.Misc] = ...) -> int: ...