A lightweight desktop calculator built in C with GTK+ 3. The app supports expression input through on-screen buttons, high-precision arithmetic via bc -l, and a built-in calculation history panel.
- GTK+ 3 desktop UI with a compact keypad layout
- Expression evaluation through
bc -lfor floating-point math - Calculation history view with separate history clear (
CH) - Input controls: clear (
C), backspace (⌫), parentheses, decimal support - Error handling for invalid expressions (shows
Errorin display and history)
- Language: C
- UI Toolkit: GTK+ 3
- Evaluator:
bc - Build System: GNU Make +
pkg-config
Install the following before building:
gccmakepkg-config- GTK+ 3 development packages (
gtk+-3.0) bc
Example (Debian/Ubuntu):
sudo apt update
sudo apt install -y build-essential pkg-config libgtk-3-dev bcFrom the project root:
make
./calculatormake # build
make clean # remove object files and binary
make install # install binary to /usr/local/bin (sudo required)
make uninstall # remove binary from /usr/local/bin (sudo required)- Digits:
0-9 - Operators:
+,-,*,/ - Grouping:
(,) - Decimal point:
. =: evaluate current expressionC: clear current input⌫: delete last character (UTF-8 safe)CH: clear history panel
calculator/
├── main.c # GTK UI, button actions, expression evaluation, history handling
├── Makefile # build/install/uninstall targets
├── preview.png # application screenshot
└── .gitignore
- Expression results come from
bc -l, so behavior followsbcarithmetic rules. - The entry widget is intentionally read-only; inputs are driven by button clicks.
