0% found this document useful (0 votes)
7 views31 pages

Python 2334

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 31

Maharashtra State Board of Technical Education

Mumbai. (M.S.)

MICRO PROJECT
On
“Scientific calculator using python”

Submitted by
Isha Sandip Mohite
Rutuja Maroti Waghchaure

G.S. Mandal’s

Department of Computer Engineering


Marathwada Institute of Technology
Polytechnic, Aurangabad.

Academic Year: - 2022-2023


1
MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION
CERTIFICATE
This is to certify that : -
Roll Enrollment Exam
Name of Student
No. No. Seat No.
33 Isha Sandip Mohite 2000660209

56 RutujaMarotiWaghcahure 2000660237

have successfully completed “Scientific calculator using python” Micro-project


for the subject Programming With Python as in the enclosed ‘Portfolio’ during
his tenure of Completing the Diploma in Computer Engineering (CO6I) in
Academic Year 2022-2023 from M.I.T. Polytechnic, Aurangabad with Institute
Code 0066.

Date:

Prof.P.J.Chaoudhari Prof. A.S.Nagrik


Project Guide H.O.D.

Principal

Marathwada Institute of Technology,


Polytechnic, Aurangabad

2
INDEX
Annexure-IV Micro Project Teacher Evaluation Sheet

Annexure-I A “Format for Micro-Project Proposal”


1.0 Aim/Benefits of Micro Project (minimum 30-50 words)

2.0 Course Outcomes Addressed

3.0 Proposed Methodology (procedure in brief that will be followed to do the micro-project in
about 100-200 words.)

4.0 Action Plan (Sequence and time required for major activity.)

5.0 Resources required (major resources such as row material, some machining facility,
software etc.)

Annexure-II A “Format for Micro-Project Report”


1.0 Rationale (Importance of the project, in about 30 to 50 words. This is a modified version
of the earlier one written after the work)

2.0 Aim/Benefits of Micro Project:

3.0 Course Outcomes Achieved (Add to the earlier list is more Cos are addressed)

4.0 Literature Review

5.0 Actual Methodology Followed (Write step wise work done, data collected and its
analysis (if any). The contribution of individual member may also be noted.)

6.0 Actual Resources Used (mention the actual resources used).

7.0 Outputs of the micro projects (Drawings of the prototype, drawing of survey, presentation
of collected data, findings etc.)

8.0 Skill Developed/Learning outcome of this micro project

9.0 Applications of this micro project

3
Annexure-IV
Micro Project
(Teacher Evaluation Sheet)

Name of Programme: Diploma in Computer Engineering Semester : - 6


Course Title : CO6I Code:22616
Title of Micro Project:- Scientific calculator using python

Course Outcomes Achieved:


a) Display message on screen using Python script on IDE.
b) Develop python program to demonstrate use of Operators
c) Perform operations on data structures in Python.
d) Develop functions for given problem.
e) Design classes for given problem.
f) Handle exceptions.

Process and Individual Total


Roll Enrollment Exam Product Presentation Marks
Name of Student
No. No. Seat No. Assessment / Viva (10)
(06) (04)
33 Isha Sandip Mohite 2000660209

56 Rutuja Maroti Waghchaure 2000660237

Comments / Suggestions about work:

Signature of Teacher :

Name and Designation :


of the Teacher

4
Annexure-I

Micro-Project Proposal
(Format for Micro-Project Proposal About 1-2 pages)

Title of Micro-Project :-Scientific calculator using python

1.0 Aim/Benefits of Micro Project (minimum 30-50 words)

Before the advent of scientific calculators, most math classes involved a heavy degree of long-
form pen-and-pencil arithmetic, algebraic equations and a lot of rote memorization.
Traditionally, this repetitive practice of recording and manipulating the same formulas over and
over again was considered the best foundation for a future in math. Students who excelled at
these monotonous processes where thought to be mathematically inclined, while those who grew
bored or disinterested were considered to be ill-suited to the subject.

When it came to these rote functions in math, scientific calculators provided a quick, easy,
accurate alternative. That allowed students to come up with the right answers, faster than even
the most seasoned mental arithmetician could. Where students once spent most of their time
copying down long charts of questions and answers, they could now focus on the concepts that
these formulae demonstrated.

2.0 Course Outcomes Addressed

• Display message on screen using Python script on IDE.


• Develop python program to demonstrate use of Operators
• Perform operations on data structures in Python.
• Develop functions for given problem.
• Design classes for given problem.
• Handle exceptions.

