rich.bar

class rich.bar.Bar(total: float = 100, completed: float = 0, width: int = None, pulse: bool = False, style: Union[str, Style] = 'bar.back', complete_style: Union[str, Style] = 'bar.complete', finished_style: Union[str, Style] = 'bar.finished', pulse_style: Union[str, Style] = 'bar.pulse', animation_time: float = None)[source]

Renders a (progress) bar.

Parameters
  • total (float, optional) – Number of steps in the bar. Defaults to 100.

  • completed (float, optional) – Number of steps completed. Defaults to 0.

  • width (int, optional) – Width of the bar, or None for maximum width. Defaults to None.

  • pulse (bool, optional) – Enable pulse effect. Defaults to False.

  • style (StyleType, optional) – Style for the bar background. Defaults to “bar.back”.

  • complete_style (StyleType, optional) – Style for the completed bar. Defaults to “bar.complete”.

  • finished_style (StyleType, optional) – Style for a finished bar. Defaults to “bar.done”.

  • pulse_style (StyleType, optional) – Style for pulsing bars. Defaults to “bar.pulse”.

  • animation_time (Optional[float], optional) – Time in seconds to use for animation, or None to use system time.

property percentage_completed

Calculate percentage complete.

update(completed: float, total: float = None) → None[source]

Update progress with new values.

Parameters
  • completed (float) – Number of steps completed.

  • total (float, optional) – Total number of steps, or None to not change. Defaults to None.