1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| from tkinter import *
root = tk('simple editor')
mi=stringvar()
label(text='please input something you like~' ).pack()
te = text(height = 30,width =100)
te.pack()
label(text=' file name ').pack(side = left)
entry(textvariable = mi).pack(side = left)
mi.set('*.txt')
def save():
t = te.get('0.0','10.0')
f = open(mi.get(),'w')
f.write(t)
button(text = 'save' , command = save).pack(side = right)
button(text = 'exit' , command = root.quit).pack(side = right)
mainloop()
|