A simple yet elegant GUI-based digital clock that displays the current time and date. Features a classic matrix-style green-on-black design that updates in real-time.
- Real-time clock display (HH:MM:SS format)
- Date display (DD-MM-YYYY format)
- Matrix-style appearance (green on black)
- Fast refresh rate (80ms)
- Clean and minimalist design
- Non-resizable window for consistent appearance
- Language: Python
- Libraries:
tkinter(standard library - Label, Tk)time(standard library - strftime)tk==0.1.0
- Complexity: Beginner
# Install dependencies
pip install -r requirements.txt
# Run the program
python main.pySimply run the application:
python main.pyThe clock will display:
14:35:27
11-10-2025
- Window Setup: Creates 400x150 pixel window with black background
- Label Creation: Large label with green text on black background
- Time Update Loop:
- Get current time using
strftime("%H:%M:%S") - Get current date using
strftime("%d-%m-%Y") - Update label text
- Schedule next update after 80ms using
after()
- Get current time using
- HH: Hours (00-23, 24-hour format)
- MM: Minutes (00-59)
- SS: Seconds (00-59)
- DD: Day (01-31)
- MM: Month (01-12)
- YYYY: Year (4 digits)
time_string = strftime("%I:%M:%S %p") # 02:35:27 PMdate_string = strftime("%B %d, %Y") # October 11, 2025
date_string = strftime("%m/%d/%Y") # 10/11/2025
date_string = strftime("%Y-%m-%d") # 2025-10-11# Blue on white
self.root.config(bg="white")
self.clock_label.config(bg="white", fg="blue")
# Red on dark gray
self.root.config(bg="#2c3e50")
self.clock_label.config(bg="#2c3e50", fg="#e74c3c")self.clock_label = tk.Label(
self.root,
font=("Courier", 50, "bold"), # Different font and size
bg="black",
fg="green"
)self.root.geometry("600x200") # Larger windowtime_string = strftime("%H:%M:%S")
date_string = strftime("%A, %d-%m-%Y") # Monday, 11-10-2025- Tkinter GUI basics
- Time formatting with
strftime() - Event-driven programming with
after() - Label widget configuration
- Window customization
- Multiple time zones
- Alarm functionality
- Stopwatch mode
- Timer mode
- Theme selection (colors)
- Font size adjustment
- Always-on-top option
- System tray integration
- Analog clock option
- World clock (multiple cities)
| Code | Meaning | Example |
|---|---|---|
| %H | Hour (24-hour) | 14 |
| %I | Hour (12-hour) | 02 |
| %M | Minute | 35 |
| %S | Second | 27 |
| %p | AM/PM | PM |
| %d | Day | 11 |
| %m | Month (number) | 10 |
| %B | Month (name) | October |
| %Y | Year (4 digits) | 2025 |
| %A | Weekday (full) | Saturday |
| %a | Weekday (short) | Sat |
This project is open source and available for educational purposes.