Files
Phoenix/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.2.py
2016-05-18 16:38:18 -07:00

18 lines
754 B
Python

def OnSaveAs(self, event):
saveFileDialog = wx.FileDialog(self, "Save XYZ file", "", "",
"XYZ files (*.xyz)|*.xyz", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if saveFileDialog.ShowModal() == wx.ID_CANCEL:
return # the user changed idea...
# save the current contents in the file
# this can be done with e.g. wxPython output streams:
output_stream = wx.FileOutputStream(saveFileDialog.GetPath())
if not output_stream.IsOk():
wx.LogError("Cannot save current contents in file '%s'."%saveFileDialog.GetPath())
return