diff --git a/Notepad.py b/Notepad.py index cbe1370..99bc68f 100755 --- a/Notepad.py +++ b/Notepad.py @@ -23,11 +23,11 @@ class Notepad: def __init__(self,**kwargs): #initialization - #set icon + #set icon try: - self.__root.wm_iconbitmap("Notepad.ico") #GOT TO FIX THIS ERROR (ICON) - except: - pass + self.__root.wm_iconbitmap("Notepad.ico") #GOT TO FIX THIS ERROR (ICON) + except: + pass #set window size (the default is 300x300) @@ -71,8 +71,11 @@ def __init__(self,**kwargs): self.__thisEditMenu.add_command(label="Cut",command=self.__cut) self.__thisEditMenu.add_command(label="Copy",command=self.__copy) self.__thisEditMenu.add_command(label="Paste",command=self.__paste) + self.__thisEditMenu.add_separator() self.__thisMenuBar.add_cascade(label="Edit",menu=self.__thisEditMenu) + + self.__thisHelpMenu.add_command(label="About Notepad",command=self.__showAbout) self.__thisMenuBar.add_cascade(label="Help",menu=self.__thisHelpMenu) @@ -83,14 +86,14 @@ def __init__(self,**kwargs): self.__thisTextArea.config(yscrollcommand=self.__thisScrollBar.set) - def __quitApplication(self): + def __quitApplication(self,event=None): self.__root.destroy() #exit() def __showAbout(self): showinfo("Notepad","Created by: Ferdinand Silva (http://ferdinandsilva.com)") - def __openFile(self): + def __openFile(self,event=None): self.__file = askopenfilename(defaultextension=".txt",filetypes=[("All Files","*.*"),("Text Documents","*.txt")]) @@ -110,12 +113,12 @@ def __openFile(self): file.close() - def __newFile(self): + def __newFile(self,event=None): self.__root.title("Untitled - Notepad") self.__file = None self.__thisTextArea.delete(1.0,END) - def __saveFile(self): + def __saveFile(self,event=None): if self.__file == None: #save as new file @@ -146,9 +149,16 @@ def __copy(self): def __paste(self): self.__thisTextArea.event_generate("<>") + def __redo(self): + self.__thisTextArea.event_generate("<>") + def run(self): #run main application + self.__root.bind("",self.__newFile) + self.__root.bind("",self.__openFile) + self.__root.bind("",self.__saveFile) + self.__root.bind("", self.__quitApplication) self.__root.mainloop() diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b1498e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ + +Binding some function with the keyword button or may be called shortcut keys \ No newline at end of file