NOTEPAD SUBMITTED BY : GROUP 23 MENTORED BY : POONAM DHANKAR INTRODUCTION To learn how to build your text editor like Notepad using python. This is a detailed tutorial with code and explanation using which you will be able to create your text editor. Tkinter is a GUI library from python from which we can create multiple GUI apps. Here, using tkinter we will develop a notepad like text editor. This notepad will have the menu where we can create new file, open existing file, save the file, editing, cut and paste, all functionality will there. Prerequisite 1. Python installed. 2. Tkinter installed. ABOUT Notepad is a simple text editor for Microsoft Windows that allows users to create text documents, save them as plain text, and edit plaintext files. It is extremely useful for viewing or writing relatively short text documents saved as plain text. 1. The File menu has options like New, Open, Save, Save As, and Exit. 2. The Edit menu has options like Cut, Copy, Paste, Delete, Find, Select All, and Time/Date. MENU ITEMS Our notepad will have four main menu items: File, Edit, Commands & Help. Our file menu item will have four sub-items- New, Open, Save & Exit. Our edit menu item will have three sub-items- cut, copy & paste. And our help menu will have one subitem- About notepad FUNCTIONALITY OF MENU ITEMS Now we have the menu items ready, now we are going to add functionality to each of the menu items. Below the list of functionality, we going to add to this notepad (of course you can add many others too). • Open file • New file • Save file • Quit Application • Show About • Cut • Copy • Paste FACILITIES REQUIRED SOFTWARE • Python • Pycharm LIBRARIES • Tkinter Firstly we need to import tkinter after installing it for python import tkinter import os from tkinter import * # To get the space above for message from tkinter.messagebox import * # To get the dialog box to open when required from tkinter.filedialog import The above code will enable tkinter for further use Next up, we need a menu bar for the notepad we are developing, the code for that will be as follows # Add controls(widget) self.__thisTextArea.grid(sticky = N + E + S + W) # To open new file self.__thisFileMenu.add_command(label = "New", command = self.__newFile) # To open a already existing file self.__thisFileMenu.add_command(label = "Open", command = self.__openFile) # To give a feature of cut self.__thisEditMenu.add_command(label = "Cut", command = self.__cut) # To give a feature of copy self.__thisEditMenu.add_command(label = "Copy", command = self.__copy) # To save current file # To give a feature of paste self.__thisFileMenu.add_command(label = "Save", self.__thisEditMenu.add_command(label = "Paste", command = self.__saveFile) command = self.__paste) # To create a line in the dialog self.__thisFileMenu.add_separator() # To give a feature of editing self.__thisMenuBar.add_cascade(label = "Edit", # To terminate menu self.__thisFileMenu.add_command(label = "Exit", = self.__thisEditMenu) command = self.__quitApplication) self.__thisMenuBar.add_cascade(label = "File", menu = self.__thisFileMenu) # To create a feature of description of the notepad self.__thisHelpMenu.add_command(label = "About Notepad", command = self.__showAbout) self.__thisMenuBar.add_cascade(label = "Help", menu = self.__thisHelpMenu) self.__root.config(menu = self.__thisMenuBar) self.__thisScrollBar.pack(side = RIGHT, fill = Y) # Scrollbar will adjust automatically # according to the content self.__thisScrollBar.config(command = self.__thisTextArea.yview) self.__thisTextArea.config(yscrollcommand = self.__thisScrollBar.set) Further ahead, we need to add the MENU and the FUNCTIONALITY of our notepad, and then merge all these three segments of code into one for compilation using tkinter (the codes for those are very long and will be put in the report for this project) after that we will save the filename with the extension .py and run our code to check, outputs in next slide THANK YOU