https://github.com/dentosal/pygressbar
A simple python library for displaying text-based progress bars
https://github.com/dentosal/pygressbar
cli progress-bar python3-library
Last synced: 5 months ago
JSON representation
A simple python library for displaying text-based progress bars
- Host: GitHub
- URL: https://github.com/dentosal/pygressbar
- Owner: Dentosal
- License: mit
- Created: 2017-05-13T21:01:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T14:18:26.000Z (over 8 years ago)
- Last Synced: 2025-03-21T09:48:11.067Z (10 months ago)
- Topics: cli, progress-bar, python3-library
- Language: Python
- Size: 17.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pygressbar
A simple python library for displaying text-based progress bars.
## Installing
```bash
python3 -m pip install git+https://github.com/Dentosal/pygressbar
```
## Example usage
### Indeterminate progress bar
```python
import time
from pygressbar import IndeterminateProgressBar
print("Processing a list of items: ")
ITEMS = ["Item {}".format(n) for n in range(10)]
with IndeterminateProgressBar(8).background:
for l in ITEMS:
print("* " + l + " " * (max(map(len, ITEMS)) - len(l)) + " ", end="")
time.sleep(1)
print("[OK]")
```
### Percentage progress bar
```python
import time
from pygressbar import PercentageProgressBar
print("Processing a large item:")
with PercentageProgressBar(50, show_value=True) as pb:
pb.update(0)
PARTS = 7
for part in range(PARTS):
time.sleep(0.5)
pb.update(100*(part+1)/PARTS)
print("Done")
```
See [`example.py`](example.py) for more examples.