forked from flatplanet/Intro-To-TKinter-Youtube-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.py
41 lines (25 loc) · 802 Bytes
/
clock.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
from tkinter import *
import time
root = Tk()
root.title('Codemy.com')
root.iconbitmap('c:/gui/codemy.ico')
root.geometry("600x400")
def clock():
hour = time.strftime("%I")
minute = time.strftime("%M")
second = time.strftime("%S")
day = time.strftime("%A")
am_pm = time.strftime("%p")
time_zone = time.strftime("%Z")
my_label.config(text=hour + ":" + minute + ":" + second + " " + am_pm)
my_label.after(1000, clock)
my_label2.config(text=time_zone + " " + day)
def update():
my_label.config(text="New Text")
my_label = Label(root, text="", font=("Helvetica", 48), fg="green", bg="black")
my_label.pack(pady=20)
my_label2 = Label(root, text="", font=("Helvetica", 14))
my_label2.pack(pady=10)
clock()
#my_label.after(5000, update)
root.mainloop()