Coders Packet

Simple Digital Clock Using Tkinter Python

By Kaushik karthikeyan K

  • time.py
  • time.wmv
  • This project is to develop a simple digital clock using Python Language, By importing the Tkinter package. Tkinter is used to develop GUI applications. This is a really cool and simple project.

                                             Simple Digital Clock Using Tkinter Python

     

    This project focus on the idea to create a simple digital clock using Python Language, By importing the Tkinter package. Tkinter is used to develop GUI applications.

    Requirements:

    Python Any Versions

    Tkinter Module

    Time Module

    Coding:

    # Importing Neccesary Modules
    from tkinter import * from time import strftime
    root = Tk()  # This command Creates tkinter window
    root.title("Simple Digital Clock")  # By Using this Command we can add title/Headings to tkinter window
    
    
    # Creating a Function to display time on the label
    def time():
        Time = strftime("%H:%M%p ")
        lbl.config(text = Time)
        lbl.after(1000, time)
    
    # Customize the clock based on user using below attributes.
    lbl = Label(root, font = ("arial", 120, "bold"),bg="grey",fg="black")
    
    # Alignment and extra features can be set by Pack module
    lbl.pack(anchor = "center",fill = "both",expand=1)
    
    time()  # Calling Time Function
    
    mainloop()   # This line runs the application program
    

     

    Output:

    output

    What we Learnt:

    In this project, we learnt about the basics of GUI application using Python Tkinter and the use of the Time module.

    Download Complete Code

    Comments

    No comments yet