tkinter: use bool instead of Literal[0, 1] (#4901)

This commit is contained in:
Akuli
2021-01-05 14:21:35 +02:00
committed by GitHub
parent 930de94c30
commit 2691d74796
2 changed files with 7 additions and 7 deletions

View File

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

View File

@@ -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: ...