rs_rich.interact¶
Generated from the type stubs by scripts/gen_python_api.py; do not edit.
rs_rich.interact: interactive components (rs-rich-interact; no Rich counterpart).
Components: Select and MultiSelect (fuzzy pickers over Items whose
values are any Python objects), Input (one line, masked with
password=True), TextArea (several lines), Confirm (with
Choices), Form, Pager, FilePicker (a path), ColorPicker (a
colour string) and AssetPicker (an emoji, box style or spinner).
Subclass Component (render(context), handle(event), keymap()) to
write your own; any object with handle(event) and render(width, height)
is a component too (Event, Done, Cancel, Ignored).
Composition: Column, Row and Stack lay children along an axis,
Split puts two side by side or stacked, Tabs shows one at a time, and
Layers opens Layers (modals and popovers) over a base. Built-ins, your
own components and containers mix; Map says what a child's answer means,
Label shows markup, and Keymap and Binding declare keys, which
keymap(component) lists.
Drivers:
ask(component, **options)(orcomponent.ask()) runs it on the terminal and returns the answer; Escape raisesCancelledand Ctrl+CKeyboardInterrupt.runreturns theOutcomeinstead.- Without a terminal the
fallbackdecides:"prompt"asks line by line,"default"returns the component's default,"error"raisesNotInteractive. headless(component, script)runs it with scripted keys and returns aRecordof the painted frames;degrade(component, answers)runs the line-prompt fallback with scripted answers. Tests use these.
fuzzy and rank are the pickers' matcher.
Cancelled ¶
Bases: InteractError
InteractError ¶
Bases: Exception
NotInteractive ¶
Bases: InteractError