- Project Overview
The Ultimate Science Quiz is a desktop quiz game where the player picks a subject and a difficulty level, then answers a series of multiple-choice questions against a countdown timer. It was one of my earlier Python projects, built to practise combining a graphical interface with game logic — timers, scoring, screen navigation, and saved progress — in one working application.
- Problem Statement
Revising for science topics can feel flat when it is just reading notes. This project turns subject revision into an interactive, game-like experience: questions are organised by subject and difficulty, answers are timed to add pressure, and a persistent high score gives the player a reason to come back and improve.
- Features
- Subject and difficulty selection screens, so questions are pulled from the right category before the quiz starts.
- Question bank loaded from an external questions.json file, keeping content separate from the game logic.
- Randomised question order on every playthrough.
- 15-second countdown per question, shown as both a numeric label and a shrinking progress bar.
- Pause and Resume control to stop and restart the timer mid-question.
- Instant visual feedback: the correct option turns green and, if the player chose wrong, their pick turns red.
- Automatic scoring, with the question advancing a second after each answer (or automatically if time runs out).
- Persistent high score saved to a local highscore.txt file, so the record carries over between sessions.
- End-of-quiz summary screen with the final score, the current high score, and a performance- based message.
- Play Again and Exit options to loop back into a new round or close the app.
- How It Works
The app is built as a single QuizGame class that manages three interchangeable screens — subject selection, the live quiz, and the score summary — stacked in the same window and swapped in and out as the player progresses. Questions are stored in questions.json, organised by subject and then by difficulty, and are loaded once when the game starts.
Each question round starts a repeating timer using Tkinter’s after() scheduler, which counts down every second and redraws a canvas-based progress bar to match the time remaining. Selecting an answer, or letting the timer expire, stops the countdown, colours the buttons to show the correct and selected answers, updates the score, and then automatically loads the next question. When the round ends, the score is compared against the saved high score, updated if beaten, and written back to highscore.txt.
- Technology Stack
| Component | Technology |
|---|---|
| Language | Python 3 |
| GUI Framework | Tkinter (Frames, Canvas, Buttons, Labels) |
| Question Data | External questions.json file |
| Score Persistence | Local highscore.txt text file |
| Timing | Tkinter’s after() scheduler for the countdown |
- What I Learned
- Managing multiple “screens” in a single-window Tkinter app by swapping frames in and out.
- Implementing a countdown timer with Tkinter’s after() method instead of blocking the program with sleep().
- Reading structured content from an external JSON file rather than hard-coding it into the script.
- Persisting simple data (a high score) to disk between separate runs of the program.
- Giving the player immediate visual feedback through colour changes, which made the game feel far more responsive.
- Possible Improvements
- Add more subjects and a larger question bank per difficulty level.
- Show a full answer review at the end, listing which questions were missed and the correct answers.
- Introduce a global leaderboard instead of a single local high score.
- Add sound effects and smoother animations for correct/incorrect feedback.
- Let the player choose the timer length per difficulty (e.g. more time on Hard questions).
- Conclusion
The Ultimate Science Quiz brought together several early Python skills — GUI design, timers, file I/O, and simple game logic — into one playable application. It shows an understanding of how to structure an interactive program around user actions and time-based events, and offers a clear base to build into a larger, content-rich quiz platform.
BRIAN NGIJU SWORO Page 3 
