这是菜单当中的打开命令的代码
def openfile(self): p1=END oname=askopenfilename(filetypes=[("文本文档","*.txt")]) if oname: for line in fileinput.input(oname): self.st.insert(p1,line) self.t.title(oname) def savefile(self): sname=asksaveasfilename() if sname: ofp=open(sname,"w") ofp.write(self.st.get(1.0,END)) ofp.flush() ofp.close() self.t.title(sname)
郎朗坤
呼如林
相关分类