Notepad for Python with Source Code

The Notepad for Python is an open-source project which is developed using Python Programming Language. This system is a simple GUI-based application created by using Python.

It used the Tkinter function for the Graphical User Interface.

Python Notepad Software Project Information

Project Name:Notepad for Python
Language/s Used:Python Console Based
Python version (Recommended):2.x or 3.x
Type:Python App
Python on Notepad – Project Information

About The Project

A Notepad in Python is designed using tkinter and the project file contains( Tkinter is a graphical user interface library from Python from which we will create more than one GUI app.

The use of a tkinter will broaden a notepad-like text editor. The notepad will have a menu where we are able to create a new file, open an existing file, save the file, edit, cut,  copy, and paste.

This article is an open-source that allows the person to download and edit as consistent with their need.

Before you start to create a Python Notepad, make sure that you have Pycharm IDE installed on your computer.

Steps on How To Create A Notepad For Python

Time needed: 5 minutes

Notepad using Python with Source Code

  • Step 1: Create a Project Name.

    First step open the PyCharm IDE and click “File” and select “New Project” and then create a project name after that click the “create” button.Creating Project Name for Notepad

  • Step 2: Create a Python File.

    In the second step after creating a project name, “right” click the project name, and then click “New.” After that choose “Python File“.Creating Python file for Notepad

  • Step 3: Name the Python File.

    The third step after choosing the Python File name the file “notepad” and then click “Enter“.Naming Python file for Notepad

  • Step 4: The actual code.

    Now you can start coding, you are free to copy the code that being provided below.

Python Notepad Code Explanations

1. New File

Module for New File Functionality.

def new_file_logo(event=None):
global url
url = ''
file.add_command(label='new', image=new_logo ,compound=tk.LEFT, accelerator ='Ctrl+N',command=new_file_logo)

The code above is for the new file feature. If you click on a new file, it will open a new document. If you want to open a new document faster, just press Ctrl+N on your keyboard.

2. Open File

Module for Open File Functionality.

def open_file_logo(event=None):
global url
url = filedialog.askopenfilename(initialdir=os.getcwd(), title='Select File', filetypes=(('Text File', '*.txt'), ('All files', '*.*')))
with open(url, 'r') as fr:
text_editor.delete(1.0, tk.END)
except FileNotFoundError:
except :

file.add_command(label='Open', image=open_logo ,compound=tk.LEFT, accelerator ='Ctrl+O',command =open_file_logo)

In the code above, which is for the open file feature to open a document file on your computer. Pressing Ctrl+O on the keyboard lets you open more than one file at once.

3. Save

Module for Save Functionality.

ef save_file_logo(event=None):
global url
if url:
content = str(text_editor.get(1.0,tk.END))
with open(url, 'w', encoding='utf-8') as fw:
else :
url = filedialog.asksaveasfile(mode='w', defaultextension='.txt', filetypes=(('Text File', '*.txt'),('All files','*.*')))
content = text_editor.get(1.0, tk.END)
except :

file.add_command(label='Save', image=save_logo, compound=tk.LEFT, accelerator ='Ctrl+S', command=save_file_logo)

In the code shown above, which is for the Save your document. Click FILE > Save, choose or browse to a folder, give your document a name in the File name box, and click Save or save your work as you go by pressing Ctrl+S.

4. Exit

Module for Exit Functionality.

def exit_module(event=None):
global url, text_changed
if text_changed:
boxmessage = messagebox.askyesnocancel('Warning','Do you want to save the file')
if boxmessage is True :

if url:
content = text_editor.get(1.0,tk.END)
with open(url,'w',encoding='utf-8') as fw:
content2 = str(text_editor.get(1.0,tk.END))
url = filedialog.asksaveasfile(mode='w',defaultextension='.txt',filetypes=(('Text File','*.txt'),('All files','*.*')))
elif boxmessage is False:

file.add_command(label='Exit', image=exit_logo, compound=tk.LEFT, accelerator='Ctrl+Q', command=exit_module)

In the code above, “Exit” is a command line on the File menu that lets you close the Notepad application when you’re done working on your document.

Module for Search or Find Functionality.

def search_module(event=None):

def find():
word = entry_find.get()
matches = 0
if word:
start_pos = '1.0'
while True:
start_pos =, start_pos, stopindex=tk.END)
if(not start_pos):
end_pos = f'{start_pos}+{len(word)}c'
matches +=1

In the code shown above, which is for finding a word that will turn red if it is correct?

How To Run The Python Notepad with Source Code?

To run this project, you must have installed a Pycharm on your PC (for Windows). This article is for educational purposes only!

After downloading the project you must follow the steps below:

Step 1: Unzip the file or Extract the file

Step 2: Double-click the notepad

Step 3: The project is ready to run

Downloadable Source Code 

I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.


Notepad for Python with source Code is good for the student who wants to learn Python programming because this project contains a Graphical User Interface (GUI) and a users friendly.

It is easy to understand and manipulate this project and use it for education purposes only.

Leave a Comment