Case StudyWhere It All Began● Pinned

NotePad

My very first project ever — a fully-featured Windows Notepad replica built with Python and PyQt5 in late 2023, before I even started university. This is where I fell in love with Computer Science.

Late 2023
Personal Project
Solo
PythonPyQt5Qt DesignerFusion Style
Untitled - NotePad
FileEditChangeInsertHelp
Ready

↑ Animated recreation of the PyQt5 NotePad interface

// The Origin Story

Before University, Before Everything

In late 2023, before I had even started my Computer Science degree at Paragon International University, I decided to teach myself programming. I picked Python — and the very first project I set out to build was a replica of Windows Notepad.

I discovered PyQt5 and Qt Designer, which let me visually design the interface and then wire it up with Python code. I spent hours figuring out how signals and slots work, how to read and write files, and how to make the toolbar buttons actually do something.

This project taught me the fundamentals that everything else would build upon: object-oriented programming, event-driven architecture, file I/O, and GUI design. It was the spark that made me fall in love with Computer Science — and I have never looked back since.

// Features

Everything a NotePad Needs

New / Open / Save / Save As

Full file lifecycle with unsaved-changes detection on close

Bold / Italic / Underline

Rich text formatting with toolbar buttons and keyboard shortcuts

Text Alignment

Left, center, right, and justify alignment controls

Font Picker & Size

QFontComboBox with live preview and SpinBox for font size

Font & Background Color

QColorDialog for text color and text background color

Undo / Redo

Full undo/redo stack with Ctrl+Z and Ctrl+Y shortcuts

Print & Print Preview

QPrinter integration with high-resolution print dialog and preview

Export to PDF

One-click PDF export using QPrinter's PDF output format

Insert Date / Time

Insert current date or time at cursor position

Save Prompt on Exit

Smart close event detects unsaved changes and prompts to save

// Architecture

How the App Is Structured

run.py9 lines

Entry point — creates QApplication, sets Fusion style, launches the NotePad window

main.py277 lines

Core logic — NotePad class with all file operations, formatting, printing, and event handlers

NotePad.py385 lines

Qt Designer output — auto-generated UI class with menu bar, toolbar, status bar, and all actions

functions.py30 lines

Helpers — new file reset, unsaved-changes detection, and About dialog

res_rc.py874K

Compiled Qt resources — all toolbar icons embedded as binary data

// Code Sample

Signal-Slot Pattern in Action

main.py — NotePad class
class NotePad(QMainWindow, Ui_NotePad):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.show()
        self.showMaximized()
        
        self.filename = None
        self.path = ''
        self.update_title()
        
        # Connect signals to slots
        self.actionNew.triggered.connect(self.new_file)
        self.actionOpen.triggered.connect(self.open_file)
        self.actionSave.triggered.connect(self.save_file)
        self.actionBold.triggered.connect(self.bold)
        self.actionItalic.triggered.connect(self.italic)
        self.actionUnderline.triggered.connect(self.underline)
        self.actionPrint.triggered.connect(self.print_file)
        self.actionExport_to_PDF.triggered.connect(self.export_to_pdf)

    def save_file(self):
        if self.path == '':
            self.save_file_as()
        content = self.textEdit.toPlainText().strip()
        with open(self.path, 'w') as file:
            file.write(content)
            self.statusbar.showMessage(
                f'{self.filename} saved successfully'
            )

// What I Learned

Lessons From My First Project

Object-Oriented Programming

Building the NotePad class that inherits from both QMainWindow and the Qt Designer-generated Ui_NotePad taught me how inheritance and composition work in practice — connecting UI elements to methods through signals and slots.

Event-Driven Programming

Every button click, menu action, and keyboard shortcut is a Qt signal connected to a slot. This was my introduction to the event-driven paradigm that powers all modern GUI applications.

File I/O & Error Handling

Implementing New, Open, Save, Save As, and the close-event save prompt taught me file handling, path management, and wrapping everything in try/except for graceful error recovery.

UI/UX Design with Qt Designer

Using Qt Designer to visually build the interface, then connecting the generated Python class to my logic code, taught me the separation between UI layout and business logic — a pattern I still use today.

// Keyboard Shortcuts

Full Shortcut Support

Ctrl+NNew
Ctrl+OOpen
Ctrl+SSave
Ctrl+Shift+SSave As
Ctrl+PPrint
Ctrl+QExit
Ctrl+ZUndo
Ctrl+YRedo
Ctrl+BBold
Ctrl+IItalic
Ctrl+LAlign Left
Ctrl+ECenter
Ctrl+RAlign Right
Ctrl+JJustify
Ctrl+ASelect All
Ctrl+X/C/VCut/Copy/Paste

This Is Where It Started

From a simple Python Notepad to building full-stack web applications, IoT systems, and cloud deployments. Every expert was once a beginner — and this was my beginning.

Enjoyed this project? Consider supporting my work ☕

Buy Me a Coffee