World Digital Clock

A Python desktop application that displays the current time in multiple configurable time zones, updating every second.

Screenshot of the World Digital Clock showing 6 timezone cards

Features

  • Displays clocks for 6 configurable time zones (UTC, New York, London, Berlin, Tokyo, Sydney) — easy to customise
  • Updates every second with a live seconds display
  • Clean dark-theme UI built with Tkinter (Python standard library — no extra GUI installation needed)
  • Uses zoneinfo (Python 3.9+ standard library) with automatic fallback to pytz for older Python versions
  • Lightweight: zero mandatory third-party GUI dependencies

Requirements

Requirement Version
Python 3.6+ (3.9+ recommended)
Tkinter bundled with most Python installations
pytz required on Python < 3.9; optional on 3.9+

Installing Tkinter

Tkinter is included with the official Python installer on Windows and macOS. On Linux you may need to install it separately:

1
2
3
4
5
6
7
8
# Debian / Ubuntu
sudo apt-get install python3-tk

# Fedora / RHEL
sudo dnf install python3-tkinter

# Arch Linux
sudo pacman -S tk

Setup

1
2
3
4
5
6
7
8
9
10
# 1. Clone the repository (if not already done)
git clone https://github.com/LGLenz/PacTerraformPaC.git
cd PacTerraformPaC/digital_clock

# 2. (Optional) Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate

# 3. Install dependencies (only pytz — not needed on Python 3.9+)
pip install -r requirements.txt

Running the App

1
python clock.py

The clock window will open immediately and refresh every second.


Customising Time Zones

Edit the TIME_ZONES list near the top of clock.py:

1
2
3
4
5
6
7
8
TIME_ZONES: list[tuple[str, str]] = [
    ("UTC",                "UTC"),
    ("America/New_York",   "New York"),
    ("Europe/London",      "London"),
    ("Europe/Berlin",      "Berlin"),
    ("Asia/Tokyo",         "Tokyo"),
    ("Australia/Sydney",   "Sydney"),
]

Use any IANA time zone name (e.g. "America/Los_Angeles", "Asia/Kolkata", "Pacific/Auckland"). A full list is available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.


Mobile Packaging with Kivy (Bonus)

Kivy is a Python framework that can target Android and iOS as well as the desktop. Below is a sketch of how to migrate the clock to Kivy and package it for mobile.

1. Rewrite the UI in Kivy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# digital_clock/clock_kivy.py  (illustrative)
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.clock import Clock
from datetime import datetime
from zoneinfo import ZoneInfo

TIME_ZONES = [
    ("UTC",              "UTC"),
    ("America/New_York", "New York"),
    ("Europe/London",    "London"),
    ("Europe/Berlin",    "Berlin"),
    ("Asia/Tokyo",       "Tokyo"),
]

class ClockGrid(GridLayout):
    def __init__(self, **kwargs):
        super().__init__(cols=2, **kwargs)
        self.labels = {}
        for tz, city in TIME_ZONES:
            self.add_widget(Label(text=city, bold=True))
            lbl = Label(text="--:--:--")
            self.labels[tz] = lbl
            self.add_widget(lbl)
        Clock.schedule_interval(self.update, 1)

    def update(self, _dt):
        for tz, lbl in self.labels.items():
            lbl.text = datetime.now(ZoneInfo(tz)).strftime("%H:%M:%S")

class WorldClockApp(App):
    def build(self):
        return ClockGrid()

if __name__ == "__main__":
    WorldClockApp().run()

2. Install build tools

1
pip install kivy buildozer   # Linux build host required for Android

3. Build for Android

1
2
3
4
cd digital_clock
buildozer init               # generates buildozer.spec
# Edit buildozer.spec: set title, package.name, requirements = kivy,python3
buildozer -v android debug   # produces an APK in bin/

4. Build for iOS

Requires macOS with Xcode installed:

1
2
3
4
pip install kivy-ios
toolchain build kivy
toolchain create WorldClock .
open WorldClock-ios/WorldClock.xcodeproj

Note: Kivy mobile builds require a Linux/macOS machine. The Tkinter desktop version runs on any platform without additional build steps.


University of Plymouth · Cybersecurity PhD · Elias Lenz