PBar is really easy to use. You only need to set the progress range, and the places where the bar will progress, nothing more.
View moreDo you want to change the color of the completed part? Show the percentage as the title of the bar? Or perhaps simply show a vertical bar? No problem, with PBar you'll be able to customize almost every aspect that you can imagine.
PersonalizationPBar comes with some functions and objects that will help you when managing tasks with the bar.
Features
import pbar
my_bar = pbar.PBar()
my_bar.draw()
Here is the code that generates a progress bar with the default values. It also shows it on the terminal. So yeah... Should be easy enough!
That makes sense, everyone likes useful things (at least that's what I think). Therefore, you can show the progress of a set of tasks in a super easy way.
Note that this decorator is an experimental feature.
@pbar.task_wrapper
def my_task(my_bar):
get_data()
process_stuff()
show_data()
useless_function()
another_function()
for value in pbar.iter(range(10)):
print(f"Value: {value}")
# more stuff!
Of course! Who is not afraid of a decorator? They are truly terrifying (but amazing), so that's why you can still progress in more different ways, like using this neat function shown at the left.
It is your lucky day, because you can set conditions for quite a few properties of the bar, and that when they are met, different colors, characters, or text are applied!
conds = (
pbar.Cond("percentage >= 50", colorset=pbar.ColorSet.YELLOW, charset=pbar.CharSet.BRICKS),
pbar.Cond("percentage == 100", colorset=pbar.ColorSet.GREEN),
pbar.Cond("text <- error", colorset=pbar.ColorSet.RED, formatset=pbar.FormatSet.DESCRIPTIVE)
)
my_bar = pbar.PBar(conditions=conds)
try:
pbar.animate(my_bar, range(50))
except KeyboardInterrupt:
my_bar.text = "Error!"
my_bar.draw()
No! That's not all of it! I knew this wouldn't be enough for you, so I can tell you there's much more to see! There are a lot of different options to tweak. Here, take this quick demo that shows some of it's options:
This other example shows how the bar can be positioned anywhere, even at the current cursor position! Notice how it draws correctly even when the terminal screen scrolls down!
If you want to see all the features of PBar, check out the wiki pages on GitHub! You can also click on the words that are slightly highlighted inside the code blocks above. They will show you the wiki page of that object!
Visit the Wiki pagePBar is available on the PyPI repository as pbar2. Why 2? Is it a sequel? Yes, it is, but also because someone took the name.
I could not miss a version control that helps in my mediocre organization (and the loss of files). Seriously, thanks git. Ah yes, you can also find all the source code of the project. pstt, it's a botch.
It is also available on the Arch packages repository, thanks to MithicSpirit. I use Arch btw.