A desktop calculator application built with Python and PyQt5, featuring a clean dark-themed UI and standard arithmetic operations.
- 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
| Layer | Technology |
|---|---|
| Language | Python 3 |
| GUI Framework | PyQt5 ≥ 5.15.0 |
| Package Manager | uv |
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
- Python 3.x
uvpackage manager orpip
Using uv (recommended):
git clone https://github.com/imashwini09/calculator.git
cd calculator
uv syncUsing pip:
git clone https://github.com/imashwini09/calculator.git
cd calculator
pip install PyQt5>=5.15.0Via the shell script:
bash run.shOr directly with Python:
python calculator_app.pyThe 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.
| Button | Operation |
|---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
% |
Modulo |
. |
Decimal point |
AC |
Clear all / Reset |
= |
Calculate result |
- Dividing by zero displays
Erroron screen. - Any unexpected computation error resets the calculator state gracefully.
- Results are rounded to 6 decimal places and trailing zeros are removed.
Contributions are welcome! Feel free to fork the repo, make your changes, and open a pull request.
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m "Add your feature" - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
This project is open source. See the repository for details.
Made with ❤️ by imashwini09