-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Minor revision to the <BaseWidget._setup> method in Tkinter #59508
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
Comments
In the <BaseWidget._setup> method, <master> is evaluated as a Boolean (when Tkinter attempts to find a parent for the widget). I think it should really be evaluated against <None>, seeing as that is the default <master> keyword argument value for most widgets. I ran into problems with this when making a container widget class that inherited from the <Canvas>, then implementing the <len> magic method. When the length was zero the widget would evaluate as false, which would prevented me from packing widgets inside my container widget. I attached a revised version of the method. |
Can you provide a patch in diff format? |
Please include a short version of the widget class you mentioned. It must be only long enough to show the issue. |
Here is a patch against 3.4 which contains proposed OP change and a lot of similar changes in different places. I'm not sure that this should be considered as a bug fix and not as an enhancement. Drew, as a workaround you can implement __bool__() method which returns True for your widget. Or even better, do not make your container sequence-like. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: