X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9de06a7953adafa337d4c2df5d752598a770a84f..224311348756853f888aca53e772072c0ce16b73:/wxPython/samples/doodle/doodle.py diff --git a/wxPython/samples/doodle/doodle.py b/wxPython/samples/doodle/doodle.py index 70bb55aae6..8fefcd0416 100644 --- a/wxPython/samples/doodle/doodle.py +++ b/wxPython/samples/doodle/doodle.py @@ -56,12 +56,11 @@ class DoodleWindow(wxWindow): # and the refresh event EVT_PAINT(self, self.OnPaint) + # When the window is destroyed, clean up resources. + EVT_WINDOW_DESTROY(self, self.Cleanup) - def __del__(self): - self.Cleanup() - - def Cleanup(self): + def Cleanup(self, evt): if hasattr(self, "menu"): self.menu.Destroy() del self.menu