An easy-to-use and colorful progress bar for python.
Project description
Pyprobar
An easy-to-use and colorful progress bar for python.
Installation
pip install pyprobar
nightly version:
python setup.py install
Synopsis
28.71% |████████>>>>>>>>>>>>>>>>> | 0:00:22|0:00:31 ETC: 05-20 18:08:15
Performance
from pyprobar import probar
from tqdm import tqdm
N = 20000000
print("probar:")
for i in probar(range(N)):
pass
print("bar:")
for idx,i in probar(range(N)):
bar(idx, N)
print("tqdm:")
for i in tqdm(range(N)):
pass
probar:
100.00%|█████████████████████████████| 0:00:00|0:00:04 ETC: 06-06 02:13:52
bar:
100.00% |█████████████████████████████| 0:00:00|0:00:09 ETC: 06-06 02:14:02
tqdm:
100%|██████████| 20000000/20000000 [00:06<00:00, 3175107.63it/s]
Usage
Use probar
or bar
for different situations:
probar
:
from pyprobar import bar, probar
import time
for idx, x in probar(range(1234), enum=True):
time.sleep(0.02)
>>> 18.31%|█████>>>>> | 0:00:20|0:00:25 ETC: 05-20 19:00:39
Or used in List comprehensions:
res = [i for i in probar(range(10))]
print(res)
>>> 100.00%|███████████████████████████| 0:00:00|0:00:00 ETC: 05-20 12:14:33
>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
bar
:
import numpy as np
N = 1024
a = np.linspace(2, 5, N)
for idx, i in enumerate(a):
time.sleep(0.01)
bar(idx, N)
>>> 100.00% |███████████████████████████| 0:00:00|0:00:10 ETC: 05-20 20:33:34
You can set your own progress bar by using the parameters symbol_1
and symbol_2
:
for i in probar(range(1234), symbol_2="o"):
time.sleep(0.01)
>>> 23.10%|██████ooooooooooooooooooo | 0:00:10|0:00:14 ETC: 05-20 17:29:57
Tip: Searchcharmap
in win10 start menu, you can find a lot of interesting characters.
Supports progress bars in different colors:
for idx, i in enumerate(a):
bar(idx, N, color='1') # `color` options: '1','2','3','4','5','0','update_random'
time.sleep(0.01)
Of course, you can also add text or variables to the progress bar:
for idx, i in enumerate(a):
text = f"what you want see is {x}"
bar(idx, N, text=text)
multi-line text :
for idx, i in enumerate(a):
text = f"{v1}, frame:{idx}\n"
bar(idx, N, text=text)
print RGB color string:
from pyprobar.styleString import rgb_str
text = rgb_str("I'm green!", RGB_fore=[0,255,0])
print(text)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyprobar-0.1.1.6.tar.gz
(10.1 kB
view hashes)
Built Distribution
pyprobar-0.1.1.6-py3-none-any.whl
(15.2 kB
view hashes)
Close
Hashes for pyprobar-0.1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c44394ffa2f2472839180499ebb3803950237ac6705e8cc2a9dc890051fb97d3 |
|
MD5 | 32fea431cbc0e167116efeac94a45521 |
|
BLAKE2b-256 | fcb4d7f9de0995bf81473f83fc7e03916205136c9ccb5ee8941b6f65489aa098 |