Skip to main content

A minimal calculator with keyboard control dark & lite themes.

Project description

🧮 SmartCalc

A minimalistic, keyboard-driven one-line calculator powered by Pygame.

It features a dark/light Tokyo Night-inspired theme, supports:

  • variable assignments (result = 3+5),
  • post-assignments (12**3 > c) c now equals 1728,
  • accumulation (227 >> c), if both line calculated c = 1995,
  • input history navigation,
  • and beautifully formatted numeric output.

Bare essentials outside and a beast inside

✨ More Features

  • ✅ One-line interactive input interface
  • ✅ Variable assignment (a = 5) and accumulation (2 + 3 >> total)
  • ✅ Keyboard-only navigation — no mouse required
  • ✅ Tokyo Night color scheme (dark/light switchable)
  • ✅ Auto-scaling font size to fit long results
  • ✅ Right-aligned results with underscore-separated formatting (10_000)
  • ✅ Input history navigation with ↑ and ↓ arrows

🎮 Controls

Key Action
Enter Evaluate expression
Backspace Delete one character
T Toggle dark/light theme
↑ / ↓ Recall previous/next inputs

📦 Requirements

  • Python 3.10+
  • pygame (tested with 2.5+)

Install Pygame via pip if you haven't already:

uv add pygame
# or
pip install pygame

🔤 Supported Syntax

  • Standard math: 1 + 2 * 3 - 4 / 2

  • Variables:

    a = 5
    b = 10
    a + b
    
  • Post-assignment (accumulator):

    10 >> total
    5 >> total   # total now becomes 15
    
  • Most Python math operators: +, -, *, /, **, %

  • Last result is stored in _


🔧 Fonts

The app uses FiraCode Nerd Font for crisp symbols and readability.

  • It will be used by default from fonts/FiraCodeNerdFont-Regular.ttf.
  • If not, the system’s default font will be used as fallback.

To install FiraCode Nerd Font manually:


🚀 Running the App

calc  # if installed via uv tool install smartcalc
# or
uv run core.py  # if downloaded from git
# or
python core.py

Make sure the FiraCodeNerdFont-Regular.ttf in fonts/ directory.


📂 Project Structure

smartcalc/
├── __init__.py
├── core.py
└── fonts/
    └── FiraCodeNerdFont-Regular.ttf

pyproject.toml
README.md

🛠️ Future Ideas

  • Cursor movement and editing (←, →)
  • Scrollable history buffer
  • Command-line launch options (e.g. --theme=light)
  • User-defined functions
  • Save/load variable memory

📝 License

This project is licensed under the GNU General Public License.


Made with 💻 and ☕ by Sergey Samoylov

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

smartcalc-0.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smartcalc-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file smartcalc-0.1.0.tar.gz.

File metadata

  • Download URL: smartcalc-0.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for smartcalc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79768a977792b7d2bb488b8951a21507cd1d2e8284f5389758f7b983ffcc15e4
MD5 bf8709c418fe1ab34c2114c8a9e91efe
BLAKE2b-256 869e86946c584b92c5a7f48a825ac50a75003a72b66f2aadecf52c298541d234

See more details on using hashes here.

File details

Details for the file smartcalc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: smartcalc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for smartcalc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23756d50263af541710a254f471d8af7429f9d6bfbfd207ef88ac5c77b13a2f4
MD5 2022185720e9e5990c42721533f8ecfc
BLAKE2b-256 596c0e96fa7948aa3e659ef43b88c48417d349adb7e514aaf97a988d484e5e04

See more details on using hashes here.

Supported by

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