Skip to content

rs_rich.console

Generated from the type stubs by scripts/gen_python_api.py; do not edit.

rich.console: the Console and the render protocol's types.

Capture

get

get() -> str

CaptureError

Bases: Exception

Capture.get called before the with block ended.

Console

file instance-attribute

file: IO[str]

width instance-attribute

width: int

height instance-attribute

height: int

size instance-attribute

size: ConsoleDimensions

quiet instance-attribute

quiet: bool

soft_wrap instance-attribute

soft_wrap: bool

record instance-attribute

record: bool

is_interactive instance-attribute

is_interactive: bool

highlighter instance-attribute

highlighter: Callable[[Union[str, Text]], Text]

is_terminal property

is_terminal: bool

is_dumb_terminal property

is_dumb_terminal: bool

color_system property

color_system: Optional[str]

encoding property

encoding: str

no_color property

no_color: bool

legacy_windows property

legacy_windows: bool

safe_box property

safe_box: bool

tab_size property

tab_size: int

stderr property

stderr: bool

is_alt_screen property

is_alt_screen: bool

get_time property

get_time: Callable[[], float]

get_datetime property

get_datetime: Callable[[], Any]

options property

options: ConsoleOptions

print

print(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, no_wrap: Optional[bool] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, width: Optional[int] = None, height: Optional[int] = None, crop: bool = True, soft_wrap: Optional[bool] = None, new_line_start: bool = False) -> None

out

out(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, highlight: Optional[bool] = None) -> None

log

log(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, log_locals: bool = False, _stack_offset: int = 1) -> None

rule

rule(title: str = '', *, characters: str = '─', style: Optional[StyleType] = None, align: AlignMethod = 'center') -> None

line

line(count: int = 1) -> None

clear

clear(home: bool = True) -> None

bell

bell() -> None

show_cursor

show_cursor(show: bool = True) -> bool

set_alt_screen

set_alt_screen(enable: bool = True) -> bool

update_screen

update_screen(renderable: RenderableType, *, region: Optional[Tuple[int, int, int, int]] = None, options: Optional[ConsoleOptions] = None) -> None

update_screen_lines

update_screen_lines(lines: List[List[Segment]], x: int = 0, y: int = 0) -> None

input

input(prompt: Union[str, Text, None] = None, *, markup: bool = True, emoji: bool = True, password: bool = False, stream: Optional[IO[str]] = None) -> str

print_json

print_json(json: Optional[str] = None, *, data: Any = None, indent: Union[None, int, str] = 2, highlight: bool = True, skip_keys: bool = False, ensure_ascii: bool = False, check_circular: bool = True, allow_nan: bool = True, default: Optional[Callable[[Any], Any]] = None, sort_keys: bool = False) -> None

measure

measure(renderable: RenderableType, *, options: Optional[ConsoleOptions] = None) -> Measurement

render

render(renderable: RenderableType, options: Optional[ConsoleOptions] = None) -> List[Segment]

render_lines

render_lines(renderable: RenderableType, options: Optional[ConsoleOptions] = None, *, style: Optional[StyleType] = None, pad: bool = True, new_lines: bool = False) -> List[List[Segment]]

render_str

render_str(text: str, *, style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None) -> Text

get_style

get_style(name: StyleType, *, default: Optional[StyleType] = None) -> Style

push_theme

push_theme(theme: Theme, *, inherit: bool = True) -> None

pop_theme

pop_theme() -> None

use_theme

use_theme(theme: Theme, *, inherit: bool = True) -> ThemeContext

capture

capture() -> Capture

begin_capture

begin_capture() -> None

end_capture

end_capture() -> str

export_text

export_text(*, clear: bool = True, styles: bool = False) -> str

save_text

save_text(path: str, *, clear: bool = True, styles: bool = False) -> None

export_html

export_html(*, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, inline_styles: bool = False) -> str

save_html

save_html(path: str, *, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, inline_styles: bool = False) -> None

export_svg

export_svg(*, title: str = 'Rich', theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None) -> str

save_svg

save_svg(path: str, *, title: str = 'Rich', theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None) -> None

push_render_hook

push_render_hook(hook: Any) -> None

pop_render_hook

pop_render_hook() -> None

set_live

set_live(live: Any) -> bool

clear_live

clear_live() -> None

set_window_title

set_window_title(title: str) -> bool

status

status(*args: Any, **kwargs: Any) -> Any

pager

pager(*args: Any, **kwargs: Any) -> Any

screen

screen(*args: Any, **kwargs: Any) -> Any

print_exception

print_exception(*args: Any, **kwargs: Any) -> Any

ConsoleDimensions

Bases: NamedTuple

width instance-attribute

width: int

height instance-attribute

height: int

ConsoleOptions

legacy_windows instance-attribute

legacy_windows: bool

min_width instance-attribute

min_width: int

max_width instance-attribute

max_width: int

is_terminal instance-attribute

is_terminal: bool

encoding instance-attribute

encoding: str

max_height instance-attribute

max_height: int

justify instance-attribute

justify: Optional[JustifyMethod]

overflow instance-attribute

overflow: Optional[OverflowMethod]

no_wrap instance-attribute

no_wrap: Optional[bool]

highlight instance-attribute

highlight: Optional[bool]

markup instance-attribute

markup: Optional[bool]

height instance-attribute

height: Optional[int]

size property

size: ConsoleDimensions

ascii_only property

ascii_only: bool

copy

copy() -> ConsoleOptions

update

update(*, width: int = ..., min_width: int = ..., max_width: int = ..., justify: Optional[JustifyMethod] = ..., overflow: Optional[OverflowMethod] = ..., no_wrap: Optional[bool] = ..., highlight: Optional[bool] = ..., markup: Optional[bool] = ..., height: Optional[int] = ...) -> ConsoleOptions

update_width

update_width(width: int) -> ConsoleOptions

update_height

update_height(height: int) -> ConsoleOptions

reset_height

reset_height() -> ConsoleOptions

update_dimensions

update_dimensions(width: int, height: int) -> ConsoleOptions

Group

rich.console.Group: several renderables, one after another.

fit instance-attribute

fit: bool

renderables property

renderables: List[RenderableType]

PagerContext

pager property

pager: Pager

styles property

styles: bool
links: bool

ScreenContext

console property

console: Console

hide_cursor property

hide_cursor: bool

screen property

screen: Screen

update

update(*renderables: RenderableType, style: Optional[StyleType] = None) -> None

ThemeContext

group

group(fit: bool = True) -> Callable[[Callable[..., Iterable[RenderableType]]], Callable[..., Group]]

rich.console.group: make a function returning renderables return a Group.