5
3.0 Proposed Methodology (Procedure in brief that will be following to do the micro-
project in about 50-100 words.)

A)-For micro-project first we have to decide topic related to Programming with python

subject.

B)-Then we were be researching and collecting information about that topic.

C)-Then we were be planning raw project on notebook.

E)-Then we have resarched lot of information and watched video then we were be startingmy

main project.

F)-At the time of project if we have getting some problem then we were ask to the respective

subject teacher (Prof P.J.Chaoudhari) .

G)- After completing project, we were show it to subject teacher for checking/correction.

6
3.0 Action Plan (Sequence and time required for major activity.)

Sr. Details of Activity Planned Planned Name of


No Start Date Finish Date Responsible
Team Members
1 Deciding topic of 25-2-2023 28-2-2023 Rutuja,Isha

microproject

2 Collecting and Searching 1-3-2023 10-3-2023 Rutuja,Isha

Information about topic

3 Starting raw project on 11-3-2023 20-3-2023 Rutuja,Isha

notebook

4 Starting main project 21-3-2023 30-3-2023 Rutuja,Isha

5 Removing error from project 1-4-2023 30-4-2023 Rutuja,Isha

6 Making in pdf format for 01-5-2023 10-5-2023 Rutuja , Isha

submitting

7
5.0 Resources required (major resources such as row material, some machining
facility, software etc.)
Sr. Name of Resource/Material Specification Qty. Remarks
No
1 Laptop i-5,4 GB RAM 1

2 Internet 100 mb/s -

3 Microsoft Word - 1

Names of Team Members with Roll No. : -

Roll No. Name of Student

33 Isha Sandip Mohite

56 Rutuja Maroti Waghcahure

8
Annexure-II

Micro-Project Report
(Format for Micro-Project Report minimum 4 pages)

Title of Micro-Project : Scientific calculator using python

1.0 Rationale (Importance of the project, in about 30 to 50 words. This is a modified


version of the earlier one written after the work)

A scientific calculator is an electronic device that performs the basic arithmetic operations
(addition, subtraction, multiplication and division). In mathematics, a scientific calculator is a
valuable and useful tool as it allows the user to quickly and easily solve more difficult equations
larger than one or two terms.

Equations with a scientific calculator are commonly used in mathematics, physics and other
sciences. In fact, even some calculators created for mathematics can solve equations that contain
roots or indefinite.

In more advanced mathematics, a scientific calculator can be of great help in solving complex
problems where the steps required to solve them manually would be too time consuming, tedious
and inaccurate.

A scientific calculator is also used as a tool to check solutions to more complicated problems. In
high school, a scientific calculator can be used in different ways:

A scientific calculator is important in mathematics for all these reasons. It can do much more
than a normal calculator and makes the process of learning math much easier. In fact, high
school math students are constantly required to make use of it to solve problems. It is most
commonly used in trigonometry, calculus and statistics:

9
2.0) Aim/Benefits of Micro Project:

The benefits of Scientific calculator

• To teach an understanding of numbers and the relationships between them


• To help students understand when,replicas relojes and how to apply mathematical
techniques
• To help allow students to make quick, accurate mathematical calculations
• To help students expand the scope of their mental abilities
• To help students better understand intangible concepts, through tangible means
• To teach logical thinking, and problem-solving skills
• To teach students how to check their results for mathematical accuracy
• To help student recognize the mathematical concepts which underlie technology and the
natural world

3.0) Course Outcomes Achieved (Add to the earlier list is more Cos are addressed)

• Display message on screen using Python script on IDE.


• Develop python program to demonstrate use of Operators
• Perform operations on data structures in Python.
• Develop functions for given problem.
• Design classes for given problem.
• Handle exceptions.

10
4.0) Literature Review:-

https://ieeexplore.ieee.org/document/475332

Abstract:

Calculators are part and parcel of modern education. Involvement of science and engineering in
different fields of knowledge is increasing with each bit of time is passed by, and they are
playing a role in description and characterization of the delicate phenomena of nature arising day
by day. These fields of knowledge and mathematics in particular, are influencing even those
distant branches of knowledge, which were so far imagined to be free of mathematics. Even art is
not free of mathematics and there exists mathematical art. Computations are getting lengthy and
complex specially in design and analysis of engineering systems. Scientific calculators are handy
tools. But an efficient computation is a skill that can be developed. This paper describes the
Calculator Project, which was a three-year joint research project between the Centre for
Information Technology in Education at The Open University, U.K. and the Department of
Computer Science, QMW, University of London, U.K.. The project was funded by the U.K.
Joint Council Initiative in Cognitive Science and Human-Computer Interaction. The central aim
of the project was to test the hypothesis that providing so-called calculators would improve
students performance in those parts of the undergraduate first-year that relied on formal
reasoning skills.

