Python Micro-project Hari
Python Micro-project Hari
INDEX
3) Requirements 8
4) Application 10
5) Advantages / Disadvantages 12
7) Coding 14
8) Output / Screenshots 19
9) Conclusion 21
10) Reference 22
Chapter 1
INTRODUCTION
A countdown timer is a tool used to measure the passage of time by
counting down from a specified duration to zero. It's commonly employed in
various contexts, including:
Chapter 2
2. Design Considerations:
• Literature may discuss the design principles and factors influencing
the effectiveness of countdown timers, including visual design,
auditory cues, user interface elements, and interaction design.
• Research may examine the impact of countdown timer
characteristics, such as duration, granularity, countdown format, and
feedback mechanisms, on user experience and task performance.
5. Technological Implementations:
• Research may explore various technological approaches to
implementing countdown timers, including software libraries,
programming languages, frameworks, and hardware devices.
• Studies may compare different implementation methods in terms of
flexibility, scalability, resource efficiency, platform compatibility,
and ease of integration with existing systems.
Chapter 3
REQUIREMENTS
The requirements of a countdown timer can vary depending on its intended use
and context. However, here are some common requirements that developers may
consider when designing and implementing a countdown timer:
3. Visual Feedback: The timer should provide clear and intuitive visual
feedback to indicate the remaining time, such as a numerical display of
minutes and seconds, progress bar, or graphical representation.
10. Integration: For developers integrating the countdown timer into larger
systems or applications, it should provide clear documentation, well-
defined APIs, and support for common programming languages and
frameworks.
Chapter 4
APPLICATION
Countdown timers find applications in various domains and can be utilized for
numerous purposes. Some common applications include:
8. Sports Events: Countdown timers are used in sporting events, races, and
tournaments to signal the start or end of matches, races, or game intervals.
They help athletes, referees, and spectators track time and anticipate key
moments during the event.
Chapter 5
ADVANTAGES
a) Time Management
b) Productivity Enhancement
c) Task Allocation
d) Goal Setting
e) Engagement
f) Precision
g) Feedback
h) Awareness Time
DISADVANTAGES
a) Stress and Pressure
b) Over - Reliance
c) Rigidity
d) Distraction
e) Loss of Focus
f) Inaccuracy
g) Pressure to Platform
h) Accessibility
Chapter 6
SOFTWARE REQUIREMENTS
HARDWARE REQUIREMENTS
Chapter 7
CODING
import time
from tkinter import *
import multiprocessing
from tkinter import ttk, messagebox
from threading import *
# Hour list
hour_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24]
# Minute List
min_sec_list = [0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59,]
class CountDown:
# Tkinter Labels
time_label = Label(self.window, text="Set Time",
font=("times new roman",20, "bold"), bg='gray35',fg='yellow')
time_label.place(x=180, y=30)
# Tkinter Comboboxes
# Combobox for hours
self.hour = IntVar()
self.hour_combobox = ttk.Combobox(self.window, width=8,
height=10, textvariable=self.hour,
font=("times new roman",15))
self.hour_combobox['values'] = hour_list
self.hour_combobox.current(0)
self.hour_combobox.place(x=50,y=110)
# Tkinter Buttons
# Cancel button
cancel_button = Button(self.window, text='Cancel',
font=('Helvetica',12), bg="white", fg="black",
command=self.Cancel)
cancel_button.place(x=70, y=150)
def Cancel(self):
self.pause = True
self.window.destroy()
def Get_Time(self):
self.time_display = Label(self.time_frame,
font=('Helvetica', 20 , "bold"),
bg = 'gray35', fg = 'yellow')
self.time_display.place(x=130, y=210)
try:
# Total amount of time in seconds
h = (int(self.hour_combobox.get())*3600)
m = (int(self.minute_combobox.get())*60)
s = (int(self.second_combobox.get()))
self.time_left = h + m + s
# Pause Button
pause_button = Button(self.button_frame, text='Pause',
font=('Helvetica',12), bg="red", fg="white",
command=self.pause_time)
pause_button.place(x=100, y=0)
except Exception as es:
messagebox.showerror("Error!", f"Error due to {es}")
def Threading(self):
# Killing a thread through "daemon=True" isn't a good idea
self.x = Thread(target=self.start_time, daemon=True)
self.x.start()
def Clear_Screen(self):
for widget in self.button_frame.winfo_children():
widget.destroy()
def start_time(self):
self.pause = False
while self.time_left > 0:
mins, secs = divmod(self.time_left, 60)
hours = 0
if mins > 60:
# hour minute
hours, mins = divmod(mins, 60)
process = multiprocessing.Process(target=playsound,
args=('Ringtones/romantic.mp3',))
process.start()
messagebox.showinfo('Time Over', 'Please ENTER to stop playing')
process.terminate()
# Clearing the 'self.button_frame' frame
self.Clear_Screen()
# if the pause button is pressed,
# the while loop will break
if self.pause == True:
break
def pause_time(self):
self.pause = True
if __name__ == "__main__":
root = Tk()
# Creating a CountDown class object
obj = CountDown(root)
root.mainloop()
Chapter 8
OUTPUT / SCREENSHOTS
1) CountDown Timer :-
2) Select Time :-
3) Set Time:-
4) Start Time :-
Chapter 9
CONCLUSION
A countdown timer is a valuable tool that serves various purposes in different
contexts, ranging from personal productivity to professional applications. Here
are some key conclusions about countdown timers:
Chapter 10
REFERENCE
1) https://chat.openai.com
2) https://Python.org
3) https://www.w3schools.com/python/
4) https://www.programiz.com/python-programming