import tkinter as tk
from tkinter import Label
import time
def update_clock():
current_time = time.strftime("%H:%M:%S")
clock_label.config(text=current_time)
root.after(1000, update_clock) # update the time every second
# Create the main window
root = tk.Tk()
root.title("Digital Clock")
# Create and configure the clock label
clock_label = Label(root, font=("Arial", 50), bg="black", fg="white")
clock_label.pack(pady=20)
# Start the clock
update_clock()
# Run the application
root.mainloop()

Comments
Post a Comment