-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigitalClock.py
110 lines (78 loc) · 3.25 KB
/
digitalClock.py
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
# Make a digital clock in python
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(200,date_time)
clock = Tk()
clock.title("Digital Clock")
clock.geometry("1000x500")
clock.config(bg='black')
# ***** Time
lab_hr =Label(clock,text="00", font=("Times New Roman",60,"bold"),
bg="indigo", fg="white")
lab_hr.place(x=120,y=50,height=110,width=100)
lab_hr_txt =Label(clock,text="Hour", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_hr_txt.place(x=120,y=180,height=25,width=100)
lab_min =Label(clock,text="00", font=("Times New Roman",60,"bold"),
bg="indigo", fg="white")
lab_min.place(x=340,y=50,height=110,width=100)
lab_min_txt =Label(clock,text="Min", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_min_txt.place(x=340,y=180,height=25,width=100)
lab_sec =Label(clock,text="00", font=("Times New Roman",60,"bold"),
bg="indigo", fg="white")
lab_sec.place(x=560,y=50,height=110,width=100)
lab_sec_txt =Label(clock,text="Sec", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_sec_txt.place(x=560,y=180,height=25,width=100)
lab_am =Label(clock,text="00", font=("arial",40,"bold"),
bg="blue", fg="black")
lab_am.place(x=780,y=50,height=110,width=100)
lab_am_txt =Label(clock,text="AM/PM", font=("Times New Roman",16,"bold"),
bg="grey", fg="black")
lab_am_txt.place(x=780,y=180,height=25,width=100)
# **** Date
lab_date =Label(clock,text="00", font=("Times New Roman",35,"bold"),
bg="indigo", fg="white")
lab_date.place(x=120,y=300,height=80,width=100)
lab_date_txt =Label(clock,text="Date", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_date_txt.place(x=120,y=400,height=25,width=100)
lab_mo =Label(clock,text="00", font=("Times New Roman",35,"bold"),
bg="indigo", fg="white")
lab_mo.place(x=340,y=300,height=80,width=100)
lab_mo_txt =Label(clock,text="Month", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_mo_txt.place(x=340,y=400,height=25,width=100)
lab_year =Label(clock,text="00", font=("Times New Roman",35,"bold"),
bg="indigo", fg="white")
lab_year.place(x=560,y=300,height=80,width=100)
lab_year_txt =Label(clock,text="Year", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_year_txt.place(x=560,y=400,height=25,width=100)
lab_day =Label(clock,text="00", font=("arial",32,"bold"),
bg="blue", fg="black")
lab_day.place(x=780,y=300,height=80,width=100)
lab_day_txt =Label(clock,text="Day", font=("Times New Roman",18,"bold"),
bg="grey", fg="black")
lab_day_txt.place(x=780,y=400,height=25,width=100)
date_time()
clock.mainloop()