保存文本框的内容
上一节
下一节

代码
import tkinter as tk
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
t=tk.Tk()
t.title('记事本')
t.geometry('500x466')
def s():
with open('c:\\1\\1.txt',mode='w') as f:
f.write(txt.get(1.0,'end'))
tk.Button(text='保存',command=s).place(x=3,y=1)
txt=tk.Text()
txt.place(x=3,y=32,width=494,height=430)
tk.mainloop()