Published in: Proceedings Software Education Conference (SRIG-ET'94)

Date of Conference: 22-25 Nov. 1994

Date Added to IEEE Xplore: 06 August 2002

Print ISBN:0-8186-5870-3

INSPEC Accession Number: 4980843

DOI: 10.1109/SEDC.1994.475332

Publisher: IEEE

Conference Location: Dunedin, New Zealand

11
5.0 Actual Methodology Followed (Write step wise work done, data collected and its analysis
(if any).The contribution of individual member may also be noted.)

A) Project Topic Selection :

At the beginning we were confused about selecting Topic for Programming with Python
Subject microproject but after a conversation with subject teacher we made my decision and
select topic Scientific Calculator Using Python.

.
B) Searching and Collecting Information :

After selecting project topic then we searched lots of information related to Online Digital Notice
Board .we were visited more than 5 websites which gave me valuable information about my
Project topic.

C) Raw Project :

After collecting information about project, we started rough Design,data,topics,diagram on


notebook for implementing my Idea on project.

D) Main Project Work On :

After completing and Implementing rough Design,data,topics,diagram on notebook.Then,we


started project in Microsoft Office word . On that time we were stuck Because we were unable
to sort information And also we didn’t have proper information
about Report & Literature Review .

E) Problem &Doubt Solving :

As we were not able to proceed further in micro project we don’t brief discussion with respected
subjectteacher (Prof.P.J.Chaoudhari.) ,During conversation mam gave me proper instruction and
Sequence for project.

F) Final Stage of Micro Project :

After removing errors we have completed my project and got the proper output.

12
6.0 Actual Resources Used (mention the actual resources used).

Sr. No Name of Resource/Material Specification Qty. Remarks


1 Laptop i-5,4 GB 1
RAM
2 https://macprotricks.com/importance-of-a-scientific- Website -
calculator-in-maths/
3 Microsoft word Provide 1
Formal view
for report
4 Internet Web
browsing
5 https://ieeexplore.ieee.org/document/475332 Website-
Literature
Review

6 Python Textbook (Techknowledge) I scheme

7 https://www.thoughtco.com/how-to-use-a-scientific- Website

calculator-4088420

13
7.0 Outputs of the micro projects (Drawings of the prototype, drawing of survey,
Presentation of collected data, findings etc.)

14
8.0 Skill Developed/Learning outcome of this micro project

a)Increased knowledge about Scientific Calculator

b)Enhanced knowledge about Python Programming

c) Increased searching skills.

d) Enhanced presenting skills.

e) Increased editing skills

f) Increased solo working skills .

g)Enhanced Designing skills.

9.0 Applications of this micro project : -

• To teach an understanding of numbers and the relationships between them


• To help students understand when,replicas relojes and how to apply mathematical
techniques
• To help allow students to make quick, accurate mathematical calculations
• To help students expand the scope of their mental abilities
• To help students better understand intangible concepts, through tangible means
• To teach logical thinking, and problem-solving skills
• To teach students how to check their results for mathematical accuracy
• To help student recognize the mathematical concepts which underlie technology and the
natural world

15
Introduction:-

What is a scientific calculator?

A scientific calculator is an electronic device/softwatre which is used to calculate and solve


mathematics and science problems. This type of calculator operates just like a standard calculator
with the addition of some more advanced features. These calculators are used in the study of
mathematics, science, engineering and others.Different types of calculators are available for
solving math's problems. Some companies also offer calculators which can be used for general
purposes along with the study of mathematics and science.

Basic requirement while using scientific calculator for math’s


There are two types of scientific calculators, one which is used for the simplification of math’s
problems and other which can be used to solve problems related to trigonometry, geometry and
algebra.

1. The mathematical problem which has to be solved should be typed in the calculator using
correct syntax.

2. The direction of keys on the calculator should be kept as same as the direction on a standard
calculator.

3. The input key of the scientific calculator has to be pressed first, followed by the mathematical
operator key.

4. Wrong input should be checked thoroughly before getting started on a problem, since this can
lead to wrong calculation.

5. Wrong input should be corrected immediately to avoid any incorrect result.

