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.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Creating NotePad using PyQt5 - Python
- Robotic Process Automation(RPA) - Notepad Automation using UIPath
- How to make a proper double scrollbar frame in Tkinter
- Color game using Tkinter in Python
- Python | Message Encode-Decode using Tkinter
- Python | Simple GUI calculator using Tkinter
- Python | Distance-time GUI calculator using Tkinter
- Python | Random Password Generator using Tkinter
- Python | Real time currency convertor using Tkinter
- Python | Real time weather detection using Tkinter
- Python | Simple FLAMES game using Tkinter
- Python | Simple calculator using Tkinter
- Tkinter | Adding style to the input text using ttk.Entry widget
- Python | Create a digital clock using Tkinter
- Python | Loan calculator using Tkinter
- Getting screen's height and width using Tkinter | Python
- Python Tkinter | Moving objects using Canvas.move() method
- Python - Compound Interest GUI Calculator using Tkinter
- Python Tkinter | Create different type of lines using Canvas class
- Python Tkinter | Create different shapes using Canvas class
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.