Skip to content

Repository files navigation

🧮 Calculator

A desktop calculator application built with Python and PyQt5, featuring a clean dark-themed UI and standard arithmetic operations.


✨ Features

  • Basic arithmetic: addition, subtraction, multiplication, division
  • Modulo (%) operation
  • Decimal point support
  • Error handling for division by zero
  • Live expression display (shows the ongoing operation as you type)
  • Scientific notation for very large/small numbers
  • AC (All Clear) to reset the calculator state
  • Keyboard-friendly button layout

🖥️ Tech Stack

Layer Technology
Language Python 3
GUI Framework PyQt5 ≥ 5.15.0
Package Manager uv

📁 Project Structure

calculator/
├── calculator_app.py   # Main Calculator class and UI logic
├── main.py             # Entry point (placeholder)
├── pyproject.toml      # Project metadata and dependencies
├── uv.lock             # Locked dependency versions
├── run.sh              # Shell script to run the app
├── .python-version     # Python version pin
└── .gitignore

🚀 Getting Started

Prerequisites

  • Python 3.x
  • uv package manager or pip

Installation

Using uv (recommended):

git clone https://github.com/imashwini09/calculator.git
cd calculator
uv sync

Using pip:

git clone https://github.com/imashwini09/calculator.git
cd calculator
pip install PyQt5>=5.15.0

Running the App

Via the shell script:

bash run.sh

Or directly with Python:

python calculator_app.py

🎨 UI Overview

The calculator has a dark theme with clearly distinguished button colors:

  • Red — AC (All Clear) button
  • Blue — Equals (=) button
  • Dark gray — Number and operator buttons with hover/press feedback

The display area shows the full expression while you're entering values (e.g., 42+) and updates to the result once = is pressed.


🔢 Supported Operations

Button Operation
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo
. Decimal point
AC Clear all / Reset
= Calculate result

⚠️ Error Handling

  • Dividing by zero displays Error on screen.
  • Any unexpected computation error resets the calculator state gracefully.
  • Results are rounded to 6 decimal places and trailing zeros are removed.

🤝 Contributing

Contributions are welcome! Feel free to fork the repo, make your changes, and open a pull request.

  1. Fork the repository
  2. Create a new branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "Add your feature"
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

📄 License

This project is open source. See the repository for details.


Made with ❤️ by imashwini09

About

A dark-themed desktop calculator built with Python and PyQt5. Supports basic arithmetic, decimal input, and live expression display.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages