0% found this document useful (0 votes)
320 views14 pages

A Micro Project On "Gui Calculator Using Tkinter": Submitted in Partial Fulfillment of The Requirement For The Award of

python microporject for diploma

Uploaded by

78-suraj phirke
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)
320 views14 pages

A Micro Project On "Gui Calculator Using Tkinter": Submitted in Partial Fulfillment of The Requirement For The Award of

python microporject for diploma

Uploaded by

78-suraj phirke
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/ 14

A

Micro Project
On

“Gui Calculator Using Tkinter”

Submitted in partial fulfillment of the requirement for the award of


Diploma of Engineering
in
Computer Engineering
By

Suraj Phirke
Aman Mansuri
Soham more
Dhiraj Mahajan
Deep lad

under the guidance of

Prof. Sonal Naik

Department of Computer Engineering


2023 - 2024
CERTIFICATE

VIVA COLLEGE OF DIPLOMA ENGINEERING & TECHNOLOGY


VIRAR (W)
2023-24

This is to certify that the micro project entitled “Gui Calculator Using Tkinter” has
been submitted under the guidance of Prof. Sonal Naik in partial fulfillment of the
requirement for the award of Diploma of Engineering in Computer Engineering from
Maharashtra State Board of Technical Education.

“Gui Calculator Using Tkinter ”


GROUP MEMBERS

36.Suraj Phirke
37.Aman Mansuri
38.Soham More
39.Dhiraj Mahajan
40.Deep Lad

Project Guide H.O. D


Prof. Sonal Naik Prof. Poonam Jadhav
INDEX

Sr. Name of the Page


No. topic no.
PART –A PLAN
1 Brief Introduction 1
2 Aim of the Micro-Project 2
3 Resources Required 3

PART –B OUTCOMES
1 Brief Description 4
2 Course Outcomes Integrated 6
3 Actual Procedure Followed 7
4 Outputs of the Micro-Projects 9
5 Skill Developed 11
Gui Calculator Using Tkinter PWP 22616 , Sem VI

PART-A PLAN
1.0 Brief Introduction

Graphical User Interfaces (GUIs) represent a cornerstone in modern software development, offering
users an intuitive and interactive means of interacting with applications. Tkinter, Python's native GUI
library, stands as a powerful and accessible toolkit for crafting GUI-based applications. This guide
delves into the realm of GUI development using Tkinter, focusing on the construction of a basic
calculator application. Through a step-by-step exploration, readers will gain a comprehensive
understanding of Tkinter's functionalities, interface design principles, event handling mechanisms, and
the integration of basic arithmetic operations within the GUI framework.

Tkinter, renowned for its simplicity and versatility, serves as an ideal starting point for novice
developers venturing into GUI programming. Before diving into the construction of our calculator
application, it's essential to grasp the fundamentals of Tkinter. Understanding Tkinter's history, its
integration with Python, and the installation process lays a solid foundation for subsequent development
endeavors.

With a firm grasp of Tkinter's fundamentals, we embark on the journey of building our GUI calculator.
Beginning with the establishment of the project structure, we create the main application window using
Tkinter's Tk() class. We proceed to design the layout of our calculator interface, leveraging Tkinter's
plethora of widgets such as buttons, labels, and entry fields to create an intuitive user interface.

Central to the success of any GUI application is its user interface design. In crafting our calculator's
interface, we delve into layout management techniques, including grid and pack, to arrange widgets
systematically. Moreover, we explore styling options to enhance the visual appeal of our application,
ensuring a seamless and aesthetically pleasing user experience.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 1


Gui Calculator Using Tkinter PWP 22616 , Sem VI

2.0 AIM of Micro-Project

1. Introduction to GUI development with Tkinter in Python.


2. Practical demonstration of creating a basic calculator interface.
3. Explanation of utilizing Tkinter widgets like buttons and entry fields.
4. Illustration of handling user interactions for arithmetic operations.
5. Providing a foundational understanding for further exploration in GUI development

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 2


