Skip to main content

Python SDK for the rstui graphical terminal runtime

Project description

rstui

Python child SDK for the rstui graphical terminal runtime.

python3 -m pip install rstui
cargo install rstui
from rstui import Frame, run

def on_event(event, context):
    return "render" if event["type"] == "start" else "continue"

def render(context):
    width = context["geometry"]["pixel_width"]
    height = context["geometry"]["pixel_height"]
    return Frame(width, height, bytes(width * height * 4))

run(on_event, render)

Run the application with:

rstui run -- python3 app.py

stdout is reserved for the framed protocol. Write diagnostics to stderr.

Adaptive Matplotlib dashboard

Install the optional adapter and define only the grid, spans, and panel content:

python3 -m pip install 'rstui[matplotlib]'
from rstui import run
from rstui.matplotlib import Dashboard, Panel

def draw_chart(panel):
    axes = panel.axes()
    axes.plot([0, 1], [0, 1])

page = Dashboard(
    columns=(2, 1),
    rows=(1,),
    panels=(
        Panel("chart", draw_chart, row=0, column=0, title="Chart"),
        Panel("details", draw_details, row=0, column=1, title="Details"),
    ),
)

run(on_event, page.render)

panel.axes() is already constrained to that panel. Full-screen pixels, terminal cells, resize, borders, titles, and framebuffer placement remain rstui responsibilities. Use Insets only when a chart needs extra panel-local room for tick labels.

Project: https://github.com/maokangkun/Terminal/tree/main/rstui

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

rstui-0.2.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

rstui-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file rstui-0.2.0.tar.gz.

File metadata

  • Download URL: rstui-0.2.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rstui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a78b9591de51d477bd007d6d48e11e55125b5448c5cc8ca9b8f2c7bc164b62fe
MD5 7f95b616a2bd5653417c78a3c87b65fe
BLAKE2b-256 be3f051fddd421b802ea9aef0f39b0d5bdb0bbcdbd1e415df9ccb0b7091117ac

See more details on using hashes here.

File details

Details for the file rstui-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rstui-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rstui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d804afa8df316d79cde4a80c4f19ecfb6f396a408c71be148fd2ea6264e9ecd
MD5 6c24a429df62f4f1daee93fcbdbcdb02
BLAKE2b-256 286a2fa5415a5583353f68986575d15fe83a9f442de0ecde505b86e8233a68f5

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