Skip to content

Commit 976d688

Browse files
gh-151910: Note Treeview.size shadows the inherited grid_size alias
Treeview.size overrides the inherited size = grid_size alias, like Treeview.bbox overrides grid_bbox. Mark it with an "overrides Misc.size" comment and list ttk.Treeview alongside Listbox in the documentation of the size/grid_size alias. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4b3e6f4 commit 976d688

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/library/tkinter.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,8 +1391,9 @@ Base and mixin classes
13911391
``(columns, rows)`` tuple.
13921392

13931393
:meth:`size` is an alias of :meth:`!grid_size`,
1394-
except on the :class:`Listbox` widget,
1395-
which provides its own :meth:`!size` method.
1394+
except on :class:`Listbox` and
1395+
:class:`ttk.Treeview <tkinter.ttk.Treeview>`,
1396+
which provide their own :meth:`!size` method.
13961397

13971398
.. method:: grid_slaves(row=None, column=None)
13981399

@@ -3291,8 +3292,9 @@ Base and mixin classes
32913292
Same as :meth:`Misc.grid_size`: return a ``(columns, rows)`` tuple giving
32923293
the size of the grid.
32933294
:meth:`size` is an alias of :meth:`!grid_size`,
3294-
except on the :class:`Listbox` widget,
3295-
which provides its own :meth:`!size` method.
3295+
except on :class:`Listbox` and
3296+
:class:`ttk.Treeview <tkinter.ttk.Treeview>`,
3297+
which provide their own :meth:`!size` method.
32963298

32973299
.. method:: propagate()
32983300
propagate(flag)

Lib/tkinter/ttk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ def visible(self, item):
14571457
return self.tk.getboolean(self.tk.call(self._w, "visible", item))
14581458

14591459

1460-
def size(self, item, *, hidden=False, recurse=False):
1460+
def size(self, item, *, hidden=False, recurse=False): # overrides Misc.size
14611461
"""Return the number of children of item.
14621462
14631463
If hidden is true, hidden items are included. If recurse is true,

0 commit comments

Comments
 (0)