def OnSaveAs(self, event):
"""Save contents of output window."""
filename = None
dlg = wx.FileDialog(None, "Save Text As...", ".", "", "Text File|*.txt|All Files|*", wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetPath()
dlg.Destroy()
if filename is not None:
f = file(filename, 'w')
text = self.text_ctrl_output.GetValue()
if type(text) == unicode:
text = text.encode("latin1") #hm, is that a good asumption?
f.write(text)
f.close()
评论列表
文章目录