-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigital Clock
More file actions
50 lines (37 loc) · 1.67 KB
/
Digital Clock
File metadata and controls
50 lines (37 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from tkinter import *
import time
clk = Tk()
clk.title("Clock")
clk.geometry("1350x700+0+0")
clk.config(bg="#0C1E28")
def clock():
hr = str(time.strftime("%H"))
mn = str(time.strftime("%M"))
sc = str(time.strftime("%S"))
# print(hr,mn,sc)
if int(hr)>12 and int (mn) > 0 :
lb_dn.config(text = "PM")
if int(hr) > 12:
hr = str(int(int(hr)-12))
lb_hr.config(text = hr)
lb_mn.config(text = mn)
lb_sc.config(text = sc)
lb_hr.after( 200, clock)
lb_hr = Label(clk,text= "12", font = ("Times 20 bold",75,'bold'),bg = "#087587", fg= "white")
lb_hr.place(x=350,y=200,width=150,height=150)
lb_hr_text = Label(clk, text = "HOUR", font = ("Times 20 bold",20,'bold'), bg = "#087587", fg= "white")
lb_hr_text.place(x=350,y=360,width=150,height= 50)
lb_mn = Label(clk,text= "12", font = ("Times 20 bold",75,'bold'),bg = "#008EA4", fg= "white")
lb_mn.place(x=520,y=200,width=150,height=150)
lb_mn_text = Label(clk, text = "MINUTE", font = ("Times 20 bold",20,'bold'), bg = "#008EA4", fg= "white")
lb_mn_text.place(x=520,y=360,width=150,height= 50)
lb_sc = Label(clk,text= "12", font = ("Times 20 bold",75,'bold'),bg = "#06B4BB", fg= "white")
lb_sc.place(x=690,y=200,width=150,height=150)
lb_sc_text = Label(clk, text = "SECOND", font = ("Times 20 bold",20,'bold'), bg = "#06B4BB", fg= "white")
lb_sc_text.place(x=690,y=360,width=150,height= 50)
lb_dn = Label(clk,text= "AM", font = ("Times 20 bold",70,'bold'),bg = "#9F0646", fg= "white")
lb_dn.place(x=860,y=200,width=150,height=150)
lb_dn_text = Label(clk, text = "NOON", font = ("Times 20 bold",20,'bold'), bg = "#9F0646", fg= "white")
lb_dn_text.place(x=860,y=360,width=150,height= 50)
clock()
clk.mainloop()