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.2.tar.gz (17.5 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.2-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartcalc-0.1.2.tar.gz
  • Upload date:
  • Size: 17.5 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.2.tar.gz
Algorithm Hash digest
SHA256 5ee06cc77fe370d4de79c1de6a5b2fc36c984f07c982fc98d09704b5b2b2bc14
MD5 b20bf65617c524329c729ca926a832fa
BLAKE2b-256 1103eca7177ec5161b28fa15feca77a9068de32199865311402a3f43eb36decb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartcalc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6a01ef6b8f974e219379a91e38de2c12dcea680ca0a8090505f7eddbaff521
MD5 f520af4c269a1bb6f9f1d7a382e70dbc
BLAKE2b-256 7f993de31fa56305e0c99c50a0203f4d8e76615ea2e4e145c8d162020c37f9c3

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