progress_bar()

audeer.progress_bar(iterable=None, *, total=None, desc=None, disable=False, maximum_refresh_time=None)[source]

Progress bar with optional text on the right.

If you want to show a constant description text during presenting the prgress bar, you can use it similar to:

for file in progress_bar(files, desc="Copying"):
    copy(file)

When the text should be updated as well, you have to explicitly do that in each step:

with progress_bar(files) as pbar:
    for file in pbar:
        desc = format_display_message(
            f"Copying {file}",
            pbar=True,
        )
        pbar.set_description_str(desc)
        pbar.refresh()
        copy(file)
        pbar.update()
Parameters
  • iterable (Optional[Sequence]) – sequence to iterate through

  • total (Optional[int]) – total number of iterations

  • desc (Optional[str]) – text shown on the right of the progress bar

  • disable (bool) – don’t show the display bar

  • maximum_refresh_time (Optional[float]) – refresh the progress bar at least every maximum_refresh_time seconds, using another thread. If None, no refreshing is enforced

Return type

tqdm

Returns

progress bar object