I am a beginner coder and I’ve been working on a text editor with python and I noticed that when I save the file the file does not save as a .txt file even if I choose the option from the drop down menu (by this, I mean that if I write something and press […]
Categories
Python Text Editor bug
- Post author By Full Stack
- Post date December 22, 2020
- No Comments on Python Text Editor bug
- Tags '.txt', "*.*")]) if not fp: return self.txtEdit.delete(1.0, "*.*")]) if not fp: return with open(fp, "r") as inFile: txt = inFile.read() self.txtEdit.insert(tk.END, "w") as outFile: txt = self.txtEdit.get(1.0, ("all files", asksaveasfilename class Application(tk.Frame): def __init__(self, column=0, column=1, command=self.openFile) self.btnSave = tk.Button(self.btnFrame, command=self.saveFile) self.txtEdit.grid(row=0, I am a beginner coder and I've been working on a text editor with python and I noticed that when I save the file the file does not save as a, I mean that if I write something and press save and save as a .txt file the file description says 'File' instead of 'Text Document'). The cod, master=None): super().__init__(master) self.master = master self.pack() self.createWidgets() def, minsize=800, sticky="ew") def openFile(self): fp = askopenfilename(filetypes=[("Text Files", sticky="ew") self.btnSave.grid(row=1, sticky="ns") self.btnOpen.grid(row=0, sticky="nsew") self.btnFrame.grid(row=0, text="Open", text="Save as", tk.END) outFile.write(txt) root = tk.Tk() root.title("Text Editor") root.rowconfigure(0, tk.END) with open(fp, txt) def saveFile(self): fp = asksaveasfilename(filetypes=[("Text Files"