This project is a simple Notepad-style text editor built using Python's Tkinter library.
It provides essential file editing features such as writing, saving, opening, and editing text files, all within a graphical user interface (GUI).
- New β Clears the text area and resets the window title
- Open β Opens a
.txt
file using a file dialog and loads its content - Save β Saves the current text to a selected file (default
.txt
) - Exit β Closes the application
- Cut β Cuts the selected text
- Copy β Copies the selected text
- Paste β Pastes the clipboard content into the editor
- GUI created using Tkinter's
Text
widget - Word wrapping enabled for easier reading
- Dynamically resizable window
- Built-in
filedialog
for file I/O
- The main class
Notepad
inherits fromtk.Tk
, creating the root window. - The text editing area is implemented using
Text()
. - Menus (
File
,Edit
) are created usingMenu()
and added to the top menu bar. - Core methods:
new_file()
β Clears all text from the editoropen_file()
β Opens a file and displays its contentsave_file()
β Saves current content to a filecut()
,copy()
,paste()
β Use built-in event generation for editing
- Make sure Python 3 is installed.
- Save the file as
notepad.py
. - Run the file:
python notepad.py
-
Text Area: Main writing panel with scroll and word-wrap
-
File Menu:
-
New: Clears the text area
-
Open: Loads content from an existing file
-
Save: Saves content to a file (with extension .txt by default)
-
Exit: Closes the application
-
-
Edit Menu:
-
Cut: Removes and copies selected text
-
Copy: Copies selected text
-
Paste: Pastes copied text into the cursor position
-
-
Add font selection or theme options (dark/light mode)
-
Add keyboard shortcuts (Ctrl+S, Ctrl+O, etc.)
-
Add status bar (line number, word count)
-
Implement undo/redo functionality
Created by CristiC7
Beginner-friendly text editor built using Python and Tkinter.
Open to improvements and contributions!