nanopython  /  demos

Demos

Twelve self-contained showcases of what nanopython can do in a browser. Python does the computation, JavaScript does the rendering. Each demo is one HTML file, one app.js loader, one main.py — readable end-to-end.

Run Python

2 demos

Playground

Write Python, pick an example, lazy-fetch micropython-lib packages, pipe stdin, share via URL. Save scripts to localStorage.

Snippets

A simpler tour: eight pre-baked Python snippets (fibonacci, factorial, primes, quicksort, classes, comprehensions, FizzBuzz, hello).

UI & tools

5 demos

Todo list

TodoMVC-style list. Python owns the model and renders rows via the js bridge; event delegation routes clicks back; state persists in localStorage.

Pomodoro

Classic 25/5/15 work-break timer. Python runs the state machine, JavaScript ticks setInterval back into main.py once a second.

Calculator

Integer four-function calculator. Python drives the state machine; button clicks and keystrokes both feed the same handler.

Color picker

Linked HSL/RGB sliders with hex output. Python does the HSL↔RGB conversion on every slider event and paints the preview swatch.

Form validation

A shared validators.py module enforcing email, password, phone, and credit-card (Luhn) rules. Each form field is checked in Python on blur.

Visualization & simulation

5 demos

Dashboard

Python aggregates a sales dataset by region and month; KPIs and four chart sections come back over stdout. JavaScript renders them on Canvas2D.

Predator-prey

Lotka-Volterra dynamics. Python integrates the whole trajectory in one batch; JavaScript animates it and draws the phase plot.

Game of Life

Conway's cellular automaton on a 60×40 torus. Python evolves each generation and only redraws the cells that changed; click or drag to paint.

Reaction-diffusion

Gray-Scott solver on an 80×80 grid, integrated in Q-scaled integer math (no floats in the nano build). Drag on the canvas to seed the reaction.

Markdown editor

Live preview pane driven by Python. Each keystroke fires an input event into main.py, which parses the source and writes HTML straight to the DOM.