Skip to content

API turboframe.ui.shadow

rafageist edited this page Dec 4, 2026 · 4 revisions

turboframe.ui.shadow

Source: turboframe/ui/shadow.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.

Turbo Vision drop shadows.

In Turbo Vision every window, dialog and menu casts a shadow two columns to the right and one row down; the cells under it keep their characters but are drawn dark gray on black. Textual has no notion of this, so screens that want it use a compositor that post-processes the composited lines: after the normal front-to-back composition, the shadow cells are restyled.

A shadow only darkens what is behind its caster: cells covered by anything in front of the caster (a window above it, an open menu) are left alone.

Contents

ShadowCompositor, ShadowScreen, casts_tv_shadow, compute_shadow_spans, darken, enabled, install_shadows, shadow_regions, shadow_style

class ShadowCompositor

class ShadowCompositor(Compositor)
ShadowCompositor(casts_shadow: Callable[[Widget], bool])

class ShadowScreen

class ShadowScreen(Screen)
ShadowScreen(*args, **kwargs)

A plain screen whose windows and menus cast Turbo Vision shadows.

casts_tv_shadow

def casts_tv_shadow(widget: Widget) -> bool

Windows, dialogs and drop-down menus cast shadows, as in Turbo Vision.

compute_shadow_spans

def compute_shadow_spans(widgets: Sequence[tuple[Widget, Region, Region]], casts_shadow: Callable[[Widget], bool]) -> tuple[Spans, list[Region]]

Shadow cells for a front-to-back list of (widget, region, clip).

Returns the cells to darken and the shadow rectangles (for dirty tracking).

darken

def darken(strip: Strip, start: int, end: int) -> Strip

Restyle cells [start, end) of strip as shadow, keeping the characters.

enabled

True

install_shadows

def install_shadows(screen: Screen, casts_shadow: Callable[[Widget], bool] = <function casts_tv_shadow>) -> None

Give screen a shadow-drawing compositor (call from its __init__); nothing when enabled is False.

shadow_regions

def shadow_regions(region: Region) -> list[Region]

The parts of region shifted by the shadow offset that region does not cover.

shadow_style

def shadow_style() -> Style

Turbo Vision's shadow (dark gray on black in the Borland palettes): every attribute off.

Clone this wiki locally