X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c12bc4de5887421242de7f619b3c5e265bf631ac..3f4f90c2a0c1f274d1918b320132ed0ca2922fe5:/wxPython/samples/doodle/superdoodle.py diff --git a/wxPython/samples/doodle/superdoodle.py b/wxPython/samples/doodle/superdoodle.py index 7bc579d785..92fdf37ae8 100644 --- a/wxPython/samples/doodle/superdoodle.py +++ b/wxPython/samples/doodle/superdoodle.py @@ -35,7 +35,8 @@ class DoodleFrame(wxFrame): """ title = "Do a doodle" def __init__(self, parent): - wxFrame.__init__(self, parent, -1, self.title, size=(800,600)) + wxFrame.__init__(self, parent, -1, self.title, size=(800,600), + style=wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) self.CreateStatusBar() self.MakeMenu() self.filename = None @@ -55,6 +56,13 @@ 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: @@ -109,7 +117,7 @@ class DoodleFrame(wxFrame): wildcard = "Doodle files (*.ddl)|*.ddl|All files (*.*)|*.*" def OnMenuOpen(self, event): - dlg = wxFileDialog(self, "Open doodle file...", + dlg = wxFileDialog(self, "Open doodle file...", os.getcwd(), style=wxOPEN, wildcard = self.wildcard) if dlg.ShowModal() == wxID_OK: self.filename = dlg.GetPath() @@ -126,7 +134,7 @@ class DoodleFrame(wxFrame): def OnMenuSaveAs(self, event): - dlg = wxFileDialog(self, "Save doodle as...", + dlg = wxFileDialog(self, "Save doodle as...", os.getcwd(), style=wxSAVE | wxOVERWRITE_PROMPT, wildcard = self.wildcard) if dlg.ShowModal() == wxID_OK: