How to Make Your Own Cross Platform Custom Notepad Application [Windows/Mac/Linux]

If you want to make your own custom Notepad application (say as a school or college project) then the best way to get it done quickly is by using Python Programming.

In this article, we will try and create a very basic Notepad application that has the functionality as Menu options,

  • Open and Edit a text file.
  • Save a text file.
  • Exit the Notepad

We will need to make use of the tkinter GUI module for this.

Code for Custom Notepad

import tkinter as tk
from tkinter import filedialog

def open_file():
    file_path = filedialog.askopenfilename()
    if file_path:
        with open(file_path, 'r') as file:
            text.delete(1.0, tk.END)

def save_file():
    file_path = filedialog.asksaveasfilename(defaultextension=".txt")
    if file_path:
        with open(file_path, 'w') as file:
            file.write(text.get(1.0, tk.END))

root = tk.Tk()
root.title("Custom Notepad Application")

notes = tk.Text(root, wrap=tk.WORD)

menu = tk.Menu(root)

file_menu = tk.Menu(menu)
menu.add_cascade(label="File", menu=file_menu)
file_menu.add_command(label="Open File...", command=open_file)
file_menu.add_command(label="Save File...", command=save_file)
file_menu.add_command(label="Exit", command=root.destroy)



Writing in our Custom Notepad
Save file option
Saving file in our Notepad
Opening our file

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap