Skip to main content

A Python Progressbar library to provide visual (yet text based) progress to long running operations.

Project description

Travis status:

https://travis-ci.org/WoLpH/python-progressbar.png?branch=master

Coverage:

https://coveralls.io/repos/WoLpH/python-progressbar/badge.png?branch=master

Introduction

NOTE: This version has been completely rewritten and might not be 100% compatible with the old version. If you encounter any problems while using it please let me know: https://github.com/WoLpH/python-progressbar/issues

A text progress bar is typically used to display the progress of a long running operation, providing a visual cue that processing is underway.

The ProgressBar class manages the current progress, and the format of the line is given by a number of widgets. A widget is an object that may display differently depending on the state of the progress bar. There are many types of widgets:

  • Timer

  • ETA

  • AdaptiveETA

  • FileTransferSpeed

  • AdaptiveTransferSpeed

  • AnimatedMarker

  • Counter

  • Percentage

  • FormatLabel

  • SimpleProgress

  • Bar

  • ReverseBar

  • BouncingBar

  • RotatingMarker

  • DynamicMessage

The progressbar module is very easy to use, yet very powerful. It will also automatically enable features like auto-resizing when the system supports it.

Usage

There are many ways to use Python Progressbar, you can see a few basic examples here but there are many more in the examples file.

Wrapping an iterable

import time
import progressbar

bar = progressbar.ProgressBar()
for i in bar(range(100)):
    time.sleep(0.02)

Context wrapper

import time
import progressbar

with progressbar.ProgressBar(max_value=10) as bar:
    for i in range(10):
        time.sleep(0.1)
        bar.update(i)

Combining progressbars with print output

import time
import progressbar

bar = progressbar.ProgressBar(redirect_stdout=True)
for i in range(100):
    print 'Some text', i
    time.sleep(0.1)
    bar.update(i)

Progressbar with unknown length

import time
import progressbar

bar = progressbar.ProgressBar(max_value=progressbar.UnknownLength)
for i in range(20):
    time.sleep(0.1)
    bar.update(i)

Bar with custom widgets

import time
import progressbar

bar = progressbar.ProgressBar(widgets=[
    ' [', progressbar.Timer(), '] ',
    progressbar.Bar(),
    ' (', progressbar.ETA(), ') ',
])
for i in bar(range(20)):
    time.sleep(0.1)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

progressbar2-3.15.1.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

progressbar2-3.15.1-py2.py3-none-any.whl (21.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file progressbar2-3.15.1.tar.gz.

File metadata

File hashes

Hashes for progressbar2-3.15.1.tar.gz
Algorithm Hash digest
SHA256 21f96829c193a627daacf086977a5180af288d433f3cbf97d737678717c697d4
MD5 0db97583d9cf8a59ae541076dec60261
BLAKE2b-256 ff67b463c04fa54bd146e661479bda625a0551d39300f0fe08f62ec4fe70ad02

See more details on using hashes here.

File details

Details for the file progressbar2-3.15.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for progressbar2-3.15.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 29d307cde22155a5c1f44f1b20b64ce24a42c3505193a7d7b1a7b19fbc9f413a
MD5 751e667e31ccfc68b18b1bac5b091c31
BLAKE2b-256 83be2f6602f2bcacc801d8f23cbc2b26e321d1578e77a279bcc2de8d198225ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page