-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdigitalclock.py
More file actions
101 lines (77 loc) · 3.22 KB
/
digitalclock.py
File metadata and controls
101 lines (77 loc) · 3.22 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from tkinter import *
import datetime
def date_time():
time = datetime.datetime.now()
hr = time.strftime('%I')
mi = time.strftime('%M')
sec = time.strftime('%S')
am = time.strftime("%p")
date = time.strftime("%d")
month = time.strftime("%m")
year = time.strftime("%y")
day = time.strftime("%a")
lab_hr.config(text=hr)
lab_min.config(text=mi)
lab_sec.config(text=sec)
lab_am.config(text=am)
lab_date.config(text=date)
lab_mo.config(text=month)
lab_year.config(text=year)
lab_day.config(text=day)
lab_hr.after(1000, date_time)
clock = Tk()
clock.title(' Digital Clock')
clock.geometry('1000x50')
clock.config(bg='Aquamarine')
# ***** time
lab_hr=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_hr.place(x=120,y=50,height=110,width=100)
lab_hr_txt=Label(clock,text="Hour",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_hr_txt.place(x=120,y=190,height=40,width=100)
lab_min=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_min.place(x=340,y=50,height=110,width=100)
lab_min_txt=Label(clock,text="Min.",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_min_txt.place(x=340,y=190,height=40,width=100)
lab_sec=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_sec.place(x=560,y=50,height=110,width=100)
lab_sec_txt=Label(clock,text="Sec.",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_sec_txt.place(x=560,y=190,height=40,width=100)
lab_am=Label(clock,text="00",font=('Time New Roman',50,"bold"),
bg='red',fg="white")
lab_am.place(x=780,y=50,height=110,width=100)
lab_am_txt=Label(clock,text="AM/PM",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_am_txt.place(x=780,y=190,height=40,width=100)
# ***** date
lab_date=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_date.place(x=120,y=270,height=110,width=100)
lab_date_txt=Label(clock,text="Date",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_date_txt.place(x=120,y=410,height=40,width=100)
lab_mo=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_mo.place(x=340,y=270,height=110,width=100)
lab_mo_txt=Label(clock,text="Month.",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_mo_txt.place(x=340,y=410,height=40,width=100)
lab_year=Label(clock,text="00",font=('Time New Roman',60,"bold"),
bg='red',fg="white")
lab_year.place(x=560,y=270,height=110,width=100)
lab_year_txt=Label(clock,text="year",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_year_txt.place(x=560,y=410,height=40,width=100)
lab_day=Label(clock,text="00",font=('Time New Roman',35,"bold"),
bg='red',fg="white")
lab_day.place(x=780,y=270,height=110,width=100)
lab_day_txt=Label(clock,text="day",font=('Time New Roman',20,"bold"),
bg='red',fg="white")
lab_day_txt.place(x=780,y=410,height=40,width=100)
date_time()
clock.mainloop()