mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-28 14:31:12 +00:00
25 lines
546 B
Markdown
25 lines
546 B
Markdown
|
# Digital Clock
|
||
|
## code
|
||
|
```
|
||
|
import tkinter
|
||
|
from time import strftime
|
||
|
|
||
|
top = tkinter.Tk()
|
||
|
top.title('Digital Clock')
|
||
|
top.resizable(0,0)
|
||
|
|
||
|
def time():
|
||
|
string = strftime('%H: %M: %S %p')
|
||
|
clockTime.config(text=string)
|
||
|
clockTime.after(1000, time)
|
||
|
|
||
|
clockTime = tkinter.Label(top, font=('courier new', 40),
|
||
|
background='white',foreground='black')
|
||
|
clockTime.pack(anchor='center')
|
||
|
time()
|
||
|
top.mainloop()
|
||
|
|
||
|
```
|
||
|
|
||
|
![Screenshot 2022-10-04 195233](https://user-images.githubusercontent.com/104223444/193844936-aee558c0-6b43-4096-9b9c-cc3ef23a29ed.png)
|