Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 2.02 KB

File metadata and controls

68 lines (54 loc) · 2.02 KB

Python GUI Calculator 📱

Python Version License

A simple graphical user interface calculator implemented in Python using the Tkinter library.

📜 About

This project demonstrates how to create a basic calculator with a graphical user interface using Python's Tkinter library. It's an excellent example for learning GUI programming basics and implementing mathematical operations in a user-friendly way.

✨ Features

  • Basic arithmetic operations (addition, subtraction, multiplication, division)
  • Percentage calculations
  • Clear functionality
  • Error handling for invalid expressions
  • User-friendly interface
  • Responsive design

🚀 Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/fahadelahikhan/Python-GUI-Calculator.git
    cd Python-GUI-Calculator
  2. Run the calculator:

    python Basic_Calculator.py

Basic Usage

# The calculator provides a graphical interface with buttons for numbers and operations
# Example calculation: 5 + 3 * 2
# Click the buttons in the following order:
# 5 -> + -> 3 -> * -> 2 -> =
# The result will be displayed in the entry field

Example Calculation

# Calculate (5 + 3) * 2 using the calculator
# Click sequence:
# 5 -> + -> 3 -> ) -> * -> 2 -> =
# Result: 16

📖 Documentation

How It Works

The calculator works by:

  1. Capturing user input through button clicks
  2. Building an expression string
  3. Evaluating the expression using Python's eval() function with safety checks
  4. Displaying the result or error message

The mathematical operations follow standard order of operations:

Parentheses -> Exponents -> Multiplication/Division -> Addition/Subtraction

⚖️ License

Distributed under the MIT License. See LICENSE for details.


Note: This implementation is for educational purposes. Always be cautious when evaluating expressions from untrusted sources.