6. Different types of storage functions are available on a calculator such as memory and register.

7. A scientific calculator can also be used to solve problems related to geometry, algebra and
trigonometry.

Scientific calculators can be used for general purpose to solve problems related to operations,
roots and fractions. This type of calculator is useful when a problem requires a number of steps
to be performed.In mathematics, a scientific calculator can be used to solve problems related to
square roots and other roots, operations with fractions and polynomials, algebraic expressions
and other types of functions.These calculators can be used to solve problems related to
logarithms, trigonometric equations and exponential functions.

16
Python Tkinter − Tkinter is the Python interface to the Tk GUI toolkit shipped with Python.

Tkinter is the standard GUI library for Python. Python when combined with Tkinter
provides a fast and easy way to create GUI applications. Tkinter provides a powerful
object-oriented interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform
the following steps −
• Import the Tkinter module.
• Create the GUI application main window.
• Add one or more of the above-mentioned widgets to the GUI application.
• Enter the main event loop to take action against each event triggered by the
user.

Example

#!/usr/bin/python

import Tkinter
top = Tkinter.Tk()
# Code to add widgets will go here...
top.mainloop()

This would create a following window –

17
Tkinter Widgets
Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI
application. These controls are commonly called widgets.

Sr.No. Operator & Description

1 Button

The Button widget is used to display buttons in your application.

2 Canvas
The Canvas widget is used to draw shapes, such as lines, ovals, polygons and
rectangles, in your application.

3 Checkbutton
The Checkbutton widget is used to display a number of options as checkboxes. The user
can select multiple options at a time.

4 Entry
The Entry widget is used to display a single-line text field for accepting values from a
user.

5 Frame
The Frame widget is used as a container widget to organize other widgets.

6 Label
The Label widget is used to provide a single-line caption for other widgets. It can also
contain images.

7 Listbox
The Listbox widget is used to provide a list of options to a user.

8 Menubutton
The Menubutton widget is used to display menus in your application.

9 Menu
The Menu widget is used to provide various commands to a user.

18
10 Message
The Message widget is used to display multiline text fields for accepting values from a
user.

11 Radiobutton
The Radiobutton widget is used to display a number of options as radio buttons. The
user can select only one option at a time.

12 Scale
The Scale widget is used to provide a slider widget.

13 Scrollbar
The Scrollbar widget is used to add scrolling capability to various widgets, such as list
boxes.

14 Text
The Text widget is used to display text in multiple lines.

15 Toplevel
The Toplevel widget is used to provide a separate window container.

16 Spinbox
The Spinbox widget is a variant of the standard Tkinter Entry widget, which can be used
to select from a fixed number of values.

17 PanedWindow
A PanedWindow is a container widget that may contain any number of panes, arranged
horizontally or vertically.

18 LabelFrame
A labelframe is a simple container widget. Its primary purpose is to act as a spacer or
container for complex window layouts.

19 tkMessageBox
This module is used to display message boxes in your applications.

19
Program Code Of Scientific Calculator

from tkinter import *


import math
import tkinter.messagebox

root = Tk()
root.title("Scientific Calculator")
root.configure(background = 'white')
root.resizable(width=False, height=False)
root.geometry("480x568+450+90")
calc = Frame(root)
calc.grid()

class Calc():
def init (self):
self.total=0
self.current=''
self.input_value=True
self.check_sum=False
self.op=''
self.result=False

def numberEnter(self, num):


self.result=False
firstnum=txtDisplay.get()
secondnum=str(num)
if self.input_value:
self.current = secondnum
self.input_value=False
else:
if secondnum == '.':
if secondnum in firstnum:
return
self.current = firstnum+secondnum
self.display(self.current)

def sum_of_total(self):
self.result=True
self.current=float(self.current)
if self.check_sum==True:

20
self.valid_function()
else:
self.total=float(txtDisplay.get())

def display(self, value):


txtDisplay.delete(0, END)
txtDisplay.insert(0, value)

def valid_function(self):
if self.op == "add":
self.total += self.current
if self.op == "sub":
self.total -= self.current
if self.op == "multi":
self.total *= self.current
if self.op == "divide":
self.total /= self.current
if self.op == "mod":
self.total %= self.current
self.input_value=True
self.check_sum=False
self.display(self.total)

def operation(self, op):


self.current = float(self.current)
if self.check_sum:
self.valid_function()
elif not self.result:
self.total=self.current
self.input_value=True
self.check_sum=True
self.op=op
self.result=False

def Clear_Entry(self):
self.result = False
self.current = "0"
self.display(0)
self.input_value=True

def All_Clear_Entry(self):
self.Clear_Entry()
self.total=0

def pi(self):

21
self.result = False
self.current = math.pi
self.display(self.current)

def tau(self):
self.result = False
self.current = math.tau
self.display(self.current)

def e(self):
self.result = False
self.current = math.e
self.display(self.current)

def mathPM(self):
self.result = False
self.current = -(float(txtDisplay.get()))
self.display(self.current)

def squared(self):
self.result = False
self.current = math.sqrt(float(txtDisplay.get()))
self.display(self.current)

def cos(self):
self.result = False
self.current = math.cos(math.radians(float(txtDisplay.get())))
self.display(self.current)

def cosh(self):
self.result = False
self.current = math.cosh(math.radians(float(txtDisplay.get())))
self.display(self.current)

def tan(self):
self.result = False
self.current = math.tan(math.radians(float(txtDisplay.get())))
self.display(self.current)

def tanh(self):
self.result = False
self.current = math.tanh(math.radians(float(txtDisplay.get())))
self.display(self.current)

def sin(self):

22
self.result = False
self.current = math.sin(math.radians(float(txtDisplay.get())))
self.display(self.current)

def sinh(self):
self.result = False
self.current = math.sinh(math.radians(float(txtDisplay.get())))
self.display(self.current)

def log(self):
self.result = False
self.current = math.log(float(txtDisplay.get()))
self.display(self.current)

def exp(self):
self.result = False
self.current = math.exp(float(txtDisplay.get()))
self.display(self.current)

def acosh(self):
self.result = False
self.current = math.acosh(float(txtDisplay.get()))
self.display(self.current)

def asinh(self):
self.result = False
self.current = math.asinh(float(txtDisplay.get()))
self.display(self.current)

def expm1(self):
self.result = False
self.current = math.expm1(float(txtDisplay.get()))
self.display(self.current)

def lgamma(self):
self.result = False
self.current = math.lgamma(float(txtDisplay.get()))
self.display(self.current)

def degrees(self):
self.result = False
self.current = math.degrees(float(txtDisplay.get()))
self.display(self.current)

def log2(self):

23
self.result = False
self.current = math.log2(float(txtDisplay.get()))
self.display(self.current)

def log10(self):
self.result = False
self.current = math.log10(float(txtDisplay.get()))
self.display(self.current)

def log1p(self):
self.result = False
self.current = math.log1p(float(txtDisplay.get()))
self.display(self.current)

added_value = Calc()

txtDisplay = Entry(calc, font=('Helvetica',20,'bold'),


bg='black',fg='white',
bd=30,width=28,justify=RIGHT)
txtDisplay.grid(row=0,column=0, columnspan=4, pady=1)
txtDisplay.insert(0,"0")

numberpad = "789456123"
i=0
btn = []
for j in range(2,5):
for k in range(3):
btn.append(Button(calc, width=6, height=2,
bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,text=numberpad[i]))
btn[i].grid(row=j, column= k, pady = 1)
btn[i]["command"]=lambda x=numberpad[i]:added_value.numberEnter(x)
i+=1

btnClear = Button(calc, text=chr(67),width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold')
,bd=4, command=added_value.Clear_Entry
).grid(row=1, column= 0, pady = 1)

btnAllClear = Button(calc, text=chr(67)+chr(69),


width=6, height=2,
bg='powder blue',
font=('Helvetica',20,'bold'),

24
bd=4,
command=added_value.All_Clear_Entry
).grid(row=1, column= 1, pady = 1)

btnsq = Button(calc, text="\u221A",width=6, height=2,


bg='powder blue', font=('Helvetica',
20,'bold'),
bd=4,command=added_value.squared
).grid(row=1, column= 2, pady = 1)

btnAdd = Button(calc, text="+",width=6, height=2,


bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.operation("add")
).grid(row=1, column= 3, pady = 1)

btnSub = Button(calc, text="-",width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.operation("sub")
).grid(row=2, column= 3, pady = 1)

btnMul = Button(calc, text="x",width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.operation("multi")
).grid(row=3, column= 3, pady = 1)

btnDiv = Button(calc, text="/",width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.operation("divide")
).grid(row=4, column= 3, pady = 1)

btnZero = Button(calc, text="0",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.numberEnter(0)
).grid(row=5, column= 0, pady = 1)

btnDot = Button(calc, text=".",width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.numberEnter(".")
).grid(row=5, column= 1, pady = 1)

25
btnPM = Button(calc, text=chr(177),width=6,
height=2,bg='powder blue', font=('Helvetica',20,'bold'),
bd=4,command=added_value.mathPM
).grid(row=5, column= 2, pady = 1)

btnEquals = Button(calc, text="=",width=6,


height=2,bg='powder blue',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.sum_of_total
).grid(row=5, column= 3, pady = 1)
# ROW 1 :
btnPi = Button(calc, text="pi",width=6,
height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.pi
).grid(row=1, column= 4, pady = 1)

btnCos = Button(calc, text="Cos",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.cos
).grid(row=1, column= 5, pady = 1)

btntan = Button(calc, text="tan",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.tan
).grid(row=1, column= 6, pady = 1)

btnsin = Button(calc, text="sin",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.sin
).grid(row=1, column= 7, pady = 1)

# ROW 2 :
btn2Pi = Button(calc, text="2pi",width=6,
height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.tau
).grid(row=2, column= 4, pady = 1)

btnCosh = Button(calc, text="Cosh",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),

26
bd=4,command=added_value.cosh
).grid(row=2, column= 5, pady = 1)

btntanh = Button(calc, text="tanh",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.tanh
).grid(row=2, column= 6, pady = 1)

btnsinh = Button(calc, text="sinh",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.sinh
).grid(row=2, column= 7, pady = 1)

# ROW 3 :
btnlog = Button(calc, text="log",width=6,
height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.log
).grid(row=3, column= 4, pady = 1)

btnExp = Button(calc, text="exp",width=6, height=2,


bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.exp
).grid(row=3, column= 5, pady = 1)

btnMod = Button(calc, text="Mod",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=lambda:added_value.operation("mod")
).grid(row=3, column= 6, pady = 1)

btnE = Button(calc, text="e",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.e
).grid(row=3, column= 7, pady = 1)

# ROW 4 :
btnlog10 = Button(calc, text="log10",width=6,
height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.log10

27
).grid(row=4, column= 4, pady = 1)

btncos = Button(calc, text="log1p",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.log1p
).grid(row=4, column= 5, pady = 1)

btnexpm1 = Button(calc, text="expm1",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd = 4,command=added_value.expm1
).grid(row=4, column= 6, pady = 1)

btngamma = Button(calc, text="gamma",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.lgamma
).grid(row=4, column= 7, pady = 1)
# ROW 5 :
btnlog2 = Button(calc, text="log2",width=6,
height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.log2
).grid(row=5, column= 4, pady = 1)

btndeg = Button(calc, text="deg",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.degrees
).grid(row=5, column= 5, pady = 1)

btnacosh = Button(calc, text="acosh",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.acosh
).grid(row=5, column= 6, pady = 1)

btnasinh = Button(calc, text="asinh",width=6,


height=2,bg='black',fg='white',
font=('Helvetica',20,'bold'),
bd=4,command=added_value.asinh
).grid(row=5, column= 7, pady = 1)

lblDisplay = Label(calc, text = "Scientific Calculator",

28
font=('Helvetica',30,'bold'),
bg='black',fg='white',justify=CENTER)

lblDisplay.grid(row=0, column= 4,columnspan=4)

def iExit():
iExit = tkinter.messagebox.askyesno("Scientific Calculator",
"Do you want to exit ?")
if iExit>0:
root.destroy()
return

def Scientific():
root.resizable(width=False, height=False)
root.geometry("944x568+0+0")

def Standard():
root.resizable(width=False, height=False)
root.geometry("480x568+0+0")

menubar = Menu(calc)

# ManuBar 1 :
filemenu = Menu(menubar, tearoff = 0)
menubar.add_cascade(label = 'File', menu = filemenu)
filemenu.add_command(label = "Standard", command = Standard)
filemenu.add_command(label = "Scientific", command = Scientific)
filemenu.add_separator()
filemenu.add_command(label = "Exit", command = iExit)

# ManuBar 2 :
editmenu = Menu(menubar, tearoff = 0)
menubar.add_cascade(label = 'Edit', menu = editmenu)
editmenu.add_command(label = "Cut")
editmenu.add_command(label = "Copy")
editmenu.add_separator()
editmenu.add_command(label = "Paste")

root.config(menu=menubar)

root.mainloop()

29
Output Of The Above Program

Standard Calculator

30
Scientific Calculator

31

You might also like