Skip to content

A simple Unicode progress bar for Python console programs.

License

Notifications You must be signed in to change notification settings

paulojraposo/ProgBar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Progress Bar

Little Python module for a nice textual progress bar, useful for console applications when you want to give your user a running percentage of some job done.

A screenshot

Bar can be arbitrarily long, and you can precede it with some text of your choosing.

Simply run the module (i.e., python ProgBar.py) to see it demonstrated.

Requirements

Python 3.x.

Usage

Just use carriage returns and flushes (i.e., end="\r" and flush=True) in your print() statements to keep writing on the same line:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import ProgBar

thingsToDo = 42
for thingBeingDone in range(thingsToDo):
    progress = (thingBeingDone + 1) / thingsToDo
    # Bar will be 20 spaces long, and preceded by "progress: " (one space appended):
    print(ProgBar.ProgressBar(progress, "progress:", 20), end="\r", flush=True)

About

A simple Unicode progress bar for Python console programs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages