Skip to content

Instantly share code, notes, and snippets.

@franccesco
Created June 16, 2019 02:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save franccesco/33e56c93c3c43cf70f19ecbfc921e358 to your computer and use it in GitHub Desktop.
Save franccesco/33e56c93c3c43cf70f19ecbfc921e358 to your computer and use it in GitHub Desktop.
Testing some of the progressbar libraries that I found interesting
# To test these progress bars you will have to
# install the following packages
# pipenv install click progress progressbar2 tqdm clint
import string
# progress bars
import time
import click
from tqdm import tqdm
from progress.bar import Bar
from progress.bar import PixelBar
from progress.spinner import PixelSpinner
from progressbar import progressbar
from clint.textui import progress
click.secho('Progress - BAR', bold=True)
with Bar('Processing...') as bar:
for i in range(100):
time.sleep(0.02)
bar.next()
click.secho('Progress - PixelBar', bold=True)
with PixelBar('Processing...') as bar:
for i in range(100):
time.sleep(0.02)
bar.next()
click.secho('Progress - PixelSpinner', bold=True)
with PixelSpinner('Processing...') as bar:
for i in range(100):
time.sleep(0.02)
bar.next()
click.secho('\nProgressbar2', bold=True)
for i in progressbar(range(100), redirect_stdout=True):
time.sleep(0.02)
click.secho('\nTQDM', bold=True)
for i in tqdm(range(100)):
time.sleep(0.02)
click.secho('TQDM - With description', bold=True)
pbar = tqdm(list(string.ascii_lowercase))
for letter in pbar:
pbar.set_description(f'Processing {letter}...')
time.sleep(0.09)
click.secho('\nClick', bold=True)
fill_char = click.style('=', fg='yellow')
with click.progressbar(range(100), label='Loading...', fill_char=fill_char) as bar:
for i in bar:
time.sleep(0.02)
click.secho('\nClint', bold=True)
for i in progress.bar(range(100)):
time.sleep(0.02)
click.secho('Clint - Mill', bold=True)
for i in progress.mill(range(100)):
time.sleep(0.02)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment