Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-128562: Fix tkinter widget instance name sometimes duplicated on inherited class #128604

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Xiaokang2022
Copy link
Contributor

@Xiaokang2022 Xiaokang2022 commented Jan 8, 2025

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test.

Comment on lines +2744 to +2745
while cls.__module__ not in ("tkinter", "tkinter.ttk"):
cls = cls.__base__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it's a little hacky, and probably going to lead to some unexpected results. The more ideal solution would be to actually check if the autogenerated name exists and then adjust accordingly (e.g. label2 could become label2_2).

@ZeroIntensity ZeroIntensity added topic-tkinter needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants