-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdigital_clock.py
More file actions
126 lines (77 loc) · 3.42 KB
/
digital_clock.py
File metadata and controls
126 lines (77 loc) · 3.42 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from tkinter import *
import datetime
def date_time():
time = datetime.datetime.now()
hr = time.strftime('%I')
mi = time.strftime('%M')
se = 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=se)
lab_am.config(text=am)
lab_date.config(text=date)
lab_mo.config(text=month)
lab_yr.config(text=year)
lab_day.config(text=day)
lab_hr.after(200,date_time)
clock = Tk()
clock.title(' ****Digital Clock****')
clock.geometry('1000x500')
clock.config(bg='black')
# ***********time*************
lab_hr=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
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='white',fg="black")
lab_hr_txt.place(x=120,y=190,height=40,width=100)
lab_min=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
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='white',fg="black")
lab_min_txt.place(x=340,y=190,height=40,width=100)
lab_sec=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
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='white',fg="black")
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='white',fg="black")
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='white',fg="black")
lab_am_txt.place(x=780,y=190,height=40,width=100)
# *************date*****************
lab_date=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
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='white',fg="black")
lab_date_txt.place(x=120,y=410,height=40,width=100)
lab_mo=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
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='white',fg="black")
lab_mo_txt.place(x=340,y=410,height=40,width=100)
lab_yr=Label(clock,text='00',font=('Time New Roman',50,"bold"),
bg='white',fg="black")
lab_yr.place(x=560,y=270,height=110,width=100)
lab_yr_txt=Label(clock,text='Year',font=('Time New Roman',20,"bold"),
bg='white',fg="black")
lab_yr_txt.place(x=560,y=410,height=40,width=100)
lab_day=Label(clock,text='00',font=('Time New Roman',35,"bold"),
bg='white',fg="black")
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='white',fg="black")
lab_day_txt.place(x=780,y=410,height=40,width=100)
date_time()
clock.mainloop()