mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 13:30:08 +01:00
18 lines
681 B
Python
18 lines
681 B
Python
|
|
def OnSaveAs(self, event):
|
|
|
|
with wx.FileDialog(self, "Save XYZ file", wildcard="XYZ files (*.xyz)|*.xyz",
|
|
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:
|
|
|
|
if fileDialog.ShowModal() == wx.ID_CANCEL:
|
|
return # the user changed their mind
|
|
|
|
# save the current contents in the file
|
|
pathname = fileDialog.GetPath()
|
|
try:
|
|
with open(pathname, 'w') as file:
|
|
self.doSaveData(file)
|
|
except IOError:
|
|
wx.LogError("Cannot save current data in file '%s'." % pathname)
|
|
|