Delete some unnecessary type aliases in tkinter (#9970)

This commit is contained in:
Akuli
2023-03-28 20:37:29 +03:00
committed by GitHub
parent ccc4b7a034
commit 87c1b949cd
4 changed files with 567 additions and 577 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
import sys
from tkinter import Misc, _Color
from tkinter import Misc
from tkinter.commondialog import Dialog
from typing import ClassVar
@@ -11,10 +11,10 @@ class Chooser(Dialog):
if sys.version_info >= (3, 9):
def askcolor(
color: str | bytes | None = None, *, initialcolor: _Color = ..., parent: Misc = ..., title: str = ...
color: str | bytes | None = None, *, initialcolor: str = ..., parent: Misc = ..., title: str = ...
) -> tuple[None, None] | tuple[tuple[int, int, int], str]: ...
else:
def askcolor(
color: str | bytes | None = None, *, initialcolor: _Color = ..., parent: Misc = ..., title: str = ...
color: str | bytes | None = None, *, initialcolor: str = ..., parent: Misc = ..., title: str = ...
) -> tuple[None, None] | tuple[tuple[float, float, float], str]: ...

View File

@@ -177,12 +177,12 @@ class Entry(Widget, tkinter.Entry):
master: tkinter.Misc | None = None,
widget: str | None = None,
*,
background: tkinter._Color = ..., # undocumented
background: str = ..., # undocumented
class_: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
@@ -201,11 +201,11 @@ class Entry(Widget, tkinter.Entry):
self,
cnf: dict[str, Any] | None = None,
*,
background: tkinter._Color = ...,
background: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
show: str = ...,
@@ -226,11 +226,11 @@ class Entry(Widget, tkinter.Entry):
self,
cnf: dict[str, Any] | None = None,
*,
background: tkinter._Color = ...,
background: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
show: str = ...,
@@ -254,12 +254,12 @@ class Combobox(Entry):
self,
master: tkinter.Misc | None = None,
*,
background: tkinter._Color = ..., # undocumented
background: str = ..., # undocumented
class_: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ..., # undocumented
foreground: tkinter._Color = ..., # undocumented
foreground: str = ..., # undocumented
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
justify: Literal["left", "center", "right"] = ...,
@@ -281,11 +281,11 @@ class Combobox(Entry):
self,
cnf: dict[str, Any] | None = None,
*,
background: tkinter._Color = ...,
background: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
@@ -309,11 +309,11 @@ class Combobox(Entry):
self,
cnf: dict[str, Any] | None = None,
*,
background: tkinter._Color = ...,
background: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
@@ -376,14 +376,14 @@ class Label(Widget):
master: tkinter.Misc | None = None,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
background: str = ...,
border: tkinter._ScreenUnits = ..., # alias for borderwidth
borderwidth: tkinter._ScreenUnits = ..., # undocumented
class_: str = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
image: tkinter._ImageSpec = ...,
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
@@ -404,13 +404,13 @@ class Label(Widget):
cnf: dict[str, Any] | None = None,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
background: str = ...,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
image: tkinter._ImageSpec = ...,
justify: Literal["left", "center", "right"] = ...,
padding: _Padding = ...,
@@ -865,13 +865,13 @@ class Spinbox(Entry):
self,
master: tkinter.Misc | None = None,
*,
background: tkinter._Color = ..., # undocumented
background: str = ..., # undocumented
class_: str = ...,
command: Callable[[], object] | str | list[str] | tuple[str, ...] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ..., # undocumented
font: _FontDescription = ..., # undocumented
foreground: tkinter._Color = ..., # undocumented
foreground: str = ..., # undocumented
format: str = ...,
from_: float = ...,
increment: float = ...,
@@ -896,12 +896,12 @@ class Spinbox(Entry):
self,
cnf: dict[str, Any] | None = None,
*,
background: tkinter._Color = ...,
background: str = ...,
command: Callable[[], object] | str | list[str] | tuple[str, ...] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
foreground: str = ...,
format: str = ...,
from_: float = ...,
increment: float = ...,
@@ -934,8 +934,8 @@ class _TreeviewItemDict(TypedDict):
class _TreeviewTagDict(TypedDict):
# There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug
foreground: tkinter._Color
background: tkinter._Color
foreground: str
background: str
font: _FontDescription
image: str # not wrapped in list :D
@@ -1130,7 +1130,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
@overload
def tag_bind(self, tagname: str, *, callback: str) -> None: ...
@overload
def tag_configure(self, tagname: str, option: Literal["foreground", "background"]) -> tkinter._Color: ...
def tag_configure(self, tagname: str, option: Literal["foreground", "background"]) -> str: ...
@overload
def tag_configure(self, tagname: str, option: Literal["font"]) -> _FontDescription: ...
@overload
@@ -1142,8 +1142,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
option: None = None,
*,
# There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug
foreground: tkinter._Color = ...,
background: tkinter._Color = ...,
foreground: str = ...,
background: str = ...,
font: _FontDescription = ...,
image: tkinter._ImageSpec = ...,
) -> _TreeviewTagDict | Any: ... # can be None but annoying to check