rich.align¶
- class rich.align.Align(renderable, align='left', style=None, *, vertical=None, pad=True, width=None, height=None)[源代码]¶
如有必要,可通过添加空格对齐可渲染对象。
- 参数
renderable (RenderableType) -- 一个可渲染的控制台。
align (AlignMethod) -- “Left”、“Center”或“Right”之一
style (StyleType, optional) -- 应用于背景的可选样式。
vertical (Optional[VerticalAlignMethod], optional) -- 可选垂直对齐,“上”、“中”或“下”之一。默认为无。
pad (bool, optional) -- 用空格填充右侧。默认为True。
width (int, optional) -- 将内容限制为给定的宽度,或无以使用默认宽度。默认为无。
height (int, optional) -- 设置可渲染对齐的高度,或设置无以适合内容。默认为无。
- 抛出
ValueError -- 如果
align
不是预期值之一。
- classmethod center(renderable, style=None, *, vertical=None, pad=True, width=None, height=None)[源代码]¶
将可渲染对象与中心对齐。
- classmethod left(renderable, style=None, *, vertical=None, pad=True, width=None, height=None)[源代码]¶
将可渲染对象左对齐。