2026
Advanced Calculator
- Python
- Tkinter
- unittest
- PyInstaller
- Inno Setup
Overview
A standard and scientific desktop calculator inspired by the Windows Calculator, built with Python and Tkinter. Expressions are evaluated by a hand-written recursive descent parser with correct operator precedence, without using eval(). Supports trigonometric functions (degrees/radians), logarithms, factorial, percentages and implicit multiplication. Includes a history panel, memory keys, light/dark themes and Windows-compatible keyboard shortcuts. Covered by 17 unit tests and distributed as a Windows installer built with PyInstaller and Inno Setup.
01 · Problem
Most calculator projects evaluate expressions with eval(). That is unsafe and skips the genuinely hard parts: operator precedence, implicit multiplication and floating-point errors.
02 · Solution
I wrote a recursive descent parser that first splits the expression into tokens and then handles each precedence level in its own function. Evaluation, formatting, history and the UI live in separate modules; the Tkinter interface offers standard and scientific modes, a history panel, memory keys, light/dark themes and Windows-compatible keyboard shortcuts.
03 · Outcome
The evaluation engine is verified by 17 unit tests and correctly shows results such as 0.1 + 0.2 = 0.3 and sin(180°) = 0. The app ships as an installer built with PyInstaller and Inno Setup, so it runs on computers without Python.