https://github.com/chiefenne/progressbar
Python GUI-less progressbar for command line usage
https://github.com/chiefenne/progressbar
Last synced: 9 months ago
JSON representation
Python GUI-less progressbar for command line usage
- Host: GitHub
- URL: https://github.com/chiefenne/progressbar
- Owner: chiefenne
- License: mit
- Created: 2015-10-05T16:35:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-08-02T15:54:01.000Z (almost 2 years ago)
- Last Synced: 2025-02-14T05:41:20.514Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ProgressBar
A simple GUI-less progress bar for displaying progress in a text console. This class was adapted from the book "Python Cookbook" by David Ascher, Alex Martelli, and Anna Ravenscroft.
# Installation
You can clone the repository and import the class into your project.
```bash
git clone https://github.com/yourusername/progressbar.git
```
# Usage
## Usage from within the main script
```
python progressbar.py
```
This runs the code placed in the below section of the script:
```
if __name__ == "__main__":
total = 100
pb = ProgressBar(total)
for i in range(total + 1):
pb.progress(i)
time.sleep(0.1)
```
## Using within another script
You can also use the ProgressBar class from within another script or function:
```
# another_script.py
import time
from progressbar import ProgressBar
def some_function_with_progress():
total = 50
pb = ProgressBar(total)
for i in range(total + 1):
pb.progress(i)
time.sleep(0.2) # Simulate work being done
if __name__ == "__main__":
some_function_with_progress()
```