rich.padding

class rich.padding.Padding(renderable, pad=(0, 0, 0, 0), *, style='none', expand=True)[ソース]

コンテンツの周りにスペースを描画します。

>>> print(Padding("Hello", (2, 4), style="on blue"))
パラメータ
  • renderable (RenderableType) – 文字列またはその他のレンダリング可能なもの。

  • pad (Union[int, Tuple[int]]) – 上、右、下、左の境界線のパディング。1、2、または 4 つの整数 (CSS スタイル) で指定できます。

  • style (Union[str, Style], optional) – パディング文字のスタイル。デフォルトは "none"。

  • expand (bool, optional) – 利用可能な幅に合わせてパディングを拡張します。デフォルトは True。

classmethod indent(renderable, level)[ソース]

インデントをレンダリングするためのパディングインスタンスを作成します。

パラメータ
  • renderable (RenderableType) – 文字列またはその他のレンダリング可能なもの。

  • level (int) – インデントする文字数。

戻り値

パディングインスタンス。

戻り値の型

パディング

static unpack(pad)[ソース]

CSSスタイルで指定されたパディングをアンパックします。

パラメータ

pad (Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int, int]]) –

戻り値の型

Tuple[int, int, int, int]