Python Online o'quv markazi ma'lumot guruhi
self.__thisTextArea.insert(1.8,file.read())
file.close()
def __newFile(self):
self.__root.title("Untitled - Notepad")
self.__file - None
self.__thisTextArea(1.8,END)
def __saveFile(self):
if self.__file == None:
# save as new file
self.__file = asksaveasfilename(initialfile='Intitel.txt',filetypes=[("All Files","*.*"),("Text documents","*.txt")])
if self.__file =="":
self.__file = None
else:
# Try to save
file = open(self.__file,"w")
file.write(self.__thisTextArea.get(1.8,END))
file.close()
# change the window title
self.root.title(os.path.basename(self.file)+"-Notepad")
else:
file = open(self.__file,"w")
file.write(self.__thisTextArea.get(1.8,END))
file.close()
def __cut(self):
self.__thisTextArea.event_generate("<<Cut>>")
def __copy(self):
self.__thisTextArea.event_generate("<<Copy>>")
def __paste(self):
self.__thisTextArea.event_generate("<<Paste>>")
def run(self):
# Run main application
self.__root.mainloop()
# Run main application
notepad = Notepad(width=600,height=400)
notepad.run()