A simple Python console progress bar
$ pip install consoleProgressbarPanel
- name: The name of the progress bar panel (e.g 'New Task')
- total_length: Maximum iteration value (e.g 10)
- inner_width: The width of the panel (e.g 30)
- moniter: Variable name monitored during progress bar (e.g ['var1', 'var2'])
- **kwargs: Static variable information displayed on the progress bar (e.g param1=0.3)
update(i, **monite)
i: Current progress bar value (1<= i <= total_length)
monite: Parameter that need to be monitored (indicated in moniter)
import time
from consoleProgressbarPanel import consoleProgressbarPanel
pb = consoleProgressbarPanel.ProgressBar(
name='Model',
total_length=10,
inner_width=30,
moniter=['mma','mmb'],
parama= 0.3,
paramb='xxx')
a = [0.1,0.3,0.2,0.4,0.5,0.7,0.2,0.1,0.0,0.3]
b = [1.0,-1.0,1.0,3.0,6.0,8.0,4.0,3.0,2.0,1.0]
for i in range(1, len(pb)):
pb.update(i, mma=a[i-1],mmb=b[i-1])
time.sleep(1) # we use this function in order to see more clearly.
.____________________________.
| name Model |
|---------parameter----------|
| parama: 0.3 |
| paramb: xxx |
| |
|----------moniter-----------|
| mma 0.1 |
| mmb 3.0 |
|____________________________|
|[================----] 8/10 |
|____________________________|
You can use these components to customize your own panels.
This component is usually used to form the head of the console panel.
com_header = consoleProgressbarPanel.COM_HEADER_LINE(30)
print(com_header)
.______________________________.
This component is usually used to fill the console panel.
- you can create a blank area
com_blank = consoleProgressbarPanel.COM_MARK_SPLIT(25)
| |
- or you can also provide a 'mark'
com_marksp = consoleProgressbarPanel.COM_MARK_SPLIT(25, '*')
print(com_marksp)
|*************************|
This component is usually used to divide the panel into many different modules.
com_split = consoleProgressbarPanel.COM_MODULE_SPLIT_LINE(25, 'split')
print(com_split)
|----------split----------|
You can use this component to display some constant information (such as model hyperparameters).
com_info = consoleProgressbarPanel.COM_STATIC_INFO(25, 'param1', '1.414')
print(com_info)
| param1 1.414 |
You can use this component to display some information that changes in real time as the progress bar changes.
com_monite = consoleProgressbarPanel.COM_INFORMATION(25)
print(com_monite.update('param2', 85))
| param2 85 |