Skip to main content

Unacalc: A Unit-Aware Calculator

Project description

Unacalc, the Unit-Aware Calculator

This project is a unit-aware calculator application developed using PyQt5 for the graphical user interface and Pint for handling units of measurement. It allows users to input and evaluate mathematical expressions that include units, providing accurate results with unit conversions.

Features

  • Unit Management: Supports unit conversions and arithmetic using the Pint library.
  • Expression Parsing: Parses mathematical expressions, recognizing numbers, units, and operations using the Pyparsing library.
  • Arithmetic Operations: Supports addition, subtraction, multiplication, division, and exponentiation.
  • Auto Calculation: Automatically calculates and displays the result as the user types.
  • Unit Conversion: Enables unit conversion within expressions using the "in" keyword (e.g., "100 m in cm").
  • Intuitive GUI: Features an easy-to-use interface with an input field, result display, and a grid of buttons for input.
  • Error Handling: Displays error messages for invalid expressions.
  • Keyboard Input: Supports keyboard input for digits, operators, and backspace.

Getting Started

Prerequisites

  • Python 3.x
  • PyQt5
  • Pint
  • NumPy
  • Pyparsing

Installation

  1. Clone the repository:
    git clone https://github.com/tovam/unacalc
    
  2. Change to the project directory:
    cd unacalc
    
  3. Install the required packages:
    pip install -r requirements.txt
    

Running the Calculator

To start the calculator application, run:

python unacalc.py

Usage

  • Enter mathematical expressions directly into the input field.
  • Use the buttons to input numbers and operators.
  • The result is automatically calculated and displayed in the result field.
  • Use the "in" keyword to convert units (e.g., 100 m in cm).
  • Press the "=" button or hit Enter to evaluate the expression.

Example Expressions

  • 5 m + 3 m
  • 10 kg * 9.81 m/s^2
  • 100 W * 2 h in Wh
  • 100 m in cm
  • 1e3 kg * 9.81 m/s^2 in N

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unacalc-1.0.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

unacalc-1.0.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file unacalc-1.0.1.tar.gz.

File metadata

  • Download URL: unacalc-1.0.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for unacalc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e562ad605a75c3aadccd8f2406595b4658c38d4919c8c07dec4249dd83c0400d
MD5 32c5b0c8f9e00540a372c759524e0210
BLAKE2b-256 5d2b07aa0ce40a988cfb10c84d4e666d99a77b9fe0bdceee727ffc26e243e0ba

See more details on using hashes here.

File details

Details for the file unacalc-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: unacalc-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for unacalc-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9ba509680ea6f64575ede03380349d4f0b9ae23357a78d8c85a63ee9d5ae61a
MD5 267a781a01a07b83807e163f6eb65a22
BLAKE2b-256 5ec9b24018771577c94f871496ea7c90dacd6512541ba9f00af197e33a97e9f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page