from Tkinter import *
class FileDisplay :
def loadfile(self) :
myFile=file(self.filename.get())
myText= myFile.read()
myFile.close()
self.text_widget.insert(0.0,myText)
def __init__(self) :
self.root = Tk()
Label(self.root, text="Filename: ").pack()
self.filename = Entry(self.root)
self.filename.pack()
Button(self.root, text="Display", command=self.loadfile).pack()
self.text_widget = Text(self.root)
self.text_widget.pack(expand=1, fill=BOTH)
self.root.mainloop()
fd = FileDisplay()