Commit 56e162ad authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

ttk: fix LabeledScale and OptionMenu destroy() method (#3026)

bpo-31135: Call the parent destroy() method even if the used
attribute doesn't exist.

The LabeledScale.destroy() method now also explicitly clears label
and scale attributes to help the garbage collector to destroy all
widgets.
parent 245dafca
......@@ -1522,6 +1522,8 @@ class LabeledScale(Frame, object):
else:
del self._variable
Frame.destroy(self)
self.label = None
self.scale = None
def _adjust(self, *args):
......@@ -1620,5 +1622,8 @@ class OptionMenu(Menubutton):
def destroy(self):
"""Destroy this widget and its associated variable."""
try:
del self._variable
except AttributeError:
pass
Menubutton.destroy(self)
ttk: Fix LabeledScale and OptionMenu destroy() method. Call the parent
destroy() method even if the used attribute doesn't exist. The
LabeledScale.destroy() method now also explicitly clears label and scale
attributes to help the garbage collector to destroy all widgets.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment