How-to guides

Pick the task you need to solve, from tracking a download to keeping several jobs visible at once. For a first progress bar, start with the tutorial.

Each recording shows the output you can build with its guide. Scroll a recording horizontally if the terminal is wider than your screen.

Track your work

Add progress to a loop

See how far your loop has got without managing the bar’s lifecycle. Wrap an iterable directly, or reuse a bar you have already configured.

Track a transfer’s size and speed

Show how many bytes have moved, the average transfer speed and the recent rate. Combine three widgets to see both progress and changes in speed.

Show activity without a known total

Keep a moving marker and a count of completed items when you can’t calculate a percentage. Use it for streams, scans and other open-ended work.

Bring your tqdm-style arguments

Keep familiar desc and total arguments when moving a loop to progressbar2. See how widgets display units and live status, and which tqdm arguments don’t carry over.

Manage several jobs

Give each job its own bar

Watch jobs advance and finish independently in one display. MultiBar manages their rows and redraws them together. Run the example locally, since its background thread isn’t available in the browser.

Place independent bars on fixed rows

Assign each bar a line_offset when you want to manage the rows yourself. The guide also covers keeping other output out of those rows.

Run a batch in parallel

Watch three files advance at different speeds with progressbar.map. Each worker reports its own progress, while the overall bar counts finished files. Run this example locally.

Keep output readable

Print messages above the bar

Keep ordinary print() messages on their own lines while progress updates underneath. Enable redirect_stdout and keep printing from your loop.

Keep logging output above the bar

Route messages from Python’s logging handlers above the progress display. Wrap existing handlers, then restore their streams when the work finishes.

Keep every update in a log

Print a fresh line for each update when output goes to a file or log collector. Use line_breaks to control the behaviour explicitly.

Customise the display

Add colour and gradients

Change a bar’s colour as it approaches completion, or give a marker a fixed colour. The guide covers terminal colour support as well as the widgets.

Display your own widget

Show Phase: preparing, processing and finishing as the job advances. Write a callable that supplies that text and place it before the bar.

Show a value from your loop

Count errors while scanning log records. Errors increases only when a record contains an error, while the bar tracks every record scanned. A Variable widget reads that count from bar.update().

Put live values in labels

Show the current filename and file number before the bar, with the processed block count after it. Each file advances in twenty small steps, so you can watch the labels change as the work moves from one file to the next.