python progress bar using tqdm not staying on a single line
For the messages to be printed above the progress bar, you need to signal to tqdm that you are printing messages (else tqdm, nor any other progress bar, can not know that you are outputting messages beside the progress bar).
To do that, you can print your messages using tqdm.write(msg)
instead of print(msg)
. If you don't want to modify run_apply()
to use tqdm.write(msg)
instead of print(msg)
, you can redirect all standard output through tqdm from the toplevel script as described here.
Try Using : Progressbar
import Progressbarprogress = progressbar.ProgressBar()for i in progress(range(30)): time.sleep(0.1)
It will look like this: 43% (13 of 30) |############################ | Elapsed Time: 0:00:01 ETA: 0:00:01