Hi guys, In this article, I'm going to share with you how to build a digital clock using Python programming in just a few lines of code using the Tkinter and Time module. Requirements If you're on you don't really need to install anything since our simple digital clock app will be using only built-in modules and window OS time Tkinter But if you're running most of the time pre installed python interpreter doesn't come with the installed, therefore you might need to install it manually just as shown below; Linux OS Tkinter Installation sudo apt-get install python3-tk Now that everything is installed, lets's build our digital clock, Let's get started .... The idea is really simple, firstly we will create an empty window using the Tkinter, then we gonna and place a Label widget within our empty window, and then finally we will be updating the value of the label to be the current time after every 0.08s. configure getting current time .... Time module provides a variety of ways of getting time, In this article, we are going to use to parse the current time into the format. strftime() Hour: Minutes: Seconds Example of usage >> time >>time.strftime( ) import '%H:%M:%S' '18:10:53' Now lets add graphical interface Previous experience with the Tkinter library would be an advantage for you, but even if this is your first time still you can make it, the syntax is and straight forward. intuitive Making empty window with tkinter In making an empty clock window, we gonna use geometry () to specify the dimension of the displayed window, and at the end put to prevent the displayable window from exiting immediately. mainloop() tkinter Label, Tk window = Tk() window.title( ) window.geometry( ) window.resizable( , ) window.mainloop() from import #======= Configuring window ========= "digital clock" "200x200" False False #============ Logic lives here ======= When you run the above code, it will produce an interface like this; Adding some logic to our code .. Now that we have our empty window, let's now add a label to place our time information together with a function to update the value on the label every 80 milliseconds. clock_label.place(x = , y = ) def update_label(): current_time = strftime( ) clock_label.configure(text = current_time) clock_label.after( , update_label) update_label() 20 20 '%H: %M: %S' 80 why 80 milliseconds? According to research human brain can only process 12 separate images per second, anything more than that it will be perceived as a single picture, this is what causes the illusion of motion. Below is the full code of our digital clock, with you, can try changing the code parameter the way you would like and then press run again. time strftime tkinter Label, Tk #======= Configuring ========= = Tk() .title( ) .geometry( ) .configure(bg= ) .resizable(False, False) clock_label = Label( , bg= , fg= , font = ( , , ), relief= ) clock_label.place(x = , y = ) def update_label(): current_time = strftime( ) clock_label.configure(text = current_time) clock_label.after( , update_label) update_label() .mainloop() from import from import window window window "" window "200x80" window "green" window window "green" "white" "Times" 30 'bold' 'flat' 20 20 '%H: %M: %S' 80 window Once you run the above lines of code, you should be seeing a widget with clock details rendered on your machine similar to that screenshot below; Well that's the end of our tutorial, Follow me on Twiter Based on your interest I recommend you to also check these; How to make a music player in python How to track phone number in Python How to make a python GUI calculator in Python How to make a guessing game in Python How to program Arduino board with Python How to build a website blocker in Python Previously published at https://kalebujordan.com/how-to-make-a-digital-clock-in-python/