You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
assignee='https://github.com/serhiy-storchaka'closed_at=<Date2020-12-25.19:48:59.890>created_at=<Date2012-07-09.08:25:49.856>labels= ['type-feature', 'expert-tkinter', '3.10']
title='Minor revision to the <BaseWidget._setup> method in Tkinter'updated_at=<Date2020-12-25.19:48:59.889>user='https://bugs.python.org/DrewFrench'
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.
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: