0% found this document useful (0 votes)
35 views

PWP Report

The document outlines the process of developing a digital clock using Python. It discusses using modules like tkinter and time to create a functional clock application. It provides details on researching modules and packages, implementing the clock program, and outputs of the program like the code and learning outcomes.

Uploaded by

Priya Narsugade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

PWP Report

The document outlines the process of developing a digital clock using Python. It discusses using modules like tkinter and time to create a functional clock application. It provides details on researching modules and packages, implementing the clock program, and outputs of the program like the code and learning outcomes.

Uploaded by

Priya Narsugade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Develop a Digital Clock

1.0 Rationale:
This report aims to outline the process of developing a digital clock using Python. By leveraging Python's
versatile programming capabilities, this project seeks to create a functional and user-friendly digital clock
application. Through detailed exploration of Python libraries and programming techniques, this report will
provide a comprehensive guide to building a reliable digital timekeeping solution.

2.0 Aim/Benefits of the Micro-Project:


To develop a digital clock using Python.

Benefits:

1. It provides accuracy.
2. Feasible in low light.

3.0 Course Outcomes Addressed:


1. Develop functions for given problem.

4.0 Literature Review:

Sr.No Book Name Author Searched Information

1. “Programming With Python” Mr. Ravi Mathija Concept of Modules and


Packages

5.0 Actual Methodology Followed:


1. Literature Search:
MODULES:

A document with definitions of functions and various statements written in Python is called a
Python module. In Python, we can define a module in one of 3 ways:

o Python itself allows for the creation of modules.


o Similar to the re (regular expression) module, a module can be primarily written in C
programming language and then dynamically inserted at run-time.

1
Develop a Digital Clock

o A built-in module, such as the itertools module, is inherently included in the interpreter.

A module is a file containing Python code, definitions of functions, statements, or classes. An


example_module.py file is a module we will create and whose name is example_module.

We employ modules to divide complicated programs into smaller, more understandable pieces.

Modules also allow for the reuse of code.

Rather than duplicating their definitions into several applications, we may define our most
frequently used functions in a separate module and then import the complete module.

PACKAGES

A package is considered a collection of tools that allows the programmers to initiate the code. A
Python package acts as a user-variable interface for any source code.

This feature allows a Python package to work at a defined time for any functional script in the
runtime.

A package is a container that contains various functions to perform specific tasks. For example,
the math package includes the sqrt() function to perform the square root of a number.

While working on big projects, we have to deal with a large amount of code, and writing
everything together in the same file will make our code look messy.

Instead, we can separate our code into multiple files by keeping the related code together in
packages.

Understanding the differences between Python Modules and Packages

A Package consists of the __init__.py file for each user-oriented script. However, the same
does not apply to the modules in runtime for any script specified to the users.

A module is a file that contains a Python script in runtime for the code specified to the users.
A package also modifies the user interpreted code in such a manner that it gets easily
operated in the runtime.

2
Develop a Digital Clock

Tkinter

Python offers multiple options for developing GUI (Graphical User Interface). Out of all the
GUI methods, tkinter is the most commonly used method.

It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python tkinter is
the fastest and easiest way to create GUI applications. Creating a GUI using tkinter is an easy
task
.
To create a tkinter Python app:
1. Importing the module – tkinter
2. Create the main window (container)
3. Add any number of widgets to the main window
4. Apply the event Trigger on the widgets.

There are two main methods used which the user needs to remember while creating the Python
application with GUI.

i. Tk(screenName=None, baseName=None, className=’Tk’, useTk=1):


To create a main window, tkinter offers this method . To change the name of the
window, you can change the className to the desired one.

ii. mainloop(): There is a method known by the name mainloop() is used when your
application is ready to run. mainloop() is an infinite loop used to run the application, wait
for an event to occur and process the event as long as the window is not closed.

Time Module

We can always use Python's built-in time module whenever dealing with time-related tasks. There
are several ways to represent time in code, including numbers, strings, and objects.

It also has additional features like the ability to get the current time, wait until the code executes,
pause programme execution, and measure the code's effectiveness.

Python's time module is a very practical tool for manipulating functions and objects that deal with
time. Therefore, we must first import the module in order to begin using the time module in Python.

Python's time module offers functions for dealing with time-related tasks.

The important concept , when dealing with Python time, you’re considering a period of time
identified by a starting point. In computing, you call this starting point the epoch.

3
Develop a Digital Clock

The epoch, then, is the starting point against which you can measure the passage of time.

You may want to convert the Python time, represented as the number of elapsed seconds since the
epoch, to a string. You can do so using ctime()

The string representation of time, also known as a timestamp, returned by ctime() is formatted
with the following structure:

1. Day of the week: Mon (Monday)


2. Month of the year: Feb (February)
3. Day of the month: 25
4. Hours, minutes, and seconds using the 24-hour clock notation: 19:11:59
5. Year: 2019

2. Implementation:

Understood the working of tkinter and time modules. We studied about different methods
associated with these modules and built a program of digital clock that takes the system time and
displays it accurately.

6.0 Actual Resourced used:

Sr.No Name of Resource/material Specifications

1 Computer system Computer system with


1. Storage of 500 GB
2. RAM 4 GB
1.

2 Operating System Window 11


3 Python IDLE Version 3.12

4
Develop a Digital Clock
7.0 Outputs of the Micro-Project:
Program Code:

#24-HOURS CLOCK

from tkinter import Label, Tk

import time

app_window = Tk()

app_window.title("Digital Clock")

app_window.geometry("420x150")

app_window.resizable(2,2)

text_font= ("Boulder", 68, 'bold')

background = "yellow"

foreground= "black"

border_width = 25

label = Label(app_window, font=text_font, bg=background, fg=foreground, bd=border_width)

label.grid(row=0, column=1)

def digital_clock():

time_live = time.strftime("%H:%M:%S")

label.config(text=time_live)

label.after(200, digital_clock)

digital_clock()

app_window.mainloop()

5
Develop a Digital Clock

Output:

8.0 Skill Developed / Learning outcome of this Micro-Project:

1. Understood the use and concept of various built-in modules and packages in python.
2. Able to implement the knowledge of tkinter and time module practically.

9.0 Application of this Micro-Project:

1. Used in all kinds of electronic devices such as Radios, Television, Microwaves, Computers and
cell phones.
2. Used probably in many places such as schools, hospitals, offices in order to get accurate time in
hours, minutes and seconds.

10.0 References:

1. Book- “Programming with Python” by Mr.Ravi Mathija

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy