0% found this document useful (0 votes)
79 views27 pages

Cs Project

Uploaded by

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

Cs Project

Uploaded by

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

G. H.

Raisoni Public School

Project Report on
Simple GUI calculator
Session 2022-2023

Submitted By: Submitted To:


Dharnish Ghai Madhuri Kale
Class: XII-A PGT(CS)
ACKNOWLEDGEMENT

I would like to express my great appreciation to Ms. Madhuri Kale


Ma’am for her valuable and constructive suggestions during the planning
and development of this project.

I would also like to sincerely thank Mrs. Pooja Mahawadiwar Ma’am,


our principal for her co-ordination in extending every possible support
for the competition of this project.

Finally, I wish to thank my parents and friends for their support and
encouragement throughout the completion of this project.

Date: Name: Dharnish Ghai


Class: XII -A
CERTIFICATE

The project report titled Simple GUI Calculator. Submitted


by Dharnish Ghai of Class XII for the CBSE Senior
Secondary Examination Class XII of Computer Science at G.
H. Raisoni Public School , Nagpur has been examined.

Date Internal Examiner Signature

School Seal External Examiner Signature

Principal Signature
TABLE OF CONTENTS

Sr. No. Contents Page No.


1. Introduction
2. Objective of the Project
3. Scope of the Project
4. The Existing System
5. Proposed System
6. Input/Output Requirements
7. Hardware & Software Requirements
8. System Design
9. Flow Chart
10. Source Code
11. Output
12. Future Scope of Project
13. Conclusion
14. Bibliography
INTRODUCTION

PYTHON

Python is a widely used high-level programming


language for general-purpose programming, created by
Guido van Rossum and first released in 1991.
Python features a dynamic type system and automatic
memory management and supports multiple
programming paradigms, including object-oriented,
imperative, functional programming, and
procedural styles. It has a large and comprehensive
standard library. It is meant to be an easily readable
language. Its formatting is visually uncluttered, and
it often uses English keywords where other languages
use punctuation.
Objective of the Project

The objective of this project is to let the students apply the programming
k knowledge into a real world situation/problem and exposed the students h
h how programming skills helps in developing a good software.

 Write programs utilizing modern software tools.

 Apply object oriented programming principles effectively when


developing small to medium sized projects.

 Write effective procedural code to solve small to medium sized


problems.

 Students will demonstrate a breadth of knowledge in computer science,


as exemplified in the areas of systems, theory and software
development.

 Students will demonstrate ability to conduct a research or applied


Computer Science project, requiring writing and presentation skills
which exemplify scholarly style in computer science.
Scope of the Project

1. Install Python IDLE


2. Importing the module-tkinter
3. Create the main window (container)
4. Add any number of widgets to the main window
5. Apply the event Trigger on the widgets.
6. Write functionality of each button onclick() event
7. Display output in Textbar control
8. Give function to reset or clear screen
9. It may be extended by giving any additional mathematic functions.
The Existing System

The traditional calculators work by processing information


in binary form. We're used to thinking of numbers in our
normal base-ten system, in which there are ten digits to work
with: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The binary number system
is a base-two system, which means there are only two digits to
work with: 0 and 1 Thus when you input numbers into a
calculator, the integrated circuits converts those numbers to
binary strings of 0s and 1s.
Drawbacks:
 The existing system of calculators are is available in variety of brands,
and each brand and model requires a specific set of instructions to
operate.
 The machine needs to be carried as a whole and might be misplaced or
damaged.
 Price is always a factor. Calculators don’t come in dimes a dozen. And
some of those advanced scientific ones are more than capable of
burning a huge hole in your pocket. Then, comes the question of
batteries and all. So, in a nutshell, we can easily say that the expensive
price tag of a calculator is its biggest downside of all.
The Proposed System
A GUI based simple calculator using the Python Tkinter module, which
can perform basic arithmetic operations addition, subtraction,
multiplication, and division which is also easy to interpret without an
instruction manual.

Benefits:
 Layered approach
The layered approach used in designing Tkinter gives Tkinter all of the
advantages of the TK library. Therefore, at the time of creation, Tkinter
inherited from the benefits of a GUI toolkit that had been given time to
mature. This makes early versions of Tkinter a lot more stable and
reliable than if it had been rewritten from scratch. Moreover, the
conversion from Tcl/Tk to Tkinter is really trivial, so that Tk
programmers can learn to use Tkinter very easily.
 Accessibility
Tkinter is very intuitive, and therefore quick and painless. The Tkinter
implementation hides the detailed and complicated calls in simple,
intuitive methods. This is a continuation of the Python way of thinking,
since the language excels at quickly building prototypes. It is therefore
expected that its preferred GUI library be implemented using the same
approach.
 Free to use functionality
GUI calculator can be used on any device with a python program and the
source code. It is free of charge and is more reliable than traditional
calculators.
Input and output Requirements

INPUT:

The goal of designing input data is to make things easy, logical


aand free from errors as possible. Programmer has to ensure what
akind of input should displayed on pressing buttons. User need to
aselect combination of numbers and operators for performing
amathematical operations. The pre-requisite for developing GUI
abased Calculator is the tools like Python IDE, Tkinter GUI toolkit.
aLatest operating system with compatible Python version will also
abe needed to continue development.

OUTPUT:

The primary output of any GUI based Calculator is the


amathematical result. Apart from basic arithmetic operations,
anumeric values and operators selection are displayed on result
ascreen when pressed the respective buttons from GUI region.
Hardware and Software Requirements

Recommended System Requirements:


Processors: Intel® CoreTM i3 processor 4300M at 2.60 GHz.
Disk space: 2 to 4 GB.
Operating systems: Windows® 10, MACOS, and UBUNTU.
Python Versions: 3.9.6 or Higher.
Minimum System Requirements:
Processors: Intel Atom® processor or Intel® CoreTM i3 processor.
Disk space: 1 GB.
Operating systems: Windows 7 or later, MACOS, and UBUNTU.
System Design

A life cycle model maps the various activities performed on a software


product from its inception to retirement. Different life cycle models may
plan the necessary development activities to phases in different ways.
Thus, no element which life cycle model is followed, the essential
activities are contained in all life cycle models though the action may be
carried out in distinct orders in different life cycle models. During any life
cycle stage, more than one activity may also be carried out. SDLC Cycle
represents the process of developing software.
SDLC framework includes the following steps:
1: Planning and requirement analysis

Requirement Analysis is the most important and necessary stage in SDLC.


Planning for the quality assurance requirements and identifications of risks
associated with the projects is also done at this stage. Once the requirement is
understood, the SRS (Software Requirement Specification) document is created.
The developers should thoroughly follow this document and also should be
reviewed by the customer for future reference.
2: Defining Requirements

Once the requirement analysis is done, the next stage is to certainly represent
and document the software requirements and get them accepted from the project
stakeholders.

This is accomplished through "SRS"- Software Requirement Specification


document which contains all the product requirements to be constructed and
developed during the project life cycle.

3: Designing the Software

The next phase is about to bring down all the knowledge of requirements,
analysis, and design of the software project. This phase is the product of the last
two, like inputs from the customer and requirement gathering.

4: Developing the project

In this phase of SDLC, the actual development begins, and the programming is
built. The implementation of design begins concerning writing code. Developers
have to follow the coding guidelines described by their management and
programming tools like compilers, interpreters, debuggers, etc. are used to
develop and implement the code.

5: Testing

After the code is generated, it is tested against the requirements to make sure
that the products are solving the needs addressed and gathered during the
requirements stage.

During this stage, unit testing, integration testing, system testing, acceptance
testing are done.

6: Deployment

Once the software is certified, and no bugs or errors are stated, then it is
deployed.

Then based on the assessment, the software may be released as it is or with


suggested enhancement in the object segment.

After the software is deployed, then its maintenance begins.


7: Maintenance

Once when the client starts using the developed systems, then the real issues
come up and requirements to be solved from time to time.

This procedure where the care is taken for the developed product is known as
maintenance.
Flowchart
Source Code

# Python program to create a simple GUI


# calculator using Tkinter

# import everything from tkinter module


from tkinter import *

# globally declare the expression variable


expression = ""

# Function to update expression


# in the text entry box
def press(num):
# point out the global expression variable
global expression

# concatenation of string
expression = expression + str(num)

# update the expression by using set method


equation.set(expression)
# Function to evaluate the final expression
def equalpress():
# Try and except statement is used
# for handling the errors like zero
# division error etc.

# Put that code inside the try block


# which may generate the error
try:

global expression

# eval function evaluate the expression


# and str function convert the result
# into string
total = str(eval(expression))

equation.set(total)

# initialize the expression variable


# by empty string
expression = ""
# if error is generate then handle
# by the except block
except:

equation.set(" error ")


expression = ""

# Function to clear the contents


# of text entry box
def clear():
global expression
expression = ""
equation.set("")

# Driver code
if __name__ == "__main__":
# create a GUI window
gui = Tk()
# set the background colour of GUI window
gui.configure(background="light green")
# set the title of GUI window
gui.title("Simple Calculator")

# set the configuration of GUI window


gui.geometry("540x360")

# StringVar() is the variable class


# we create an instance of this class
equation = StringVar()

# create the text entry box for


# showing the expression .
expression_field = Entry(gui, textvariable=equation)

# grid method is used for placing


# the widgets at respective positions
# in table like structure .
expression_field.grid(columnspan=4, ipadx=70)
# create a Buttons and place at a particular
# location inside the root window .
# function affiliated to that button is executed .
button1 = Button(gui, text=' 1 ', fg='black', bg='red',
command=lambda: press(1), height=1, width=7)
button1.grid(row=2, column=0)

button2 = Button(gui, text=' 2 ', fg='black', bg='red',


command=lambda: press(2), height=1, width=7)
button2.grid(row=2, column=1)

button3 = Button(gui, text=' 3 ', fg='black', bg='red',


command=lambda: press(3), height=1, width=7)
button3.grid(row=2, column=2)

button4 = Button(gui, text=' 4 ', fg='black', bg='red',


command=lambda: press(4), height=1, width=7)
button4.grid(row=3, column=0)

button5 = Button(gui, text=' 5 ', fg='black', bg='red',


command=lambda: press(5), height=1, width=7)
button5.grid(row=3, column=1)

button6 = Button(gui, text=' 6 ', fg='black', bg='red',


command=lambda: press(6), height=1, width=7)
button6.grid(row=3, column=2)
button7 = Button(gui, text=' 7 ', fg='black', bg='red',
command=lambda: press(7), height=1, width=7)
button7.grid(row=4, column=0)

button8 = Button(gui, text=' 8 ', fg='black', bg='red',


command=lambda: press(8), height=1, width=7)
button8.grid(row=4, column=1)

button9 = Button(gui, text=' 9 ', fg='black', bg='red',


command=lambda: press(9), height=1, width=7)
button9.grid(row=4, column=2)

button0 = Button(gui, text=' 0 ', fg='black', bg='red',


command=lambda: press(0), height=1, width=7)
button0.grid(row=5, column=0)

plus = Button(gui, text=' + ', fg='black', bg='red',


command=lambda: press("+"), height=1, width=7)
plus.grid(row=2, column=3)

minus = Button(gui, text=' - ', fg='black', bg='red',


command=lambda: press("-"), height=1, width=7)
minus.grid(row=3, column=3)
multiply = Button(gui, text=' * ', fg='black', bg='red',
command=lambda: press("*"), height=1, width=7)
multiply.grid(row=4, column=3)

divide = Button(gui, text=' / ', fg='black', bg='red',


command=lambda: press("/"), height=1, width=7)
divide.grid(row=5, column=3)

equal = Button(gui, text=' = ', fg='black', bg='red',


command=equalpress, height=1, width=7)
equal.grid(row=5, column=2)

clear = Button(gui, text='Clear', fg='black', bg='red',


command=clear, height=1, width=7)
clear.grid(row=5, column='1')

Decimal= Button(gui, text='.', fg='black', bg='red',


command=lambda: press('.'), height=1, width=7)
Decimal.grid(row=6, column=0)
# starting the GUI
gui.mainloop()
Output
FUTURE SCOPE OF THE PROJECT

In a nutshell, it can be summarized that the future scope this project


Lies in value additions to the development in hand.

 Function of square roots and square of numbers.


 Advance Function of modular or percentage could be added.
 Inverse Functions.
 Trigonometric Functions.
 Differential Equations can be resolved with development.
CONCLUSION

 The implemented system will be able to perform simple arithmetic


operations which usually take up a lot of time.
 This system will resolve the need to carry a calculator manually and
repairing requirements.
 No project is perfect and complete. There will always be a scope of
improvement in this system.
BIBLIOGRAPHY
www.geeksforgeeks.com
www.pythonguides.com
www.pythonworld.in
www.w3schools.com
Sumita Arora- Computer Science with python 12th

You might also like