calculator_gui
GUI Calculator
A simple yet efficient GUI-based calculator built with Python’s tkinter
library. The calculator performs basic arithmetic operations and features an intuitive and user-friendly interface.
🎯 Objective
To create a responsive and visually appealing calculator application that supports basic mathematical operations.
🛠️ Features
- Basic Operations:
- Perform addition, subtraction, multiplication, and division.
- Clear Button:
- Reset the calculator’s input field with a single click.
- Error Handling:
- Displays a user-friendly error message for invalid expressions.
- Equal Button:
- Evaluate the entered mathematical expression.
- Responsive UI:
- Dynamically resizes and adjusts to window size.
📦 Requirements
- Python 3.x
- Libraries:
tkinter
(pre-installed with Python)
🚀 How to Run
- Clone the repository or copy the source code into a Python file named
calculator.py
.
- Open your terminal or command prompt.
- Navigate to the directory containing the file.
- Run the script:
🖥️ Usage
- Launch the application by running the script.
- Use the buttons to perform operations:
- Enter numbers and arithmetic operators (
+
, -
, *
, /
) using the provided buttons.
- Clear (
C
): Resets the input field.
- Equal (
=
): Computes the result of the entered expression.
- Close the application by clicking the Exit button or using the standard close button on the window.
🛡️ Error Handling
- Invalid expressions (e.g.,
5++2
or 10/0
) are handled gracefully with an error message displayed in a popup.
Functional Demonstration:
- Enter a calculation (e.g.,
5+3
) and press =
:
- Press
C
to clear the display.
- Enter another calculation (e.g.,
10/2*3
) and press =
:
✨ Customization
You can modify the appearance of the calculator by changing:
- Colors: Adjust button, background, or text colors in the code.
- Fonts: Update the
font
attributes to suit your preferences.