def on_save_properties(self, evt): if not self.confirm_properties(): return p = Properties() dirname, filename = os.path.split(p._filename) ext = os.path.splitext(p._filename)[-1] dlg = wx.FileDialog(self, message="Save properties as...", defaultDir=dirname, defaultFile=filename, wildcard=ext, style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT | wx.FD_CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: p.save_file(dlg.GetPath())