def writefile(self, filename):
self.fixlastline()
text = self.text.get("1.0", "end-1c")
if self.eol_convention != "\n":
text = text.replace("\n", self.eol_convention)
chars = self.encode(text)
try:
f = open(filename, "wb")
f.write(chars)
f.flush()
f.close()
return True
except IOError as msg:
tkMessageBox.showerror("I/O Error", str(msg),
master=self.text)
return False
评论列表
文章目录