from tkinter import *
import time
import os;
import sys;
import imp
imp.reload(sys);
root = Tk()
text1 = Text(root,width=120,height=40)
text1.insert(INSERT,’I Love’)
text1.insert(END,’ you’)
text1.pack()
def saveClick():
print(“save here”)
path=os.getcwd() + ‘/hostb’
with open(path, ‘a+’) as fb:
fb.write(text1.get(1.0, END))
b1 = Button(root, text=’save’, command=saveClick)
text1.window_create(INSERT, window=b1)
b1.pack()
def exitClick():
print(“exit here”)
root.destroy()
b2 = Button(root, text=’exit’, command=exitClick)
text1.window_create(INSERT, window=b2)
b2.pack()
root.mainloop()