Loading sequence/progress bar generator with options for users to customize start/finish messages, toggle between bar/text sequences, and set total iterations among other features.
-
Useful for small intermittent pauses between console text returns, or visualizing the progress of a long-running process.
-
Users can choose between two different loading sequences:
- A. Progress-bar style loading sequence
- B. Animated-text style loading sequence
-
When instantiating a
PyLoadBarobject, you may set the type of loading sequence using thebar_sequence: boolparameter. -
Once initialized, run the loading sequence using the
start()method, and set sequence configuration using parameters. -
Messages can be customized by passing custom strings to the
msg_loading: strandmsg_complete: strparameters respectively.- The loading message defaults to
"Loading..." - The completion message defaults to
"Done!"
- The loading message defaults to
-
You may apply a label to the progress bar using the
label: strparameter (defaults toNone).-
NOTE:
bar_sequence: boolmust be set toTruefor a label to be assigned to the progress bar. -
If
bar_sequence: boolisFalse, the progress-bar sequence will not be used, and the animated text-based loading sequence will be used instead.
-
-
When calling the
start()method and using the progress-bar sequence, the time taken to complete each iteration can be determined using themin_iter: floatandmax_iter: floatparameters.- Each iteration length is randomized to a value between
min_iter: floatandmax_iter: floatseconds.- e.g.
start(min_iter=0.5, max_iter=1.5)would take anywhere between 0.5 - 1.5 seconds to complete a single iteration.
- e.g.
- Each iteration length is randomized to a value between
-
The text-based loading sequence displays the loading message followed by incrementing dots, all printed to the same line.
- Set number of seconds to complete a single text-sequence iteration using
txt_iter_speed: float.- Defaults to
0.5seconds per animation cycle.
- Defaults to
- Set number of seconds to complete a single text-sequence iteration using
Easiest method. Highly recommended over manual installation.
-
Run the following to install:
pip install PyLoadBar
-
You should now be able to import
PyLoadBardirectly to your application.
Not recommended.
1a. Download the latest source code .zip archive from the PyLoadBar GitHub releases page and extract contents to the desired location.
- OR:
1b. Clone repository with the git client of your preference with:
gh repo clone schlopp96/PyLoadBar2. Navigate to the directory containing extracted contents, and open said folder within a terminal.
3. Enter pip install -r requirements.txt to install all dependencies for this package.
4. Finally, move the "PyLoadBar-Vx.x.x" directory to your global Python 3rd-party package installation directory to be able to import PyLoadBar like any other module:
"~Python/Lib/site-packages/HERE"
5. Done!
-
PyLoadBaris very simple to use. -
Within a
.pyproject, simply import thePyLoadBarmodule to start using your custom loading sequence. -
Example of standard loading sequence with
labelset to'Solving':>>> from PyLoadBar import PyLoadBar >>> important_bar = PyLoadBar() # Initialize a new `PyLoadBar` instance. >>> important_bar.start(msg_loading='Important Stuff Happening', msg_complete='Day Saved!', label='Saving Day', min_iter=0.05, max_iter=1.0, iter_total=10) # Call `start` method to begin loading sequence.
-
Example of animated-text-based loading sequence:
>>> from PyLoadBar import PyLoadBar >>> bar = PyLoadBar(bar_sequence=False) # Initialize loading sequence. >>> bar.start(msg_loading='Loading', msg_complete='Done!', iter_total=1, txt_iter_speed=1) # Start animated-text loading sequence.
-
If you have any questions, comments, or concerns that cannot be addressed through the project's GitHub repository, please feel free to contact me through my email address:
schloppdaddy@gmail.com

