Easy to use

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 more

Customizable

Do 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.

Personalization

Complete

PBar comes with some functions and objects that will help you when managing tasks with the bar.

Features

Wait. Are you sure it's easy?

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!

Okay okay, but I want it to be something useful.

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()

I am afraid of @decorators, is there any other option?

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.

What if I want to change the color when it completes?

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()

And... That's it?

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 page