rich.live

class rich.live.Live(renderable=None, *, console=None, screen=False, auto_refresh=True, refresh_per_second=4, transient=False, redirect_stdout=True, redirect_stderr=True, vertical_overflow='ellipsis', get_renderable=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 4.

  • 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.

Return type

None

property is_started: bool

Check if live display has been started.

process_renderables(renderables)[source]

Process renderables to restore cursor and display progress.

Parameters

renderables (List[rich.console.ConsoleRenderable]) –

Return type

List[rich.console.ConsoleRenderable]

refresh()[source]

Update the display of the Live Render.

Return type

None

property renderable: Union[rich.console.ConsoleRenderable, rich.console.RichCast, str]

Get the renderable that is being displayed

Returns

Displayed renderable.

Return type

RenderableType

start(refresh=False)[source]

Start live rendering display.

Parameters

refresh (bool, optional) – Also refresh. Defaults to False.

Return type

None

stop()[source]

Stop live rendering display.

Return type

None

update(renderable, *, refresh=False)[source]

Update the renderable that is being displayed

Parameters
  • renderable (RenderableType) – New renderable to use.

  • refresh (bool, optional) – Refresh the display. Defaults to False.

Return type

None