X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3bfec747ddf7b27e6f41f0117cd5cd6755fe021..0c8392cac2d36d0d211432e71d3b24d3d93c22db:/wxPython/demo/wxFileHistory.py diff --git a/wxPython/demo/wxFileHistory.py b/wxPython/demo/wxFileHistory.py index 9e0725705a..0da510cf4d 100644 --- a/wxPython/demo/wxFileHistory.py +++ b/wxPython/demo/wxFileHistory.py @@ -37,7 +37,7 @@ class TestPanel(wxPanel): box.Add(t, 0, wxCENTER|wxALL, 5) self.SetSizer(box) - self.SetAutoLayout(true) + self.SetAutoLayout(True) # Make a menu self.menu = m = wxMenu() @@ -46,10 +46,10 @@ class TestPanel(wxPanel): m.Append(wxID_CLOSE, "&Close") m.Append(wxID_SAVE, "&Save") m.Append(wxID_SAVEAS, "Save &as...") - m.Enable(wxID_NEW, false) - m.Enable(wxID_CLOSE, false) - m.Enable(wxID_SAVE, false) - m.Enable(wxID_SAVEAS, false) + m.Enable(wxID_NEW, False) + m.Enable(wxID_CLOSE, False) + m.Enable(wxID_SAVE, False) + m.Enable(wxID_SAVEAS, False) # and a file history self.filehistory = wxFileHistory() @@ -59,10 +59,10 @@ class TestPanel(wxPanel): EVT_RIGHT_UP(self, self.OnRightClick) EVT_MENU(self, wxID_OPEN, self.OnFileOpenDialog) EVT_MENU_RANGE(self, wxID_FILE1, wxID_FILE9, self.OnFileHistory) + EVT_WINDOW_DESTROY(self, self.Cleanup) - - def __del__(self): + def Cleanup(self, *args): del self.filehistory self.menu.Destroy() @@ -74,6 +74,7 @@ class TestPanel(wxPanel): def OnFileOpenDialog(self, evt): dlg = wxFileDialog(self, defaultDir = os.getcwd(), + wildcard = "All Files|*", style = wxOPEN | wxCHANGE_DIR) if dlg.ShowModal() == wxID_OK: path = dlg.GetPath() @@ -115,3 +116,9 @@ list appended to a menu, such as the File menu. """ + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) +