0% found this document useful (0 votes)
277 views24 pages

Project Report

This document provides a summary of the algorithm used to create a Daily Purpose Toolkit program using Python. The algorithm includes opening different modules like calculator.py, converter.py, alarm.py etc when the corresponding buttons are clicked from the main GUI window. Each module uses Tkinter to create its own GUI and performs different tasks like calculations, unit conversions, setting alarms, timers etc. It also includes the logic steps performed within each module to implement the given functionality. The overall algorithm aims to integrate different daily use tools within one program using Python.

Uploaded by

AIO All in one
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
277 views24 pages

Project Report

This document provides a summary of the algorithm used to create a Daily Purpose Toolkit program using Python. The algorithm includes opening different modules like calculator.py, converter.py, alarm.py etc when the corresponding buttons are clicked from the main GUI window. Each module uses Tkinter to create its own GUI and performs different tasks like calculations, unit conversions, setting alarms, timers etc. It also includes the logic steps performed within each module to implement the given functionality. The overall algorithm aims to integrate different daily use tools within one program using Python.

Uploaded by

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

CERTIFICATE

This is to certify that Master/Miss_________________________ has

satisfactorily completed his/her minor project in subject

_________________ on the topic ___________________________

during the Academic Year 2020-21.

Date: Signature of Teacher

Signature of External Signature of Principal


Examiner

Page | 1
ACKNOWLEDGEMENT

I would like to express my sincere thanks to the Almighty God


for being able to complete this project.
I would like to thank our Principal Mrs. Jessy Andrews for
giving me the opportunity to work on this wonderful project
‘Daily Purpose Toolkit using Python’.
It is my privilege to express special thanks of gratitude to my
teachers, Mrs.Shilpa A G who guided me in doing a lot of
research and gave constant encouragement in pursuance of this
project work.
I would also like to thank my parents, and friends who helped
me in finalizing this project within the limited time frame.

Page | 2
INDEX

SL. No Contents Page No

1 Aim 4
2 Introduction 4
3 Theory 5
4 Algorithm 7
5 Source Code 12
6 Output 21
7 Conclusion 24
8 Precautions 25
9 Bibliography 25

Page | 3
AIM

To create a Daily Purpose Toolkit program using Python


Programming Language.

INTORDUCTION

Everybody in Today’s world rely on some tools to serve


their daily purposes. The tools include Calculator,
Counter, Alarm, Timer etc. However every tool has a
different hardware and thus it takes a lot of space and
becomes difficult to carry to certain places.

Thus a daily purpose toolkit will help in integrating all the


tools under one app which saves space and can be carried
along with the computer and also can be transferred
easily. And this is the sole purpose of this open source
project.

Page | 4
THEORY

PYTHON:-Python is an interpreted, high-level, general-


purpose programming language, Created by Guido van
Rossum and first released in 1991. Python’s design
philosophy emphasizes code readability with its notable
use of significant whitespace. Its language constructs and
object-oriented approach aim to help programmers write
clear, logical code for small and large-scale projects.

We are using the same programming language to create a


project which consists of a toolkit which has various apps
like calculator, converter, alarm, timer, stopwatch, todo-
list, and counter.

Page | 5
THE MODULES USED

 Tkinter: Python offers multiple options for


developing GUI (Graphical User Interface). Out of
all the GUI methods, tkinter is the most commonly
used method.
o Installation:-It is generally shipped with Python
but sometimes needs to be installed manually.
 For Anaconda type the following in the
shell: conda install -c anaconda tk
o Widgets Used:- The following tkinter widgets
are used for the completion of the program:
 Labels
 Buttons
 Entry Fields
 Option Menu
 Label Frame

