A Python-based application for managing a student gradebook with both CLI and GUI interfaces, featuring data persistence, GPA calculation, and comprehensive input validation.
- Sortable Course Table: Click column headers to sort by course name, grade, or credits
- Search/Filter: Real-time search to filter courses by name
- Add/Edit Courses: User-friendly popup dialogs for adding and editing courses
- Delete Courses: Delete courses with confirmation dialog
- GPA Summary: Live display of total credits and weighted GPA
- Input Validation: User-friendly error dialogs for invalid inputs
- Persistent Storage: Automatic save/load using
gradebook.json
- Add Courses: Add new courses with grades and credit hours
- Update Courses: Modify grades or credit hours for existing courses
- Delete Courses: Remove courses from the gradebook
- View Gradebook: Display all courses with grades and credits
- GPA Calculation: Automatically calculate weighted GPA
- Persistent Storage: Save and load data from JSON file
- Input Validation: Validates all inputs (grades, credits, course names)
- Python 3.6 or higher
- tkinter (python3-tk) - for GUI application
- Clone the repository:
git clone https://github.com/ducduyhsme/Student-Gradebook-CLI.git
cd Student-Gradebook-CLI- Install tkinter (if not already installed):
# On Ubuntu/Debian
sudo apt-get install python3-tk
# On Fedora
sudo dnf install python3-tkinter
# On macOS (usually pre-installed)
# No action needed
# On Windows (usually pre-installed)
# No action needed- Make scripts executable (optional):
chmod +x gradebook.py gradebook_gui.pyRun the graphical interface:
python3 gradebook_gui.pyOr if you made it executable:
./gradebook_gui.pyMain Window:
- View all courses in a sortable table
- Click column headers (Course Name, Grade, Credits) to sort
- See live GPA and total credits at the bottom
Search/Filter:
- Type in the search box to filter courses by name
- Results update in real-time
Adding a Course:
- Click "Add Course" button or use File → Add Course menu
- Enter course name, grade (0.0-4.0 or letter A-F), and credit hours
- Click OK to save
Editing a Course:
- Select a course from the table
- Click "Edit Course" button or double-click the course
- Modify grade or credits
- Click OK to save
Deleting a Course:
- Select a course from the table
- Click "Delete Course" button
- Confirm deletion in the dialog
Run the command-line interface:
python3 gradebook.pyOr if you made it executable:
./gradebook.py-
Add Course: Add a new course to your gradebook
- Enter course name
- Enter grade (numeric 0.0-4.0 or letter grade A-F)
- Enter credit hours (positive integer)
-
Update Course: Modify an existing course
- Enter the course name to update
- Enter new grade (or press Enter to keep current)
- Enter new credit hours (or press Enter to keep current)
-
Delete Course: Remove a course from the gradebook
- Enter course name to delete
- Confirm deletion
-
View Gradebook: Display all courses with grades, credits, and current GPA
-
Calculate GPA: Show current GPA and total credits
-
Exit: Save and exit the application
The application accepts two grade formats:
Numeric (4.0 scale):
- 4.0, 3.7, 3.3, 3.0, etc.
Letter Grades:
- A (4.0), A- (3.7)
- B+ (3.3), B (3.0), B- (2.7)
- C+ (2.3), C (2.0), C- (1.7)
- D+ (1.3), D (1.0), D- (0.7)
- F (0.0)
- GUI Application: Data is automatically saved to
gradebook.json - CLI Application: Data is automatically saved to
gradebook_data.json - Data persists between sessions
- JSON format for easy backup and transfer
- Both applications can coexist with separate data files
Welcome to Student Gradebook CLI!
============================================================
STUDENT GRADEBOOK - MAIN MENU
============================================================
1. Add Course
2. Update Course
3. Delete Course
4. View Gradebook
5. Calculate GPA
6. Exit
============================================================
Enter your choice (1-6): 1
--- Add Course ---
Enter course name: Data Structures
Enter grade (0.0-4.0 or letter grade A-F): A
Enter credit hours: 3
Course 'Data Structures' added successfully!
Data saved to gradebook_data.json
Enter your choice (1-6): 4
============================================================
STUDENT GRADEBOOK
============================================================
Course Name Grade Credits
------------------------------------------------------------
Data Structures 4.00 3
------------------------------------------------------------
Total Credits: 3
GPA: 4.00
============================================================
The application validates:
- Course names: Must not be empty
- Grades: Must be 0.0-4.0 or valid letter grade (A-F)
- Credits: Must be positive integers
- Duplicate courses: Prevents adding courses that already exist
The gradebook uses a dictionary to store courses:
{
"Course Name": {
"grade": 4.0,
"credits": 3
}
}The application uses a modular design:
Gradebookclass: Core business logic for managing courses and GPA calculationGradebookGUIclass: Tkinter-based graphical user interfaceCourseDialogclass: Popup dialogs for adding/editing courses- Persistent storage: JSON-based data persistence
MIT License