rich.live¶
-
class
rich.live.
Live
(renderable: Optional[Union[rich.console.ConsoleRenderable, rich.console.RichCast, str]] = None, *, console: Optional[rich.console.Console] = None, screen: bool = False, auto_refresh: bool = True, refresh_per_second: float = 4, transient: bool = False, redirect_stdout: bool = True, redirect_stderr: bool = True, vertical_overflow: typing_extensions.Literal[crop, ellipsis, visible] = 'ellipsis', get_renderable: Optional[Callable[], Union[rich.console.ConsoleRenderable, rich.console.RichCast, str]]] = None)[source]¶ Renders an auto-updating live display of any given renderable.
- Parameters
renderable (RenderableType, optional) – The renderable to live display. Defaults to displaying nothing.
console (Console, optional) – Optional Console instance. Default will an internal Console instance writing to stdout.
screen (bool, optional) – Enable alternate screen mode. Defaults to False.
auto_refresh (bool, optional) – Enable auto refresh. If disabled, you will need to call refresh() or update() with refresh flag. Defaults to True
refresh_per_second (float, optional) – Number of times per second to refresh the live display. Defaults to 1.
transient (bool, optional) – Clear the renderable on exit (has no effect when screen=True). Defaults to False.
redirect_stdout (bool, optional) – Enable redirection of stdout, so
print
may be used. Defaults to True.redirect_stderr (bool, optional) – Enable redirection of stderr. Defaults to True.
vertical_overflow (VerticalOverflowMethod, optional) – How to handle renderable when it is too tall for the console. Defaults to “ellipsis”.
get_renderable (Callable[[], RenderableType], optional) – Optional callable to get renderable. Defaults to None.
-
process_renderables
(renderables: List[rich.console.ConsoleRenderable]) → List[rich.console.ConsoleRenderable][source]¶ Process renderables to restore cursor and display progress.
-
property
renderable
¶ Get the renderable that is being displayed
- Returns
Displayed renderable.
- Return type
RenderableType
-
start
(refresh=False) → None[source]¶ Start live rendering display.
- Parameters
refresh (bool, optional) – Also refresh. Defaults to False.
-
update
(renderable: Union[rich.console.ConsoleRenderable, rich.console.RichCast, str], *, refresh: bool = False) → None[source]¶ Update the renderable that is being displayed
- Parameters
renderable (RenderableType) – New renderable to use.
refresh (bool, optional) – Refresh the display. Defaults to False.