Skip to main content

PyPI version

Rich Interactive

Extends the Rich python library with interactive layouts and tables, allowing seamless navigation and interaction via keyboard shortcuts

Installation

pip install rich_interactive

or using poetry

poetry add rich_interactive

Interactive Tables

You can create interactive tables that can be easily navigated, and you can switch the selection to any of the rows.

from rich import print
from rich.style import Style
from rich_interactive.interactive_table import InteractiveTable as Table

table = Table(
    selected_row=2,
    rotate_selection=True,
    selected_row_style=Style(bgcolor="red"),
)
table.add_column("#")
table.add_column("Column 1")

for row in range(3):
    table.add_row(f"{row}", f"Row {row}")

print("Initial table")
print(table)

table.move_selection_down()

print("Table after moving selection down")
print(table)

Interactive Layouts

You can create interactive layouts that can be easily navigated, and you can switch the selection to any of the children.

from rich.console import Console
from rich.text import Text

from rich_interactive.interactive_panel import InteractivePanel as Panel
from rich_interactive.interactive_layout import InteractiveLayout as Layout


console = Console(width=60, height=15)

layout = Layout()
layout.split(
    Layout(name="header", size=5),
    Layout(name="main", size=5),
    Layout(name="footer", size=5),
)

for child in layout.children:
    child.update(Panel(Text(child.name, style="yellow")))

print("Initial layout:")
print(layout)

layout.switch_selection()

print("After switching selection:")
print(layout)

Future plans

My personal goal, is to prepare a good quality package, which would enable easy navigation with keyboard, like this:

(Disclaimer: functionality shown in this gif is still in PoC stage, and it is not production ready yet)

Release files for rich_interactive 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rich_interactive 0.6.0
File Size Uploaded
rich_interactive-0.6.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich_interactive 0.6.0
File Interpreter ABI Platform
rich_interactive-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / rich_interactive-0.6.0.tar.gz

Download URL rich_interactive-0.6.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
54884e061849aea1190aa6e83a154e73ab48ad17594b4f848f5fa1de388ae10c
BLAKE2b-256 checksum
How to use checksums
6d5b3344f245f81276faa4ebdd5354d1eeccb74e7b46b6d32be22e3dd72d30f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Darwin/23.4.0

Release files / rich_interactive-0.6.0-py3-none-any.whl

Download URL rich_interactive-0.6.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb725ecf1b43f549f22c9db0fafa095698a9683717e29fae07d62df5503feeeb
BLAKE2b-256 checksum
How to use checksums
9672422a533c46dbfbc569ae63d73b72f74ea87c1ac31f1008d37519eeef905b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Darwin/23.4.0

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page