Skip to content

tkinter: Delete pack_content from Pack and similarly place_content and grid_content#15767

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
Akuli:tkinter-fix2
May 11, 2026
Merged

tkinter: Delete pack_content from Pack and similarly place_content and grid_content#15767
JelleZijlstra merged 2 commits into
python:mainfrom
Akuli:tkinter-fix2

Conversation

@Akuli
Copy link
Copy Markdown
Collaborator

@Akuli Akuli commented May 11, 2026

At runtime, tkinter does this:

class Misc:
    ...

class Pack:
    ...
    content = pack_content = Misc.pack_content
    slaves = pack_slaves = Misc.pack_slaves

class Place:
    ...
    content = place_content = Misc.place_content
    slaves = place_slaves = Misc.place_slaves

class Grid:
    ...
    content = grid_content = Misc.grid_content
    slaves = place_slaves = Misc.place_slaves

class BaseWidget(Misc):
    ...

class Widget(BaseWidget, Pack, Place, Grid):
    ...

This is very similar to #15763, which already deleted the conflicting content aliases. This PR deletes pack_content, place_content and grid_content from Pack, Place and Grid classes. Anything named foo_content in Python 3.15+ tkinter should be just like foo_slaves, and I have already omitted pack_slaves, grid_slaves and place_slaves from Pack, Grid and Place earlier.

This PR does not delete pack_content, place_content and grid_content entirely. We still have them in class Misc (where the are actually defined), and because all widgets inherit from Misc anyway, these are always available as methods.

While these aliases don't conflict like the content aliases, they aren't useful either. Nobody seems to be doing tkinter.Grid.grid_content(some_widget) when you could just as well do some_widget.grid_content().

@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/computation/ops.py:328: error: Need type annotation for "_binary_ops_dict" (hint: "_binary_ops_dict: dict[<type>, <type>] = ...")  [var-annotated]

@JelleZijlstra JelleZijlstra merged commit f4bef2f into python:main May 11, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants