def save(self): try: self.v = self.fileName.get() with open(self.v, "a") as w: w.write(self.contents.get(1.0, END)) except: messagebox.showwarning("error", "file not found")