Coders Packet

Digital Clock with Tkinter using Python

By Mriganka Paul

Made with Tkinter and Python This is a Digital Clock that displays time on your Desktop.

How awesome will it be to see a digital clock running on your desktop?

Um, pretty normal right?

But what if I tell you that you can make your own digital clock? How awesome will it be?

Every time you see it, you will be reminded that yes you made it........and u are capable of achieving anything:)

Well, enough motivation.....let's see how easy it is to create your own digital clock with Tkinter & python.

 

Firstly, you need to download the font given on your desktop from the zip file attached.

Then open the python prompt and type the following code:

from tkinter import *
from tkinter.ttk import *
from time import strftime

w=Tk()
w.title("Digital-Clock")

def time():
    str=strftime('%H:%M:%S %p')
    label.config(text=str)
    label.after(1000, time)

label=Label(w,font=("ds-digital",80),background='black',foreground="cyan")
label.pack(anchor='center')
time()

mainloop()

 

Now, that the code is written, open cmd and type the python file name.

 

I will attach a video in the zip file of this packet regarding the demo, so make sure you watch it, by downloading the packet.

I hope it helps.

Download Complete Code

Comments

No comments yet