Skip to content

Commit

Permalink
Merge pull request #348 from harshit-3103/master
Browse files Browse the repository at this point in the history
DigitalClock.py
  • Loading branch information
simranlotey authored Oct 31, 2023
2 parents 6431d1b + 5997022 commit 8a64678
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions DigitalClock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#import all useful module in the program
from tkinter import *
import datetime
import time

# Create a window by using the Tkinter
root = Tk()

# write the Heading on the window
root.title('Digital Clock By HS')

# geomerty of the window
root.geometry('500x300')
# fixed the window
root.resizable(0,0)
# set the colour of backroundwindow
root.configure(background='black')

# create a Label Widget for print on the window
t1 = Label(root,text='Digital Clock',font=('Arial',30),fg='red',bg='black').place(x=140,y=0)


# create a function for finding the time
def clock():
l1=time.strftime("%H:%M:%S %p")
l2=Label(root,text=l1,font=('ds digital',40,'bold'),fg='light green',bg='black')
l2.after(200,clock)
l2.place(x=80,y=190)
l5=datetime.date.today()
l8=Label(root,text=l5.day,font=('ds digital',40,'bold'),fg='light green',bg='black').place(x=355,y=90)
l7=Label(root,text=l5.month,font=('ds digital',40,'bold'),fg='light green',bg='black').place(x=260,y=90)
l6=Label(root,text=l5.year,font=('ds digital',40,'bold'),fg='light green',bg='black').place(x=80,y=90)
l11=Label(root,text="DATE",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=355,y=160)
l10=Label(root,text="MONTH",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=235,y=160)
l9=Label(root,text="YEAR",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=90,y=160)
l12=Label(root,text="HOUR",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=80,y=260)
l13=Label(root,text="MIN",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=185,y=260)
l14=Label(root,text="SEC",font=('ds digital',15,'bold'),fg='light green',bg='black').place(x=280,y=260)

# clock function
clock()

# end the program
root.mainloop()

0 comments on commit 8a64678

Please sign in to comment.