Python ProgressBar adds its own dynamic information to the progress bar

Python progressbar adds its own dynamic information to the progressbar (prevent visuals)

import progressbar
import time
widgets = ['Progress:', 
                   progressbar.Percentage(), ' ', 
                   progressbar.Bar('='),' ', 
                   progressbar.Timer(), ' ',
                   progressbar.DynamicMessage("training_batch_acc"),
                  ]
bar=progressbar.ProgressBar(widgets=widgets, max_value=1000)
for i in range(1000):
    time.sleep(1)
    bar.dynamic_messages.training_batch_acc = 10
    bar.update(i)

Dynamic information added by training_batch_ACC in the code, variable is set by Widgets, dynamic_messages.training_batch_ACC modify value, which can be displayed dynamically in real time, concise and clear


Read More: