Overview

A dark-themed calculator for desktop and Android, written in Python with Kivy and KivyMD. It brings standard calculation, scientific calculation, a history of past calculations and a unit converter together in one application.

Screenshots

Standard calculator screen showing an expression, a live result and the keypad
Standard calculator
Scientific calculator screen with trigonometric and logarithm keys and the DEG/RAD switch
Scientific keypad
Unit converter screen converting a value between two units
Unit converter

Problem addressed

Each of the tools has its own logic, and the challenge was keeping those separate pieces of logic in one place so that the finished program works as one product. The project began as a single large file whose calculation, formatting, layout and navigation were tangled together; it was audited, and rebuilt so that the calculation engine and the screens are separate.

Verified features

How it works

Implementation approach

The code follows one rule: the core package never imports Kivy, and the UI package never contains calculation logic. A screen sends a key name to a shared session object and shows the text that comes back. The core holds the parser, expression editing, formatting, the shared session, the history store and the converter tables; the UI holds the theme, widgets, keypad layouts (written as data rather than repeated markup) and one small class per screen. Adding a unit is one line in the converter tables.

Technologies

Python 3.9 or newer, Kivy and KivyMD (used for the app shell and icon names), the decimal module, JSON for saving history, and unittest. The layout is set up for a Buildozer build to Android.

Technical challenges documented

Status and evidence

In progress: not yet deployed. The calculation engine is covered by 65 unit tests that need no Kivy installed. The audit could not launch the Kivy and KivyMD screens in the environment where it was written; the application has since been installed and run, and it works as intended. The layout is designed for portrait orientation.