Capitals of the World
A polished local desktop geography quiz app that helps users master world capitals through regional practice groups, bidirectional quiz modes, optional flag prompts, accent-tolerant answer checking, score tracking, zoom controls, Google Maps lookup, and distributable desktop builds for macOS and Windows.
Capitals of the World is a Python desktop application for learning and practising country-capital knowledge. The app presents one country or capital at a time, accepts typed answers, checks them against a curated dataset of valid spellings and alternate capitals, and gives instant feedback with running correct and incorrect counters. The latest master version includes the full user experience: grouped geography practice, country-to-capital mode, capital-to-country mode, a custom flags on/off toggle, scalable UI controls, answer reveal, keyboard shortcuts, and Google Maps search for the current prompt.
The project was built to make memorising world capitals more interactive, repeatable, and focused than reading from a list or using generic flashcards. The dataset is modelled to accept practical variations like alternate spellings, accented and non-accented versions, short forms, and multiple official or administrative capitals, instead of forcing one brittle spelling. A secondary goal was to make the project feel like a finished desktop product: custom dark UI styling, rounded Canvas-based controls, local flag assets, zoom options, score tracking, keyboard shortcuts, and PyInstaller packaging were added so the app feels smooth enough to use as a daily macOS utility.
Bidirectional practice
Switch between country-to-capital and capital-to-country recall, training memory in both directions.
Regional practice groups
Practise the full All (World) dataset or focus on Africa, Asia, Europe, the Americas, Caribbean, Oceania, or Territories / Other.
Flags on/off toggle
Local PNG flag prompts can be turned on for visual learning, or off for a stricter text-only capitals quiz.
Accent-tolerant matching
Accent-insensitive, punctuation-tolerant answer checking with multiple accepted variants for tricky names.
Non-repeating quiz engine
Shuffled queue serves each item once before reshuffling, and avoids starting a new cycle with the same country.
Packaged desktop builds
PyInstaller produces a self-contained macOS .app or Windows .exe with bundled flag assets, runtime, and app icon.
Starting the app
During development the user can run the master Python file directly. For normal use, the user opens the packaged macOS .app or Windows .exe, which contains the Python runtime, Tkinter dependencies, app code, data modules, and flag assets.
Choosing a group and generating questions
The group dropdown updates the active dataset, clears the current shuffled order, resets the score, and updates the displayed group count. The quiz then shuffles the active dataset into an internal order and advances through it one row at a time, each row being a country with its list of accepted capitals.
Answering, flags, and Google Maps
Typed answers are normalized (lowercased, stripped, accent-free, punctuation-free) before comparison, so Sao Tome and São Tomé both match. When flags are enabled, the app loads the matching local PNG. The Show on Map button opens a Google Maps search for the current country or capital in the user's browser.
- Accent-insensitive validation. The normalize() helper removes accent marks using Unicode decomposition, strips punctuation, lowercases input, and collapses whitespace before comparing answers.
- Multiple accepted answers per country, so the app supports variants like Kyiv / Kiev, Bogota / Bogotá, Dhaka / Dacca, and short-form Saint / St spellings.
- Real-world multi-capital cases. The dataset intentionally includes official, administrative, legislative, and judicial capital distinctions for places like Bolivia, South Africa, Sri Lanka, Yemen, Eswatini, Ivory Coast, and the Netherlands.
- Non-repeat randomization. The app shuffles once, walks through the queue, then reshuffles when exhausted, avoiding an immediate repeat across shuffle boundaries.
- Runtime-safe asset resolution. The flag path resolver searches development and packaged-app locations, including PyInstaller _MEIPASS and macOS bundle resources.
- Complete active flag coverage. The All (World) dataset has no missing ALPHA2 mappings and no missing flag PNG files in Flags Adjusted/.
- Zoom-driven rebuild. Zoom changes rebuild the central card rather than only changing one or two font sizes, keeping the layout coherent across sizes.
- Local-first architecture. Quiz data and flags are local files. The quiz itself does not require internet access; the only internet-adjacent feature is the optional Google Maps button.
Practical desktop app development
The project turns a learning workflow into a usable local desktop application with custom UI controls, keyboard shortcuts, state management, scoring, zoom, local assets, and app packaging.
Careful data modelling
Real geography is not always one-to-one. The dataset handles alternate spellings, accented names, administrative and official capitals, multi-capital countries, territories, overseas regions, and special political/geographic cases.
User-focused iteration
Features such as regional groups, reverse mode, flags on/off, answer reveal, zoom controls, and Google Maps lookup reflect actual study needs discovered through use.
Robust input handling
The app is forgiving about accents and punctuation while still requiring the correct underlying answer, which makes the quiz practical for fast typing and repeated practice.
Asset and packaging awareness
The flag loader works both when running the Python script directly and when running from a packaged PyInstaller desktop environment, a key detail for shipping the app as a macOS .app or Windows .exe.
Finished-product mindset
The app includes polish that users notice: a cohesive dark visual style, responsive card sizing, hover/click button states, clear feedback, score counters, and a proper application icon.
Pricing
One simple price for the full Capitals of the World desktop app, ready to install and use on macOS or Windows.
Capitals App
$59
The complete desktop quiz app with all regions, modes, flags, and zoom controls. One-time payment, no subscription.
- macOS .app and Windows .exe builds
- Full All (World) dataset, 258 quiz rows
- Country-to-capital and capital-to-country modes
- Regional practice groups
- Flags on/off toggle with local flag assets
- Accent-tolerant answer checking
- Zoom controls and keyboard shortcuts
- Lifetime use, no subscription
