ReverseBar¶
ReverseBar draws a fill bar whose marker grows right to left.
It is Bar with the fill direction reversed: same arguments, same
behavior, marker growing from the right edge instead.
- class progressbar.widgets.ReverseBar(marker='#', left='|', right='|', fill=' ', fill_left=False, **kwargs)[source]
Bases:
BarA bar which has a marker that goes from right to left.
Create a Bar that fills from the right by default.
See Bar.__init__ for parameter meaning. fill_left defaults to False here instead of True.
Example¶
"""``ReverseBar`` draws a fill bar whose marker grows right to left.
Reach for it to visually contrast with a normal ``Bar`` -- for example a
pair of gauges that meet in the middle -- or any layout that reads
right-to-left. Everything else about it matches ``Bar``.
"""
import time
import progressbar
STEPS = 24
def main() -> None:
widgets = [progressbar.Percentage(), ' ', progressbar.ReverseBar()]
with progressbar.ProgressBar(max_value=STEPS, widgets=widgets) as bar:
for step in range(STEPS):
bar.update(step + 1)
time.sleep(0.005)
if __name__ == '__main__':
main()
See also¶
Bar: the same bar filling left to right.