rich.layout

class rich.layout.Layout(renderable: Optional[Union[rich.console.ConsoleRenderable, rich.console.RichCast, str]] = None, *, direction: str = 'vertical', size: Optional[int] = None, minimum_size: int = 1, ratio: int = 1, name: Optional[str] = None, visible: bool = True, height: Optional[int] = None)[source]

A renderable to divide a fixed height in to rows or columns.

Parameters
  • renderable (RenderableType, optional) – Renderable content, or None for placeholder. Defaults to None.

  • direction (str, optional) – Direction of split, one of “vertical” or “horizontal”. Defaults to “vertical”.

  • size (int, optional) – Optional fixed size of layout. Defaults to None.

  • minimum_size (int, optional) – Minimum size of layout. Defaults to 1.

  • ratio (int, optional) – Optional ratio for flexible layout. Defaults to 1.

  • name (str, optional) – Optional identifier for Layout. Defaults to None.

  • visible (bool, optional) – Visibility of layout. Defaults to True.

property children

Gets (visible) layout children.

get(name: str)Optional[rich.layout.Layout][source]

Get a named layout, or None if it doesn’t exist.

Parameters

name (str) – Name of layout.

Returns

Layout instance or None if no layout was found.

Return type

Optional[Layout]

property renderable

Layout renderable.

split(*layouts, direction: Optional[typing_extensions.Literal[horizontal, vertical]] = None)None[source]

Split the layout in to multiple sub-layours.

Parameters
  • *layouts (Layout) – Positional arguments should be (sub) Layout instances.

  • direction (Direction, optional) – One of “horizontal” or “vertical” or None for no change. Defaults to None.

property tree

Get a tree renderable to show layout structure.

update(renderable: Union[rich.console.ConsoleRenderable, rich.console.RichCast, str])None[source]

Update renderable.

Parameters

renderable (RenderableType) – New renderable object.