Let’s see how to create a simple notepad in Python using Tkinter. This notepad GUI will consist of various menu like file and edit, using which all functionalities like saving the file, opening a file, editing, cut and paste can be done.
Now for creating this notepad, Python 3 and Tkinter should already be installed in your system. You can download suitable python package as per system requirement. After you have successfully installed python you need to install Tkinter (a Python’s GUI package).
Use this command to install Tkinter :
pip install python-tk
Importing Tkinter :
Note : messagebox is used to write the message in the white box called notepad and filedialog is used for the dialog box to appear when you are opening file from anywhere in your system or saving your file in a particular position or place.
Adding Menu :
With this code we will add the menu in the windows of our notepad and will add the things like copy, paste, save etc, to it.
Adding The Functionality :
In this we have added all the functionality that is required in the notepad, you can add other functionality too in this like the font size, font color, bold, underlined, etc.
Main Code After Merging All :
To run this code, save it by the extension .py and then open cmd(command prompt) and move to the location of the file saved and then write the following
and press enter and it will run. Or can be run directly by simply double clicking your .py extension file.
- Python GUI - tkinter
- Different messages in Tkinter | Python
- Python | after method in Tkinter
- RadioButton in Tkinter | Python
- Python | geometry method in Tkinter
- Python | asksaveasfile() function in Tkinter
- minsize() method in Tkinter | Python
- Collapsible Pane in Tkinter | Python
- iconphoto() method in Tkinter | Python
- resizable() method in Tkinter | Python
- Python | Add image on a Tkinter button
- maxsize() method in Tkinter | Python
- Python | Loan calculator using Tkinter
- Python | Binding function in Tkinter
- Python | askopenfile() function in Tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.