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) - - def __del__(self): - self.Cleanup() + # When the window is destroyed, clean up resources. + EVT_WINDOW_DESTROY(self, self.Cleanup) - def Cleanup(self): + def Cleanup(self, evt): if hasattr(self, "menu"): self.menu.Destroy() del self.menu diff --git a/wxPython/samples/doodle/superdoodle.py b/wxPython/samples/doodle/superdoodle.py index 92fdf37ae8..b589e72baa 100644 --- a/wxPython/samples/doodle/superdoodle.py +++ b/wxPython/samples/doodle/superdoodle.py @@ -56,13 +56,6 @@ class DoodleFrame(wxFrame): self.SetAutoLayout(true) self.SetSizer(box) - EVT_CLOSE(self, self.OnCloseWindow) - - - def OnCloseWindow(self, event): - self.doodle.Cleanup() - self.Destroy() - def SaveFile(self): if self.filename: