Package: pyprog
IntroductionPyProg is an Open-Source library for creating progress indicators (e.g. progress bars). It helps you create customizable progress indicators. This library is for Python.CompatibilityPyProg is compatible with both Python 3 and Python 2, and will also work on Qt Console.Getting StartedInstallationLatest Release:pip install pyprogLatest Development Release:pip install git+https://github.com/Bill13579/pyprog.git@developAfter you have installed PyProg, you can test if it has been successfully installed by runningimport pyprogin python. If PyProg was installed successfully, it should show no errors.How to use the PyProg Progress BarBasic PyProg Progress BarTo create a basic progress bar, follow these steps:Install PyProg (Guide)Import PyProg:import pyprogCreate aProgressBarobject:prog = pyprog.ProgressBar("", "")Show the bar:prog.update()To update the status, useprog.set_stat(<status>)to set the status and then useprog.update()to actually show the changeWhen finished, useprog.end()to make the Progress Bar lastExample Code with Fake For loop:importpyprogfromtimeimportsleep# Create a PyProg ProgressBar Objectprog=pyprog.ProgressBar(":-) "," OK!")# Show the initial statusprog.update()# Fake for loopforiinrange(0,100):# Sleep for a while (This is just to slow down the for loop so that it won't end in an instant)sleep(0.1)# Update statusprog.set_stat(i+1)# Show (Update) the current statusprog.update()# Make the Progress Bar finalprog.end()Output:Initial State:
:-) Progress: 0% --------------------------------------------------  OK!

When progress is 50:
:-) Progress: 50% #########################-------------------------  OK!

Final State:
:-) Progress: 100% ##################################################  OK!What is the first two parameters?The first two parameters inprog = pyprog.ProgressBar("", "")is for telling PyProg what to put before and after the progress indicator.Example::-) Progress: 0% --------------------------------------------------  OK!
  ^                                 ^                                  ^
Prefix                             Bar                              SuffixPretty Progress BarYou can also add more options to make it look good.Adding optionscomplete_symbol="█", not_complete_symbol="-"will change the original output to:Initial State:
:-) Progress: 0% --------------------------------------------------  OK!

When progress is 50:
:-) Progress: 50% █████████████████████████-------------------------  OK!

Final State:
:-) Progress: 100% ██████████████████████████████████████████████████  OK!Auto calculate the percentagePyProg can also auto calculate the current percentage. You just need to tell PyProg the total number of things you need to process.Change the lineprog = pyprog.ProgressBar("", "")toprog = pyprog.ProgressBar("", "", <Total Number of things>), and PyProg will calculate the percentage for you based on the status that you give it.To use it in our simple progress bar code, if we have 37 tasks to do, we can change this:# Create a PyProg ProgressBar Objectprog=pyprog.ProgressBar(":-) "," OK!")to this:# Create a PyProg ProgressBar Objectprog=pyprog.ProgressBar(":-) "," OK!",37)And also change the fake for loop fromfor i in range(0, 100):tofor i in range(0, 37):, and it will auto calculate the percentage and show it to the user.How to use the PyProg Progress Indicator (Fraction)Basic PyProg Progress Indicator (Fraction)To create a basic progress indicator (fraction), follow these steps:Import PyProg:import pyprogCreate aProgressIndicatorFractionobject:prog = pyprog.ProgressIndicatorFraction("", "", <Total number of things>)(Replace "" with the total number of tasks or things you need to process)Show the indicator:prog.update()To update the status, useprog.set_stat(<status>)to set the status and then useprog.update()to actually show the changeWhen finished, useprog.end()to make the Progress Indicator (Fraction) lastExample Code with Fake For loop (We are using 56 as the total in this example):importpyprogfromtimeimportsleep# Create a PyProg ProgressIndicatorFraction Objectprog=pyprog.ProgressIndicatorFraction(":-) "," OK!",56)# Show the initial statusprog.update()# Fake for loopforiinrange(0,56):# Sleep for a while (This is just to slow down the for loop so that it won't end in an instant)sleep(0.1)# Update statusprog.set_stat(i+1)# Show (Update) the current statusprog.update()# Make the Progress Indicator (Fraction) finalprog.end()Output:Initial State:
:-) 0/56 OK!

When half done:
:-) 28/56 OK!

