diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index d179f14d8234..5be3acbcc070 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -224,3 +224,8 @@ profiling.sampling.heatmap_collector.TreeNode profiling.sampling.module_utils profiling.sampling.opcode_utils profiling.sampling.sample + +# These conflicting aliases are just like tkinter.*.slaves in common.txt. +tkinter.Grid.content +tkinter.Pack.content +tkinter.Place.content diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index e1f3016b70b7..1d7c9998ec43 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -630,12 +630,13 @@ class Misc: def pack_slaves(self) -> list[Widget]: ... def grid_slaves(self, row: int | None = None, column: int | None = None) -> list[Widget]: ... def place_slaves(self) -> list[Widget]: ... + slaves = pack_slaves if sys.version_info >= (3, 15): def pack_content(self) -> list[Widget]: ... def grid_content(self, row: int | None = None, column: int | None = None) -> list[Widget]: ... def place_content(self) -> list[Widget]: ... content = pack_content - slaves = pack_slaves + def event_add(self, virtual: str, *sequences: str) -> None: ... def event_delete(self, virtual: str, *sequences: str) -> None: ... def event_generate( @@ -1113,7 +1114,6 @@ class Pack: def pack_info(self) -> _PackInfo: ... # errors if widget hasn't been packed if sys.version_info >= (3, 15): def pack_content(self) -> list[Widget]: ... - content = pack_content pack = pack_configure forget = pack_forget propagate = Misc.pack_propagate @@ -1154,7 +1154,6 @@ class Place: def place_info(self) -> _PlaceInfo: ... if sys.version_info >= (3, 15): def place_content(self) -> list[Widget]: ... - content = place_content place = place_configure info = place_info @@ -1194,7 +1193,6 @@ class Grid: def grid_info(self) -> _GridInfo: ... if sys.version_info >= (3, 15): def grid_content(self, row: int | None = None, column: int | None = None) -> list[Widget]: ... - content = grid_content grid = grid_configure location = Misc.grid_location size = Misc.grid_size @@ -1206,7 +1204,7 @@ class BaseWidget(Misc): def destroy(self) -> None: ... # This class represents any widget except Toplevel or Tk. -class Widget(BaseWidget, Pack, Place, Grid): # type: ignore[misc] # content aliases differ across geometry mixins. +class Widget(BaseWidget, Pack, Place, Grid): # Allow bind callbacks to take e.g. Event[Label] instead of Event[Misc]. # Tk and Toplevel get notified for their child widgets' events, but other # widgets don't. @@ -1378,7 +1376,7 @@ class Button(Widget): def flash(self) -> None: ... def invoke(self) -> Any: ... -class Canvas(Widget, XView, YView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Canvas(Widget, XView, YView): def __init__( self, master: Misc | None = None, @@ -2148,7 +2146,7 @@ class Checkbutton(Widget): def select(self) -> None: ... def toggle(self) -> None: ... -class Entry(Widget, XView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Entry(Widget, XView): def __init__( self, master: Misc | None = None, @@ -2391,7 +2389,7 @@ class Label(Widget): def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure -class Listbox(Widget, XView, YView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Listbox(Widget, XView, YView): def __init__( self, master: Misc | None = None, @@ -3193,7 +3191,7 @@ _WhatToCount: TypeAlias = Literal[ "chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels" ] -class Text(Widget, XView, YView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Text(Widget, XView, YView): def __init__( self, master: Misc | None = None, @@ -3981,7 +3979,7 @@ class BitmapImage(Image, _BitmapImageLike): def image_names() -> tuple[str, ...]: ... def image_types() -> tuple[str, ...]: ... -class Spinbox(Widget, XView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Spinbox(Widget, XView): def __init__( self, master: Misc | None = None, diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index c3285549b405..f546c2851860 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -316,7 +316,7 @@ class Checkbutton(Widget): config = configure def invoke(self) -> Any: ... -class Entry(Widget, tkinter.Entry): # type: ignore[misc] # content aliases differ across geometry mixins. +class Entry(Widget, tkinter.Entry): def __init__( self, master: tkinter.Misc | None = None, @@ -718,7 +718,7 @@ class Notebook(Widget): def tabs(self): ... def enable_traversal(self) -> None: ... -class Panedwindow(Widget, tkinter.PanedWindow): # type: ignore[misc] # content aliases differ across geometry mixins. +class Panedwindow(Widget, tkinter.PanedWindow): def __init__( self, master: tkinter.Misc | None = None, @@ -1106,7 +1106,7 @@ class _TreeviewColumnDict(TypedDict): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] id: str -class Treeview(Widget, tkinter.XView, tkinter.YView): # type: ignore[misc] # content aliases differ across geometry mixins. +class Treeview(Widget, tkinter.XView, tkinter.YView): def __init__( self, master: tkinter.Misc | None = None,