def open_file(self, event=None): path = tkFileDialog.askopenfilename() if path: data = open(path, "rb").read() self.text.delete('1.0', 'end') self.text.insert("1.0", data) self.text.storeobj['OpenFile'] = path return
def __init__(self, pad): self.text = pad path = tkFileDialog.askopenfilename() if path: self.s = open(path, 'r').read() self.insert_words() else: self.s = None