Gui Calculator Using Tkinter PWP 22616 , Sem VI

3.0 resources Required

Sr. Name of Specification Remarks


No Resource
1 Computer HP processor-Intel
System (R)Core (TM) is
9400T
CPU@1.80GHZ
Ram 8 GB
2 Software Visual Studio Code
Package

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 3


Gui Calculator Using Tkinter PWP 22616 , Sem VI

PART-B OUTCOME

1.0 Brief Description

Graphical User Interfaces (GUIs) represent a cornerstone in modern software development, offering users
an intuitive and interactive means of interacting with applications. Tkinter, Python's native GUI library,
stands as a powerful and accessible toolkit for crafting GUI-based applications. This guide delves into the
realm of GUI development using Tkinter, focusing on the construction of a basic calculator application.
Through a step-by-step exploration, readers will gain a comprehensive understanding of Tkinter's
functionalities, interface design principles, event handling mechanisms, and the integration of basic
arithmetic operations within the GUI framework.

Tkinter, renowned for its simplicity and versatility, serves as an ideal starting point for novice developers
venturing into GUI programming. Before diving into the construction of our calculator application, it's
essential to grasp the fundamentals of Tkinter. Understanding Tkinter's history, its integration with Python,
and the installation process lays a solid foundation for subsequent development endeavors.

With a firm grasp of Tkinter's fundamentals, we embark on the journey of building our GUI calculator.
Beginning with the establishment of the project structure, we create the main application window using
Tkinter's Tk() class. We proceed to design the layout of our calculator interface, leveraging Tkinter's
plethora of widgets such as buttons, labels, and entry fields to create an intuitive user interface.

Central to the success of any GUI application is its user interface design. In crafting our calculator's
interface, we delve into layout management techniques, including grid and pack, to arrange widgets
systematically. Moreover, we explore styling options to enhance the visual appeal of our application,
ensuring a seamless and aesthetically pleasing user experience.

With the user interface in place, we shift our focus to implementing calculator functionalities. Leveraging
Python's built-in arithmetic operators, we incorporate basic arithmetic operations such as addition,
subtraction, multiplication, and division into our calculator. Furthermore, we handle user interactions,
including button clicks and keyboard input, to execute calculations accurately and responsively.

Error handling and input validation are paramount to ensuring a robust and reliable user experience. In this
regard, we implement robust error handling mechanisms, such as exception handling, to gracefully handle
errors that may arise during calculation. Additionally, we integrate input validation to prevent invalid
inputs, thereby enhancing the reliability of our calculator.

A great GUI application extends beyond mere functionality; it endeavors to deliver an exceptional user
experience. To this end, we explore strategies for enhancing the user experience of our calculator. We delve
into features such as keyboard shortcuts, tooltip hints, and custom themes, aiming to make our application
more user-friendly and engaging.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 4


Gui Calculator Using Tkinter PWP 22616 , Sem VI

While our basic calculator fulfills its primary purpose, incorporating advanced features can elevate its
functionality to new heights. In this vein, we explore advanced features such as memory functions for
storing and recalling values, scientific mode with trigonometric functions, and history logs to track past
calculations.

Testing and debugging are indispensable components of the software development lifecycle. In this chapter,
we discuss various testing strategies, including manual testing, unit testing, and integration testing, to
identify and rectify bugs effectively. Through rigorous testing, we ensure the reliability and robustness of
our calculator application.
1. Intuitive Design: The calculator boasts an intuitive design with clear buttons for numbers and
operators, making it easy for users to input expressions.

2. Error Handling: The application includes robust error handling mechanisms to gracefully manage
syntax errors and other exceptions, providing a seamless user experience.

3. Responsive Interface: The GUI is responsive, providing instant feedback to user interactions such
as button clicks, ensuring a smooth and interactive user experience.

4. Scalability: While the current version supports basic arithmetic operations, the codebase is modular
and extensible, making it easy to incorporate additional features or expand functionality in future
iterations.

