🎭Facial Expression Program🎭

HKDSE ICT Pre-SBA 2 Project

Version: 1.0.0

Class: 4E

Student ID: 13

Date: 27/02/2026

📋 Project Overview

This Python program displays 7 different facial expressions using a 10x10 2D array system with nested loops for rendering. The project includes two versions:

Latest Update: Fixed expression button highlighting - selected expressions now show clear visual feedback with blue background and sunken relief.

😊 Facial Expressions

😊

Happy

Smiling face

đŸ˜ĸ

Sad

Frowning face

😠

Angry

Furrowed brows

😲

Surprised

Wide eyes

😉

Wink

Playful wink

😎

Cool

Sunglasses

😍

Love

Heart eyes

🎮 Live Demo

Try the facial expression renderer right here in your browser!

Scale: 1x

Current: Happy | Scale: 1x

âš™ī¸ How It Works

1. 2D Array Storage

Each facial expression is stored as a 10x10 2D array template using placeholder symbols:

Symbol Meaning Description
F Face Replaced with face color emoji
E Eye/Mouth Replaced with eye/mouth color emoji
B Background Replaced with background color emoji

2. Example: Happy Face Array

happy_face = [
    ["B", "B", "B", "F", "F", "F", "F", "B", "B", "B"],
    ["B", "F", "F", "F", "F", "F", "F", "F", "F", "B"],
    ["F", "F", "E", "E", "F", "F", "E", "E", "F", "F"],
    ["F", "F", "E", "E", "F", "F", "E", "E", "F", "F"],
    ["F", "F", "F", "F", "F", "F", "F", "F", "F", "F"],
    ["F", "E", "F", "F", "F", "F", "F", "F", "E", "F"],
    ["F", "F", "E", "F", "F", "F", "F", "E", "F", "F"],
    ["F", "F", "F", "E", "E", "E", "E", "F", "F", "F"],
    ["B", "F", "F", "F", "F", "F", "F", "F", "F", "B"],
    ["B", "B", "B", "F", "F", "F", "F", "B", "B", "B"]
]

3. Nested Loops Rendering

# OUTER LOOP: Iterate through each row
for row_index in range(len(face_array)):
    line = ""
    
    # INNER LOOP: Iterate through each column
    for col_index in range(len(face_array[row_index])):
        symbol = face_array[row_index][col_index]
        line += symbol
    
    print(line)  # Print the completed row

✨ Features

🎨

Color Customization

8 face colors, 6 eye colors, 3 background options

📐

Scalable Display

Normal (10x10), Large (20x20), Extra Large (30x30)

đŸ’ģ

Dual Versions

CLI terminal & GUI tkinter interfaces

đŸ–ąī¸

Interactive

Mouse-clickable GUI with real-time preview and visual button feedback

đŸ“Ļ

Standalone EXE

Run without Python installed

🔧

Easy to Use

User-friendly menus and help system

đŸ“Ĩ How to Run

Method 1: CLI Version (Terminal)

python 4E13_preSBA2.py

Method 2: GUI Version (Windowed)

python 4E13_preSBA2_GUI.py

Method 3: Run the Executable

Double-click dist/FacialExpression_4E13.exe

Method 4: Create Your Own EXE (Windows)

pip install pyinstaller
pyinstaller --onefile --windowed --name "FacialExpression_4E13" --clean 4E13_preSBA2_GUI.py

Method 5: Create Your Own App (macOS)

pip3 install pyinstaller
bash create_app.sh

Requirements

Keyboard Shortcuts

Category Shortcut Action
Expressions 1-7 Select expression
Numpad Also works
Actions Ctrl+R Refresh display
Ctrl+C Copy to clipboard
Ctrl+D Reset defaults
F1 Show help
Ctrl+Q Quit program
Scale Ctrl+1 Normal (10x10)
Ctrl+2 Large (20x20)
Ctrl+3 Extra Large (30x30)
Colors Shift+↑↓ Cycle face colors
Shift+←→ Cycle eye colors
đŸ“Ĩ Download from GitHub

📁 File Structure

sba stuff/
│
├── 4E13_preSBA2.py            # CLI version (terminal-based)
├── 4E13_preSBA2_GUI.py        # GUI version (tkinter windowed)
├── create_exe.bat             # Batch file for EXE (Windows)
├── create_app.sh              # Shell script for App (macOS/Linux)
├── requirements.txt           # Python dependencies
├── LICENSE                    # MIT License
├── README_4E13_preSBA2.md     # Documentation
├── FacialExpression_4E13.spec # PyInstaller spec file
│
├── build/                     # Build folder (after build)
│   └── FacialExpression_4E13/
│
└── dist/                      # Output folder (after build)
    ├── FacialExpression_4E13.exe  # Windows executable
    └── FacialExpression_4E13.app  # macOS application