GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Python Digital Clock Project

Gk Scientist December 24, 2022 No Comments
Tweet WhatsApp Telegram

Python Digital Clock Project:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) Open the PyCharm code editor and create a new project in it. We named the project digital_clock.py. To build a Digital Clock in Python we need to install the package. For this open the terminal in PyCharm and install one package i.e. tkinter. You install this package by simply typing in the terminal following command i.e. pip install tk and then press enter as shown below.

pip install tk for digital clock - Python Digital Clock Project

Note: f the package shows an error while using in the code, you can simply install the package by clicking on the red bulb which appears below the error and you can directly install the package from here.

(2) Now write the following code for creating Python Digital Clock Project as shown below.

Python Digital Clock Code 1 - Python Digital Clock Project
Python Digital Clock Code 2 - Python Digital Clock Project

Python Digital Clock Project Source Code:

from tkinter import *
from time import *

def update():
time_str = strftime("%I:%M:%S %p")
time_label.config(text=time_str)

day_str = strftime("%A")
day_label.config(text=day_str)

date_str = strftime("%B %d, %Y")
date_label.config(text=date_str)

clock_window.after(1000,update)

clock_window = Tk()
clock_window.geometry("330x170")
clock_window.title("Digital Clock")
clock_window.config(bg="#CCE3DE")
clock_window.resizable(False,False)

time_label=Label(clock_window,font=("Open Sans",40),bg="#CCE3DE",fg="#00296B")
time_label.pack()

day_label=Label(clock_window,font=("Open Sans",30),bg="#00296B",fg="#CCE3DE")
day_label.pack()

date_label=Label(clock_window,font=("Open Sans",20),bg="#CCE3DE",fg="#00296B")
date_label.pack()

update()

clock_window.mainloop()

(3) After running the code, the output window will pop us as shown below.

python digital clock - Python Digital Clock Project

Tutorial MySQL
Tutorial Python
Tokens in C++
Database Management System (DBMS)
Applications of Computer
Basic Components of Computer System
Python (programming language)– Wikipedia
Prev Article
Next Article

Related Articles

Python SQLite Search Query
Python SQLite Search Query: We can use the PyCharm code …
Gk Scientist December 9, 2022 Computer

Python SQLite Search Query

MySQL LIKE Operator
MySQL LIKE Operator: Example of MySQL LIKE Operator: Example of …
Gk Scientist November 14, 2022 Computer

MySQL LIKE Operator

Python MySQL IN Operator
Python MySQL IN Operator: (1) The IN operator is used …
Gk Scientist December 16, 2022 Computer

Python MySQL IN Operator

Polymorphism in Python
Polymorphism in Python: We can use the PyCharm code editor …
Gk Scientist December 6, 2022 Computer

Polymorphism in Python

How to Create Variables in Python
Create Variables in Python: We can use the PyCharm code …
Gk Scientist November 21, 2022 Computer

How to Create Variables in Python

Java for-each Loop
Java for-each Loop: We can use the Eclipse IDE for …
Gk Scientist January 6, 2023 Computer

Java for-each Loop

Java String Methods
Java String Methods: We can use the Eclipse IDE for this …
Gk Scientist January 3, 2023 Computer

Java String Methods

Cloud Computing
What is Cloud Computing? Cloud computing in simple terms refers …
Gk Scientist October 1, 2022 Computer

Cloud Computing

Leave a Reply Cancel Reply

Search

  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (215) Current Affairs (4) Current Content (0) Economy (15) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...