Page | 6
PROJECT ALGORITHM
Step 1. Start the root.py file
Step 2. Import tkinter button and create a GUI window
Step 3. Make eight buttons with text as Calculator, Converter, Alarm, Tier,
Stopwatch, Todolist, Counter,Close
Step 4. Check the button clicked by the user
Step 5. If the user clicks calculator button go to step 14
Step 6. If the user clicks converter button go to step 15
Step 7. If the user clicks alarm button go to step 16
Step 8. If the user clicks the timer button go to step 17
Step 9. If the user clicks the stopwatch button go to step 18
Step 10. If the user clicks todolist button go to step 19
Step 11. If the user clicks counter go to step 20
Step 12. Wait till a user clicks any button
Step 13. If the user close button Stop the root.py
Step 14. Open calculator.py from calculator folder
a. Import tkinter and create a tkinter GUI window
b. Create an empty string named calculate
c. Create an tkinter entry widget as entry
d. Create buttons for numbes (1,2,3 …), operators (+, -, /, *), functions
(sin, tan, log …), equal to (=), backspace, all clear, Close
e. When a button is clicked append the button text to calculate string and
insert the string in entry
f. If the equal button is clicked, remove unwanted strings from calculate
using replace function. Try to eval calculate and round to eight places
and display result in entry except display INVALID INPUT in the
entry
g. If backspace is clicked remove the last string from calculate and
display in entry
h. If all clear is clicked make the calculate string empty and clear the
entry

Page | 7
i. Wait till the Close button is clicked
Step 15. Open converter.py from converter folder
a. Import tkinter and from packages import all the conversion files
b. Create objects for all units. For example kilo_object = Kilograms(“”)
c. Create lists for units like mass_units =[“Kilograms”, “Grams”,
“Pounds”, “Ounces”,”Milligrams”, “Micrograms”]. Similary create
vol_units, length_units, temp_units, speed_units.
d. Create a tkinter option menu along with label asking for the quantity
to get converted
e. Store the option chosen in the variable value
f. Create an entry widget with label that asks the user the amount of
quantity to convert and store the input as user_inpt
g. Create two Options menus with labels asking for from_unit and
to_unit. Pass in the appropriate list like if the quantity is mass pass the
mass_unit. Store the from_unit to from and to_unit to to
h. Use if and elif to check the from_unit and to_unit and use the proper
unit object to get the output. Ex. If Kilograms is converted to Pounds,
output= kilo_object.kgTolb(value)
i. Create a tkinter entry and display the output
j. Wait till the user clicks the close button.

Step 16. Open alarm.py from alarm folder


a. Import tkinter, playsound, datetime, time and os
b. Using os get the current working directory
c. Start the tkinter window and create two buttons asking for the time
format whether 12 hours or 24 hours
d. If the user clicks the 12-hour format create four buttons with labels
asking for hours, minutes, seconds and AM/PM
e. If the user clicks the 24-hour format create three buttons with labels
asking for hours, minutes, seconds
f. After the click button is clicked, Convert the user input into seconds
g. Get the current time using datetime
h. Convert the current time in seconds
i. Create a while loop to loop for that many seconds using time.sleep()
until the user input is equal to the current time.
Page | 8
j. Display the current time using label
k. Create a variable sound_path. sound_path = current_directory +
“alarm.mp3”
l. Play the alarm file using playsound(sound_path)
m. If close is clicked close timer.py

Step 17. Open timer.py from timer folder


a. import tkinter, time, playsound, os
b. using os get the current_directory
c. create a tkinter window
d. create three entry with label to ask for hours, minutes, seconds
e. after the click button is clicked convert the time to seconds
f. using while loop and time.sleep() wait for the seconds to reach 0.
After each loop iteration reduce the second by 1
g. display the remaining time using label while in the loop
h. after the loop is executed create a variable sound_path =
current_directory + “timer.mp3”
i. play the timer sound using playsound(sound_path)
j. If close is clicked close timer.py

Step 18. Open stopwatch.py from stopwatch folder


a. Import tkinter, time
b. Create a variable current_time = “00:00:00”
c. Create a tkinter window
d. Create buttons for click, pause , reset, close, flag
e. Start a while loop after click is clicked
f. Inside the loop use string slicing and time module and increment the
seconds after every second
g. If the pause is clicked stop the while loop
h. If the reset is clicked stop the while loop and reset current_time to
“00:00:00”
i. If the flag button is clicked display the current_time as a label
j. If close is clicked close stopwatch.py

