Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created January 8, 2021 19:24
Show Gist options
  • Save JayantGoel001/b70118b184aa168f8fd266c664eb42b0 to your computer and use it in GitHub Desktop.
Save JayantGoel001/b70118b184aa168f8fd266c664eb42b0 to your computer and use it in GitHub Desktop.
Creating A Digital Clock using tkinter
from tkinter import *
from time import strftime
def clock():
current_time = strftime('%H:%M:%S %p')
label.config(text=current_time)
label.after(1000, clock)
win = Tk()
win.title("Digital Clock")
label = Label(win, font=('sans', 80), background='black', foreground='white')
label.pack(anchor='center')
clock()
win.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment