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 progress 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 (
Sequence) – sequence to iterate throughtotal (
int) – total number of iterationsdesc (
str) – text shown on the right of the progress bardisable (
bool) – don’t show the display barmaximum_refresh_time (
float) – refresh the progress bar at least everymaximum_refresh_timeseconds, using another thread. IfNone, no refreshing is enforced
- Return type
tqdm- Returns
progress bar object