Page | 9
Step 19. Open todolist.py from todolist folder
a. Import tkinter, datetime
b. Create a tkinter window
c. Get today’s date from datetime module and display it as a label
d. Create an entry widget with label asking for the item to be entered
e. Set row to 2
f. Create a button to enter an item
g. After the button is clicked display the input from entry with a label at
row = row, increment the row by 1
h. If close is clicked close timer.py

Step 20. Open counter.py from counter folder


a. Import tkinter
b. Create a tkinter window
c. Set count to 0
d. Create buttons for click, reset , close
e. Create an entry with label asking for step value
f. If entry is empty set step value to 1
g. If click is created increment count by step value and display the count
as a label
h. If close is clicked close counter.py

Page | 10
SOURCE CODE

The Following program has 12 python files due to which


the source code of the entire program cannot be shown
here. The code for the root.py and calculator.py is shown
here.
Link for the full project: -
https://github.com/ProgrammerAditya36/Daily-Purpose-Toolkit

root.py:-

from tkinter import Button, Tk

import os

def callback(filename):

fname=f"{filename}\{filename}.py"

os.system(fname)

col,row=0,0

root=Tk()

root.title("All In One Toolkit")

btncalc=Button(root,text="Calculator",command=lambda :callback("Calculator"))

Page | 11
btnconv=Button(root,text="Converter",command=lambda:callback("Converter"))

btnalarm=Button(root,text="Alarm",command=lambda :callback("Alarm"))

btntodolist=Button(root,text="ToDo List",command=lambda:callback("ToDoList"))

btncounter=Button(root,text="Counter",command=lambda :callback("Counter"))

btntimer=Button(root,text="Timer",command=lambda:callback("Timer"))

btnstopwatch=Button(root,text="Stopwatch",command=lambda:callback("stopwatch"
))

btnclose=Button(root,text="Close",command=root.destroy)

components=[btncalc,btnconv,btnalarm,btntimer,btncounter,btntodolist,btnstopw
atch,btnclose]

for i in components:

if col==4:

row+=1

col=0

col+=1

i.grid(row=row,column=col)

i.config(font=("Tw Cen
MT",20),fg="#46484a",bg="#88a5db",bd=3,width=10,height=3)

for i in range(0, root.grid_size()[0]):

root.columnconfigure(i, weight=1)

for i in range(0, root.grid_size()[1]):

root.rowconfigure(i, weight=0)

root.mainloop()

calculator.py:-
Page | 12
import tkinter.font as font

from tkinter import *

import math as m

log = m.log

ln = m.ln

# --------------------------------TKINTER-START------------------------------

calculator = Tk()

calculator.title("Calculator")

calculator.geometry("400x600")

calculator.config(bg="#000")

# --------------------------------Variables----------------------------------
r = 5

calculate = " "

show = " "

# --------------------------------Functions-Start----------------------------

def charenter(num):

global calculate

calculate = entry.get() + str(num)

show = entry.get() + str(num)

entry.delete(0, END)

entry.insert(0, show)

def equal():

global calculate

calculate = str(calculate)

calculate = calculate.replace("x", "*")

calculate = calculate.replace("cosec", "1/sin")

calculate = calculate.replace("sec", "1/cos")

Page | 13
calculate = calculate.replace("cot", "1/tan")

calculate = calculate.replace("sin", "m.sin(")

calculate = calculate.replace("cos", "m.cos(")

calculate = calculate.replace("tan", "m.tan(")

calculate = calculate.replace("rad", ")")

calculate = calculate.replace("°", "*m.pi/180)")

calculate = calculate.replace("^", "**")

calculate = calculate.replace("log", "m.log10")

calculate = calculate.replace("ln", "m.log")

calculate = calculate.replace("e", str(m.e))

calculate = calculate.replace("π", str(m.pi))

if "√" in calculate:

calculate = calculate.replace("√(", "m.pow(")

calculate = calculate.replace(")", ",0.5)")

try:

final=round(eval(calculate),8)

except:

final = "INVALID INPUT"

entry.delete(0, END)

entry.insert(0, final)

def clear():

global calculate

main = entry.get()

if main != "INVALID INPUT":

show = main[:len(main) - 1]

calculate = main[:len(main) - 1]

Page | 14
entry.delete(0, END)

entry.insert(0, show)

def allclear():

global calculate

calculate = ""

show = ""

entry.delete(0, END)

entry.insert(0, show)

# --------------------------------Buttons------------------------------------

# ====================Column0================

btncosec = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20),text='cosec', command=lambda:
charenter('cosec'))

