Project Report
Project Report
Page | 1
ACKNOWLEDGEMENT
Page | 2
INDEX
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
INTORDUCTION
Page | 4
THEORY
Page | 5
THE MODULES USED
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.
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
Page | 10
SOURCE CODE
root.py:-
import os
def callback(filename):
fname=f"{filename}\{filename}.py"
os.system(fname)
col,row=0,0
root=Tk()
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)
root.columnconfigure(i, weight=1)
root.rowconfigure(i, weight=0)
root.mainloop()
calculator.py:-
Page | 12
import tkinter.font as font
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
# --------------------------------Functions-Start----------------------------
def charenter(num):
global calculate
entry.delete(0, END)
entry.insert(0, show)
def equal():
global calculate
calculate = str(calculate)
Page | 13
calculate = calculate.replace("cot", "1/tan")
if "√" in calculate:
try:
final=round(eval(calculate),8)
except:
entry.delete(0, END)
entry.insert(0, final)
def clear():
global calculate
main = entry.get()
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================
Page | 15
btnln.grid(sticky="nsew", row=r-1, column=0)
# ====================Column1================
btnlog.grid(sticky="nsew", row=r-1,column=1)
Page | 16
btn0.grid(sticky="nsew", row=r + 3, column=1)
# ====================Column2================
btnpi.grid(sticky="nsew", row=r-1,column=2)
# ====================Column3================
Page | 17
btnrad = Button(calculator, bg="#3d3d3d", activebackground="#cf7611",
fg="#fff", font=('Tw Cen MT', 20), text='rad',command=lambda:
charenter('rad'))
btnpoint.grid(sticky="nsew",row=r-1,column=3)
# ====================Column4================
Page | 18
btnequal = Button(calculator, bg="#02a125", activebackground="#00d930",
fg="#000", font=('Tw Cen MT', 20), text='=',command=equal)
btne.grid(sticky="nsew", row=r-1,column=4)
# --------------------------------Functions-End------------------------------
calculator.columnconfigure(i, weight=1)
calculator.rowconfigure(i, weight=1)
no_of_col = int(calculator.grid_size()[1])
# --------------------------------Entry--------------------------------------
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
ALARM
Page | 20
CALCULATOR
CONVERTER
Page | 21
COUNTER
STOPWATCH
TIMER
TODO-LIST
Page | 22
CONCLUSION
Alarm
Calculator
Converter
Counter
Stopwatch
Timer
Todo List
Page | 23
PRECAUTIONS
BIBLIOGRAPHY
www.github.com
www.google.com
www.stackoverflow.com
Page | 24