Final State:
:-) 56/56 OK!DocumentationProgress Indicator ParametersOptions for ProgressBarprefixThe prefix of everything.suffixThe suffix of everything.total (default is 100)This is the option that tells PyProg how many things or tasks you need to process. We used it in theAuto calculate the percentagesection.bar_length (default is 50)This tells PyProg how long should the bar should be.initial (default is 0)Initial status to show on the bar.decimals (default is 0)How many decimals should the percent have.complete_symbol (default is "#")The complete symbol will be shown in the complete part of the bar. We used it in thePretty Progress Barsection.Example Position of complete symbol:
Progress: 59%#############################---------------------not_complete_symbol (default is "-")The not complete symbol will be shown in the not yet complete part of the bar. We used it in thePretty Progress Barsection.Example Position of complete symbol:
Progress: 59% #############################---------------------progress_loc (default is 0)Where the progress explanation (prefix) and the progress text should be shown.Possible Values:ProgressBar.PROGRESS_LOC_START or 0 - Show both at the startProgressBar.PROGRESS_LOC_MIDDLE or 1 - Show both at the middle of the barProgressBar.PROGRESS_LOC_END or 2 - Show both at the endProgressBar.PROGRESS_LOC_EXP_START_PROGRESS_MID or 3 - Show explanation (prefix) at the start and the progress text at the middle of the barProgressBar.PROGRESS_LOC_EXP_END_PROGRESS_MID or 4 - Show explanation (prefix) at the end and the progress text at the middle of the barPROGRESS_LOC_START:Progress: 32%################----------------------------------PROGRESS_LOC_MIDDLE:################Progress: 32%------------------PROGRESS_LOC_END:################----------------------------------Progress: 32%PROGRESS_LOC_EXP_START_PROGRESS_MID:Progress:################-----32%-----------------------PROGRESS_LOC_EXP_END_PROGRESS_MID:################-----32%-----------------------Progress:progress_format (default is "+p%")Format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters:"+p" -> Current percent"+c" -> Current statusprogress_explain (default is "Progress: ")This is the progress explanation (prefix).Example position of progress explanation:Progress:32% ################----------------------------------Examples:"Progress: ""Current Progress: "wrap_bar_prefix (default is " ")The prefix of the bar.wrap_bar_suffix (default is " ")The suffix of the bar.Options for ProgressIndicatorFractionprefixThe prefix of everything.suffixThe suffix of everything.totalThis is the option that tells PyProg how many things or tasks you need to process.initial (default is 0)Initial status to show on the indicator.Progress Indicator FunctionsFunctions for ProgressBarset_stat()Available on: PyProg 1.0.0 ~Params: currentSet the current progress.stat()Available on: PyProg 1.1.0-0 ~Params: currentNote: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.Set the current progress and update the progress bar.progress()Available on: PyProg 1.1.0-0 ~Params: progressNote: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.Increase the progress by the given amount.update()Available on: PyProg 1.0.0 ~Params: (none)Update the progress bar so that it shows the current progress.Note: Also call this to initiate the bar.end()Available on: PyProg 1.0.0 ~Params: (none)End the progress bar.end_m()Available on: PyProg 1.1.0-0 ~Params: msgNote: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.End the progress bar with a message.set_prefix()Available on: PyProg 1.0.0 ~Params: prefixSet the prefixset_suffix()Available on: PyProg 1.0.0 ~Params: suffixSet the suffixset_total()Available on: PyProg 1.0.0 ~Params: totalSet the totalset_bar_length()Available on: PyProg 1.0.0 ~Params: bar_lengthSet the length of the barset_decimals()Available on: PyProg 1.0.0 ~Params: decimalsSet the number of decimals for the percentset_symbols()Available on: PyProg 1.0.0 ~Params: symbolsSet the complete symbol and the not complete symbol.symbolshas to be a tuple: (complete symbol, not complete symbol)set_progress_loc()Available on: PyProg 1.0.0 ~Params: progress_locSet the progress explanation (prefix) and the progress text location. Seethe progress_loc parametersection for the possible values.set_progress_explain()Available on: PyProg 1.0.0 ~Params: progress_explainSet the progress explanation (prefix).Examples:"Progress: ""Current Progress: "set_wrap_bar_text()Available on: PyProg 1.0.0 ~Params: prefix, suffixSet the wrap bar text (the prefix and the suffix of the bar).set_progress_format()Available on: PyProg 1.0.0 ~Params: progress_formatSet the format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters:"+p" -> Current percent"+c" -> Current statusFunctions for ProgressIndicatorFunctionset_stat()Available on: PyProg 1.0.0 ~Params: currentSet the current progress.update()Available on: PyProg 1.0.0 ~Params: (none)Update the progress indicator so that it shows the current progress.
Note: Also call this to initiate the indicator.end()Available on: PyProg 1.0.0 ~Params: (none)End the progress indicator.set_prefix()Available on: PyProg 1.0.0 ~Params: prefixSet the prefixset_suffix()Available on: PyProg 1.0.0 ~Params: suffixSet the suffixset_total()Available on: PyProg 1.0.0 ~Params: totalSet the total