btnsin = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='sin',command=lambda:
charenter('sin'))

btnln = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='ln', command=lambda:
charenter('ln'))

btn7 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=7,command=lambda: charenter(7))

btn4 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=4, command=lambda: charenter(4))

btn1 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=1,command=lambda: charenter(1))

btnob = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='(', command=lambda: charenter('('))

btncosec.grid(sticky="nsew", row=r-3, column=0)

btnsin.grid(sticky="nsew", row=r-2, column=0)

Page | 15
btnln.grid(sticky="nsew", row=r-1, column=0)

btn7.grid(sticky="nsew", row=r, column=0)

btn4.grid(sticky="nsew", row=r + 1, column=0)

btn1.grid(sticky="nsew", row=r + 2, column=0)

btnob.grid(sticky="nsew", row=r + 3, column=0)

# ====================Column1================

btnsec = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='sec',command=lambda:
charenter('sec'))

btncos = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='cos',command=lambda:
charenter('cos'))

btnlog = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='log',command=lambda:
charenter('log'))

btn8 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=8,command=lambda: charenter(8))

btn5 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=5,command=lambda: charenter(5))

btn2 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=2,command=lambda: charenter(2))

btn0 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=0,command=lambda: charenter(0))

btnsec.grid(sticky="nsew", row=r-3, column=1)

btncos.grid(sticky="nsew", row=r-2, column=1)

btnlog.grid(sticky="nsew", row=r-1,column=1)

btn8.grid(sticky="nsew", row=r, column=1)

btn5.grid(sticky="nsew", row=r + 1, column=1)

btn2.grid(sticky="nsew", row=r + 2, column=1)

Page | 16
btn0.grid(sticky="nsew", row=r + 3, column=1)

# ====================Column2================

btncot = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='cot',command=lambda:
charenter('cot'))

btntan = Button(calculator, bg="#22aa7a", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='tan',command=lambda:
charenter('tan'))

btnpi = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='π',command=lambda: charenter('π'))

btn9 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=9,command=lambda: charenter(9))

btn6 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=6,command=lambda: charenter(6))

btn3 = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=3,command=lambda: charenter(3))

btncb = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text=')',command=lambda: charenter(')'))

btncot.grid(sticky="nsew", row=r-3, column=2)

btntan.grid(sticky="nsew", row=r-2, column=2)

btnpi.grid(sticky="nsew", row=r-1,column=2)

btn9.grid(sticky="nsew", row=r, column=2)

btn6.grid(sticky="nsew", row=r + 1, column=2)

btn3.grid(sticky="nsew", row=r + 2, column=2)

btncb.grid(sticky="nsew", row=r + 3, column=2)

# ====================Column3================

btnpow = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='^',command=lambda: charenter('^'))

Page | 17
btnrad = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",
fg="#fff", font=('Tw Cen MT', 20), text='rad',command=lambda:
charenter('rad'))

btnpoint = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='.',command=lambda: charenter('.'))

btndiv = Button(calculator, bg="#fac534", activebackground="#cf7611",


fg="#000", font=('Tw Cen MT', 20), text='/',command=lambda: charenter('/'))

btnmul = Button(calculator, bg="#fac534", activebackground="#cf7611",


fg="#000", font=('Tw Cen MT', 20), text='x',command=lambda: charenter('x'))

