Sunday, 23 January 2022

Write a Python GUI to create a digital clock with a tkinter to display the time.

Write a Python GUI to create a digital clock with a tkinter to display the time.

Slip 2 Q 2

CODE :




from tkinter import *
from tkinter.ttk import *
 
from time import strftime  
 
root = Tk()
root.title('Clock')

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

lbl = Label(root, font = ('calibri', 40, 'bold'),
            background = 'purple',
            foreground = 'white')
 
lbl.pack(anchor = 'center')  
time()  
 
mainloop()


OUTPUT :







No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...