记事本-小程序

# Author:979
# blog addr:http://www.cnblogs.com/home979/

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()

#引用自:http://www.jb51.net/article/68031.htm

 

posted on 2018-03-09 19:39  机壳啦  阅读(144)  评论(0编辑  收藏  举报

导航