Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def destroy(self):
if isinstance(self._font, CTkFont):
self._font.remove_size_configure_callback(self._update_font)

# Remove the scaling callback before destroying the underlying Tk menu.
CTkScalingBaseClass.destroy(self)

# call destroy methods of super classes
tkinter.Menu.destroy(self)
CTkAppearanceModeBaseClass.destroy(self)
Expand Down
8 changes: 8 additions & 0 deletions customtkinter/windows/widgets/ctk_optionmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ def _update_font(self):
self._canvas.grid(row=0, column=0, sticky="nsew")

def destroy(self):
# The dropdown menu is a separate Tk widget and must be destroyed explicitly.
if self._dropdown_menu is not None:
try:
self._dropdown_menu.destroy()
except tkinter.TclError:
pass
self._dropdown_menu = None

if self._variable is not None: # remove old callback
self._variable.trace_remove("write", self._variable_callback_name)

Expand Down