]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/doodle/doodle.py
Further improvements to MFC sample.
[wxWidgets.git] / wxPython / samples / doodle / doodle.py
index 70bb55aae6514a7523983355b2de9317ef6426f0..8fefcd041638c4cd2d236da4f8801727c0450941 100644 (file)
@@ -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