From 6d9022fe3bb50a75b9b5eaf5cf32558e518ba310 Mon Sep 17 00:00:00 2001 From: Robin Dunn <robin@alldunn.com> Date: Thu, 18 Apr 2002 05:35:20 +0000 Subject: [PATCH] Moved the cleanup code to an EVT_WINDOW_DESTROY handler. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/samples/doodle/doodle.py | 7 +++---- wxPython/samples/doodle/superdoodle.py | 7 ------- 2 files changed, 3 insertions(+), 11 deletions(-) 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 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: -- 2.45.2