Header Ads

Header ADS

Digital clock in python using tkinter and time library

How to make a digital clock in python using tkinter and time library.


In this post i am going to show you how should you make a working digital clock using Tkinter and time library.

this code contains only in 13 lines of codes,hope you like it.

The GUI of the project :


This project of digital clock uses Time library to fetch The current time from your desktop and using Label widget of Tkinter library , i am displaying the current time .

strftime() function of time module helps to fetch the current time and a after( ) function updates the contents of display every 200 miliseconds .

" The strftime(format_str) uses the specified format string to convert a date/time object to formulate strings."

The working Clip of the project:



This is the full code for this project :



CODE                                                                   DISCRIPTION                        EXAMPLES
%a
Abbreviated weekday name
sat
%A
Full weekday name
Saturday
%b
Abbreviated month name
oct
%B
Full month name
October
%d
Zero-padded day of month as number
01
%H
Hours in 24-hour format
14
%I
Hours in 12-hours format
01
%M
Minutes as numbrer
54
%S
Seconds as number
12
%p
For Am / Pm facility
Am
%f
MIcroseconds
0153219
%X
Time formatted as locale
01:15:15








No comments

Powered by Blogger.