5. Customization: The calculator's appearance and behavior can be customized further to suit specific
preferences or requirements, allowing for personalization and adaptation to diverse use cases.

6. Educational Value: This project serves as an educational resource for individuals looking to learn
GUI development with Tkinter, offering insights into GUI design principles, event handling, and
Python programming concepts.

7. Platform Independence: Since Tkinter is a cross-platform GUI toolkit, the calculator application can
run seamlessly on various operating systems such as Windows, macOS, and Linux without any
modifications.
8.
9. Community Support: Being a popular library, Tkinter enjoys extensive community support, with
ample documentation, tutorials, and online resources available for further learning and
troubleshooting.

10. Project-based Learning: Developing the GUI Calculator using Tkinter provides hands-on
experience in project-based learning, reinforcing concepts learned through practical implementation
and experimentation.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 5


Gui Calculator Using Tkinter PWP 22616 , Sem VI

2.0 Course Outcomes (CO)

b) Develop a Python program to demonstrate use of operators.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG 6


Gui Calculator Using Tkinter PWP-22616, Sem VI

3.0 Actual Procedure Followed

 Algorithm Of Program

1. Start.
2. Initialize Calculator class inheriting from tk.Tk, set title, geometry, and create
StringVar.
3. Create entry widget for result and buttons for numbers, operators, decimal, and
equals.
4. Handle button clicks, evaluate expression for "=", append text otherwise.
5. Bind buttons to click events.
6. Instantiate Calculator if script is main.
7. Start main loop for GUI.
8. Set window title and geometry.
9. Initialize StringVar for result.
10.Create entry widget.
11.Create buttons.
12.Grid entry and buttons for layout.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG. 7


Gui Calculator Using Tkinter PWP-22616, Sem VI

PROGRAM CODE:
import tkinter as tk

class Calculator(tk.Tk):
def __init__(self):
super().__init__()
self.title("Calculator")
self.geometry("400x400")
self.result_var = tk.StringVar()
self.create_widgets()

def create_widgets(self):
# Entry to display the result
entry = tk.Entry(self, textvariable=self.result_var, font=("Arial", 24), bd=10)
entry.grid(row=0, column=0, columnspan=4)
# Buttons for numbers and operators
buttons = [
("7", 1, 0), ("8", 1, 1), ("9", 1, 2), ("/", 1, 3),
("4", 2, 0), ("5", 2, 1), ("6", 2, 2), ("*", 2, 3),
("1", 3, 0), ("2", 3, 1), ("3", 3, 2), ("-", 3, 3),
("0", 4, 0), (".", 4, 1), ("+", 4, 2), ("=", 4, 3),]

for (text, row, col) in buttons:


button = tk.Button(self, text=text, font=("Arial", 18), width=5, height=2, command=lambda
t=text: self.on_button_click(t))
button.grid(row=row, column=col)

def on_button_click(self, text):


if text == "=":
try:
expression = self.result_var.get()
result = eval(expression)
self.result_var.set(result)
except:
self.result_var.set("Error")
else:
current_text = self.result_var.get()
new_text = current_text + text
self.result_var.set(new_text)

if __name__ == "__main__":
app = Calculator()
app.mainloop()

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG. 8


Gui Calculator Using Tkinter PWP-22616, Sem VI

4.0 Outputs of Micro-Projects

ADDITION:

SUBSTRACTION:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG. 9


Gui Calculator Using Tkinter PWP-22616, Sem VI

MULTIPLICATION:

DIVISION:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG. 10


Gui Calculator Using Tkinter PWP-22616, Sem VI

5.0 Skill Developed

Therefor we learned that this provided readers with a comprehensive


exploration of GUI development using Tkinter through the construction of a basic calculator
application. By leveraging Tkinter's functionalities, designing an intuitive user interface,
implementing calculator functionalities, and enhancing the user experience, readers have
gained practical experience in GUI development with Tkinter. Armed with this knowledge,
readers are well-equipped to embark on further exploration and experimentation in GUI
programming, laying the groundwork for future projects and endeavors.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG. 11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy