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.1.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.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartcalc-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 6e660be02e9c2554bbab1f7cba7a681f2b693941334ec709e564869a18c4f845
MD5 b8200abc0859f6177847178e7c009845
BLAKE2b-256 73dd92fbd9d8566e3cccd40a46bbc3f2671ce4e8cf23953c3818064753e4145f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartcalc-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64181713146085b4452a89986cb8c504bba925c30636aabcf4b162c3da7b9794
MD5 2e94b97b0a3638ca89cb8d1a8b59ec84
BLAKE2b-256 0b59765215c937c0281a1d0b97be86eed6b825ab89e4a1d457ab4637c7193093

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