forked from DigiScore/wolff1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.py
More file actions
35 lines (27 loc) · 750 Bytes
/
clock.py
File metadata and controls
35 lines (27 loc) · 750 Bytes
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
# importing whole module
from tkinter import *
from tkinter.ttk import *
# importing strftime function to
# retrieve system's time
from time import strftime
from datetime import datetime
# creating tkinter window
root = Tk()
root.title('Clock')
# This function is used to
# display time on the label
def time():
# string = strftime('%H:%M:%S')
string = datetime.now().strftime('%H:%M:%S.%f')[:-3]
lbl.config(text=string)
lbl.after(10, time)
# Styling the label widget so that clock
# will look more attractive
lbl = Label(root, font=('calibri', 250, 'bold'),
background='black',
foreground='white')
# Placing clock at the centre
# of the tkinter window
lbl.pack(anchor='center')
time()
mainloop()