btnsub = Button(calculator, bg="#fac534", activebackground="#cf7611",


fg="#000", font=('Tw Cen MT', 20), text='-',command=lambda: charenter('-'))

btnadd = Button(calculator, bg="#fac534", activebackground="#cf7611",


fg="#000", font=('Tw Cen MT', 20), text='+',command=lambda: charenter('+'))

btnpow.grid(sticky="nsew", row=r-3, column=3)

btnrad.grid(sticky="nsew", row=r-2, column=3)

btnpoint.grid(sticky="nsew",row=r-1,column=3)

btndiv.grid(sticky="nsew", row=r, column=3)

btnmul.grid(sticky="nsew", row=r + 1, column=3)

btnsub.grid(sticky="nsew", row=r + 2, column=3)

btnadd.grid(sticky="nsew", row=r + 3, column=3)

# ====================Column4================

btnroot = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='√',command=lambda: charenter('√('))

btne = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='e',command=lambda: charenter('e'))

btndeg = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",


fg="#fff", font=('Tw Cen MT', 20), text='°',command=lambda: charenter('°'))

btnallclear = Button(calculator, bg="#f52314", activebackground="#ff5d52",


fg="#000", font=('Tw Cen MT', 20, 'bold'),text='AC', command=allclear)

btnclear = Button(calculator, bg="#fff", activebackground="#f3ff52",


fg="#000000", font=('Tw Cen MT', 20, 'bold'),text='C', command=clear)

Page | 18
btnequal = Button(calculator, bg="#02a125", activebackground="#00d930",
fg="#000", font=('Tw Cen MT', 20), text='=',command=equal)

btnroot.grid(sticky="nsew", row=r-3, column=4)

btne.grid(sticky="nsew", row=r-1,column=4)

btndeg.grid(sticky="nsew", row=r-2, column=4)

btnallclear.grid(sticky="nsew", row=r, column=4)

btnclear.grid(sticky="nsew", row=r + 1, column=4)

btnequal.grid(sticky="nsew", row=r + 2, column=4, rowspan=2)

# --------------------------------Functions-End------------------------------

for i in range(0, calculator.grid_size()[0]):

calculator.columnconfigure(i, weight=1)

for i in range(0, calculator.grid_size()[1]):

calculator.rowconfigure(i, weight=1)

no_of_col = int(calculator.grid_size()[1])

# --------------------------------Entry--------------------------------------

entry = Entry(calculator, justify="right", font=("Tw Cen MT", 25),


bg="#757575",fg="#222")

entry.grid(row=0, column=0, columnspan=no_of_col, sticky="nsew")

btnclose=Button(calculator,text="Close",command=calculator.destroy)

btnclose.grid(row=100,column=0,columnspan=calculator.grid_size()
[0],sticky="nsew")

btnclose.config(font=("Tw Cen
MT",20),fg="#fff",bg="#3d3d3d",relief=RAISED,bd=3,width=30)

calculator.mainloop()

Page | 19
OUTPUT

The Output for All the Files is shown below


ROOT

ALARM

Page | 20
CALCULATOR

CONVERTER

Page | 21
COUNTER

STOPWATCH

TIMER

TODO-LIST

Page | 22
CONCLUSION

With The following project we complete our Objective of


creating a useful Daily Purpose Toolkit which contains
the Following Applications: -

 Alarm
 Calculator
 Converter
 Counter
 Stopwatch
 Timer
 Todo List

The Future Development of the Project looks at the


Following Tasks:-
 Simplifying The Code and Refactoring it
 Making it more user friendly and enhancing the User
Experience
 Reduction of Errors
 Adding Keyboard Support to make it more efficient

Page | 23
PRECAUTIONS

 All the files must be properly installed/cloned


 Python 3+ should be properly installed
 Tkinter module should be installed correctly
 For Alarm and Timer the device needs to have working
speakers.

BIBLIOGRAPHY
 www.github.com
 www.google.com
 www.stackoverflow.com

Page | 24

You might also like