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.
- Date and Time Calculations: Supports date and time arithmetic and conversion (e.g., "2024-11-13 + 2d", "now - 2 weeks").
Getting Started
Prerequisites
- Python 3.x
- PyQt5
- Pint
- NumPy
- Pyparsing
Installation
- Clone the repository:
git clone https://github.com/tovam/unacalc
- Change to the project directory:
cd unacalc
- 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).
Example Expressions
5 m + 3 m10 kg * 9.81 m/s^2100 W * 2 h in Wh100 m in cm1e3 kg * 9.81 m/s^2 in N2024-06-08T19:45:10 + 5 month
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Release files for unacalc 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unacalc-1.0.3.tar.gz | 22.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unacalc-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.5 kB
Release files / unacalc-1.0.3.tar.gz
| Download URL | unacalc-1.0.3.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d26ac264a131c5a9e2dfc9acee972fd9f492da496dfe651f8caa73c2de3647b0
|
|
BLAKE2b-256 checksum How to use checksums |
1870802884e5d258d50afc42b99cc6da5de1dea0b2242cab46892105e2287e94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.8.10
|
Release files / unacalc-1.0.3-py3-none-any.whl
| Download URL | unacalc-1.0.3-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50e751bb5e7228e98fbd3933263880b41f8dd2eefd678664db8bf67375969abf
|
|
BLAKE2b-256 checksum How to use checksums |
fc81233496ba5ae3e008d3157b3c04006a461ee2f4d716a91a470c88aa77a6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.8.10
|