Skip to content

tkinter Pack,Grid,Place: delete commented-out aliases, explain in allowlist#6518

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
Akuli:grid_foo
Dec 6, 2021
Merged

tkinter Pack,Grid,Place: delete commented-out aliases, explain in allowlist#6518
JelleZijlstra merged 1 commit into
python:masterfrom
Akuli:grid_foo

Conversation

@Akuli
Copy link
Copy Markdown
Collaborator

@Akuli Akuli commented Dec 6, 2021

Tkinter is complicated. It does this at runtime:

class Misc:
    ...
    def grid_rowconfigure(self, ...): ...
    rowconfigure = grid_rowconfigure
    def grid_size(self): ...
    size = grid_size
    ...

class Grid:
    ...
    rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure
    size = grid_size = Misc.grid_size
    ...

class BaseWidget(Misc):
    ...

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

The intent with rowconfigure = Misc.grid_rowconfigure is that you can do tkinter.Grid.rowconfigure(widget, blah) instead of widget.grid_rowconfigure(blah), but nobody seems to be doing that in practice.

It is even worse with some methods: each of Pack, Grid, Place and Misc has a method named configure, and they all do different things!

If someone wants to use the weird aliases of the methods, I can try to add them to the stubs, but for now I just want them all allowlisted.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 6, 2021

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit af85e18 into python:master Dec 6, 2021
@Akuli Akuli deleted the grid_foo branch December 6, 2021 17:19
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.

3 participants