Sodapdf
Sodapdf
Content
Introduction………………
……………………….
1.1 Introduction
1.2 Uses
Methodology…………………
…………………………
2.1 Requirements
2.2 Functionality
2.3 Exit Butt xit Button Code
2.4 Nested i Nested if code
Objectives……………………
…………………………
)
Design………………………………………………………….
Conclusion………………………………………………
5.1 Conclusion
5.2 Gantt Chart
5.3 References
INTRODUCTION
1.1 Introduction
This project is
a scientific calculator which i
s used by mathematicians
as well as students
to perform difficult
calculations. This calculator
will help them
to solve difficult questions u
sing this calculator . The
Calculator will help them to
save their time by performin
g difficult
questions quickly . This proje
ct is made in Python (Tkinte
r) which is
used to make a
graphic user interface. Two ma
jor libraries are used such
as Tkinter and M and Math along
with different m ent methods.
1.2 Uses By developing this
Calculator, anyone can solve d
ifficult trigonometric
as well as
basic mathematic problems . A
s the interface of the project
is very simple and easy to us
e therefor can easily access the
use of the
project.
METHODOLOGY
2.1 Requirements
The first
step is gathering our requireme
nts for this project. The functio
ns
and the
modules are necessary for the de development
of this projec of this projec of this project.
2.2 Functionality
In this step we will discuss th
e different functions used in the
program
and how they are working t
ogether to create such an user
friendly
interface .
This kind of warning message will appear if the uses clicks on the exit
button :
The Procedural programming is done in which different iterative
statements are ements are made like nested i nested ifelse to use the Math modu h module .
The following pages will contain the programming of the nested ifelse
showing the usage of math l th library .
return
elif value == value == 'Exit':
if a == a == 'yes':
root.destroy()
entryField.delete(0, "end")
answer = math.sqrt(eval(ex))
answer = math.pi
answer = math.cos(math.radians(eval(ex)))
elif value == value ==
'tanθ':
answer = math.tan(math.radians(eval(ex)))
answer
answer =
= 2 * math.pi
math.sin(math.radians(eval(ex)))
* math.pi
answer = math.cosh(eval(ex))
answer = math.tanh(eval(ex))
answer = math.sinh(eval(ex))
answer = eval(ex) ** (1 / 3)
entryField.insert(END, '**')
return
elif value == value == 'x\u00B3':
answer = eval(ex) ** 3
answer = eval(ex) ** 2
answer = math.log2(eval(ex))
answer = math.degrees(eval(ex))
answer = math.radians(eval(ex))
answer = math.e
answer = math.log10(eval(ex))
elif value == value == '
X!':
answer = math.factorial(
int(ex))
entryField.insert(END, "
/")
return
answer = eval(ex)
else:
entryField.insert(END, v
alue)
return
entryField.delete(0, END
) , END)
entryField.insert(0, ans
wer)
except Exception as e:
entryField.delete(0, END
) , END)
entryField.insert(0, "i
nvalid syntax")
OBJECTIVES
Scientific calculators p
erform the same functi
ons as their standard
electronic calculator co
unterparts, but they als
o have myriad other
features available. There
are three main categories
of calculators on the
market today: business,
basic, and scientific. It’
s likely that you have
already used a basic ca
lculator in your high sch
ool math classes, and
you may have even us
ed a business or graph
ing calculator in an
economics or business
statistics course. The
scientific calculator,
however, is the only one
that can handle certain f
unctions in fields such
as trigonometry, physi
cs, chemistry, and eng
ineering. A scientific
calculator has additional
features that allow you to
work with exponents
and logs, which require
more memory in order to
perform functions for
the best results.
3.1 Basic functions: Calculate basic functions such as addition,
subtraction, multiplication, and division. You should keep in mind that
the subtraction sign (-) is different from a separate negative function.
This can end up causing some confusion concerning negative and
positive numbers when you start using your calculator at first because
the signs look similar.
3.2 Sine fu e functions: A sine func sine function is used to f to find the measurement of nt of
a certain angle, especially when other sides or angles are unknown. You
may also encounter the inverse sine, which is often used to find the
hypotenuse of a triangle.
3.4 Scientific notation : A scientific calculator isn’t just used for more
complicated math problems. In fact, one of its best uses may be that it
can calculate scientific notation. For numbers that can’t be written in
decimal point form because they are too large, a normal calculator
won’t be able be able to cover it r it.
You’ll most likely use scientific notation if you plan to work in a field
related to science, engineering, and mathematics, and you will
definitely need a more c more complex calculator to handle your homework.
DESIGN
4.1 MODULES A
ND TO D TOOLS
To design the
scientific calcul
ator our team i
s going to use
various libraries
of python . The li
braries we are g
oing the below
mentioned librari
es but the additio
n of more librarie
s can be there
.
➢Tkinter
➢Math
➢Web browser
➢Message box
4.2 PYTHON 3
.10
Python is a hi
gh level, gener
al purpose lang
uage. Python is
dynamically typ
ed and garbage
-collected. It sup
ports multiple
programming
paradigms, incl
uding structure
d (particularly
procedural), ob
ject- oriented
and functional
programming.
Python is so ve
rsatile language
as you can make
web frameworks
, GUI (graphic
user interface) ,
games and also
you can use it
write backend and
manage da age datab
ase with it . it .
4.3 Tkinter
Tkinter is the st
andard GUI lib
rary for Python
. Python when
combined with T
kinter provides a
fast and easy wa
y to create GUI
applications. Tki
nter is easy to us
e . It has various
widgets such as
entry, frame, button etc. Following steps should be taken to use
Tkinter .
❖Import Tkinter
❖Create GUI main window
❖End the main window
❖Write logics in the window
4.4 Interface
Various kinds of kinds of methods a methods are used within this pro s project . As ct . As ct . As it is it is
clearly visible that the window has an ic an icon along with the title . e .
The icon is mad is made in the paint the paint and wm_icon.bitmap is use is used to put
the icon . The i The icon should be in the ICO format t at to avoid error .
Also there are a lot e a lot e a lot of symbols w symbols which a keyboard do rd do not have
such as cube root , square root etc. for that Unicode is use is used
There are a e a lot of button which has different functions suc ent functions suc ent functions such as C
button which is used to del a el a character and er and CE button is used to clear
all .
Entry widget is used here which takes the i the input from the button
given by the use the user and the and then with t with the help of math module the
calculations a ons are ma re made . Also user Also user can perform ca m calculations whic ations which
include t lude trigonometric functions .
Buttons are created using for loo for loop and each and each button has same
background colo kground color and font which is don is done by using following
attributes.
4.6 Common attributes used:
Fg is a com a common attribute t te to color the t the text as i t as i t as in the proj the project t ct the
foreground of the text is whi is white.
Command is us is used various t ious times . It is use is used in the but the buttons . The
functions are c are called using this command attribute .
Font it is it is used to beautify as wel fy as wel fy as well as magnify the te e text . In the project
the font used is aria is arial
CONCLUSION
➢hp.com
➢geeksforgeeks
➢studytonight.com
➢activestate.com
CODE
from tkinter im
port *
import math
import tkinter.m
essagebox
def click(value)
:
print(value)
answer = answer
= ''
ex = entr ex = e
ntr ex = entryFi
eld.get()
ex = ex[0:len(ex
elif value == value == )
'Cosθ':
- 1]
elif value == value ==
entryField.delet
'tanθ':
e(0, END)
return
answer = 2 * math.pi
* math.pi
elif value == va
lue == "CE":
entryField.delet
e(0, "end")
answer = math.sq
rt(eval(ex))
answer = math.pi
answer = math.co
s(math.radians(e
val(ex)))
answer = math.ta
n(math.radians(e
val(ex)))
answer = math.si
n(math.radians(e
val(ex)))
elif value == va
lue == '2π':
elif value == va
lue == 'cosh':
answer = math.co
sh(eval(ex))
elif value == va
lue == 'tanh':
answer = math.tanh(eval(ex))
answer = math.sinh(eval(ex))
answer = eval(ex) ** (1 / 3)
entryField.insert(END, '**')
return
answer = eval(ex) ** 3
answer = eval(ex) ** 2
answer = math.log2(eval(ex))
answer = math.degrees(eval(ex))
answer = math.radians(eval(ex))
answer = math.log10(eval(ex))
answer = math.factorial(int(ex))
entryField.insert(END, "/")
return
answer = eval(ex)
else:
entryField.insert(END, value)
return
entryField.
delete(0, E
ND) , END)
entryField.
insert(0, a
nswer)
except Exce
ption as e:
entryField.
delete(0, E
ND) , END)
entryField.
insert(0,
"invalid sy
ntax")
"1", "2", "3", "-", "2π", "cosh", "sinh", "
tanh",
"4", "5", "6", "*", chr(8731), "x\u02b8", "x\
u00B3",
root = Tk()
root = Tk()
root = Tk()
root.title(
"Calculator
")
root.geomet
ry("690x550
")
root.config
(bg="grey")
root.wm_ico
nbitmap("1.
ico")
entryField
= entryFie
ld = Entry
(root, font
= ot, font=
"arial 45 b
old", bg= ,
bg="white",
fg="black",
bd= , bd=10
, relief=SU
NKEN)
entryField.
grid(row=0,
column= , c
olumn=0, co
lumnspan=8)
button_text
_list = [ i
st = [ ist
= ["C", "C
E", "√",
"+", "π",
"Cosθ", "S
inθ", "tan
θ",
"x\u00B2",
"7", "8",
"9", chr(24
7), "ln",
"deg", "ra
d", "e",
"0", ".",
"%", "=",
"log10", "
(", ")",
"X!"]
# x # x\
u02b8 -
>cube root
# x\u02b8
->x^y
# chr(247)
# chr(247)
-> division
row_value =
row_value
= 1
column_valu
e = 0
for i in b
utton_text_
list:
button = b
utton = Bu
tton(root,
width= oot,
width=5, he
ight=2, bd=
, bd=2, rel
ief=SUNKEN,
text=i,
bg="black",
font="aria
18 "aria 1
8 bold", a
ctivebackgr
ound="honey
dew3",
fg="white",
command=lam
bda button=
i: click(bu
tton))
button.grid
(row=row_va
lue, col ow
_value, col
umn=column_
value, pad
mn_value, p
ady=1, padx
=1)
column_valu
e += lue +
= 1
if column_v
alue > 7:
row_value +
= 1
column_valu
e = 0
def exit():
x = tkint x = tk
int x = tkinter.
messagebox.askqu
estion("Exit","D
o you r "Do you
r "Do you really
wa eally want to
nt to
exit",icon="warn
ing")
if x == x == "
yes":
root.destroy()
Button(root,text
="Exit",fg="whit
e",bg="black",fo
nt="arial 18
bold",command=ex
it).place(y=500)
root.mainloop()