Skip to content

Commit efc78d0

Browse files
committed
Added Digital Clock GUI project using Tkinter
1 parent c17dce6 commit efc78d0

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Digital_clock/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 🕒 Digital Clock GUI
2+
3+
A simple digital clock built using **Python** and **Tkinter** that shows the current time and date, updating automatically every second.
4+
5+
## 🚀 Features
6+
- Displays real-time **HH:MM:SS** format
7+
- Shows **current date**
8+
- Updates automatically every second
9+
- Clean and minimal UI
10+
11+
## 🧑‍💻 Tech Stack
12+
- **Python**
13+
- **Tkinter**

Digital_clock/main.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import tkinter as tk
2+
import time
3+
from datetime import datetime
4+
5+
# Create main window
6+
root = tk.Tk()
7+
root.title("Digital Clock")
8+
root.geometry("400x200")
9+
root.resizable(False, False)
10+
root.config(bg="#1e1e1e")
11+
12+
# Time label
13+
time_label = tk.Label(root, text="", font=("Segoe UI", 48, "bold"), fg="#00ff99", bg="#1e1e1e")
14+
time_label.pack(pady=20)
15+
16+
# Date label
17+
date_label = tk.Label(root, text="", font=("Segoe UI", 16), fg="#ffffff", bg="#1e1e1e")
18+
date_label.pack()
19+
20+
# Function to update time and date
21+
def update_clock():
22+
current_time = time.strftime("%H:%M:%S")
23+
current_date = datetime.now().strftime("%A, %d %B %Y")
24+
25+
time_label.config(text=current_time)
26+
date_label.config(text=current_date)
27+
28+
root.after(1000, update_clock) # Update every 1 second
29+
30+
# Start the clock
31+
update_clock()
32+
33+
# Run the application
34+
root.mainloop()

0 commit comments

Comments
 (0)