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])

def draw_details(panel):
    axes = panel.axes()
    axes.set_axis_off()
    axes.text(0, 1, "Ready", va="top")

def on_event(event, context):
    return "render" if event["type"] in {"start", "resize"} else "continue"

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: rstui-0.2.2.tar.gz
  • Upload date:
  • Size: 10.6 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.2.tar.gz
Algorithm Hash digest
SHA256 17790222a645dc99b55d9de12866353dd921de89e7046145016d05c728bd617a
MD5 db4af64f111f5e55b5909391fd218704
BLAKE2b-256 8e11a245075af71446b06caeb255a8e4e1ec77d0ad37208921f82323223383ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rstui-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 edba7b302773bfaf8409e47297d6191561c7b17a12b612c3fe1d799afdfd6c7c
MD5 4492f2c042233286b5424dce17e64d88
BLAKE2b-256 47616604cd782aa1a02c84241a049139f2bb7feb54c7fa5778cd2a6fec482f37

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