-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
If your program only ever uses a single tqdm
instance at a time, then leave=True
is great - you get a neat history of every bit of progress you've ever made.
However, if you use multiple tqdm
instances, things don't work so well. Particularly, the remains of old, completed tqdm
instances will be below the new active ones.
Solution for the simple case: when you create a new tqdm
instance, clear out all the old rows below it (you do not want to do this earlier, because you do want to display the 100% until the next one is ready). Remember that the creator of the tqdm
instances does not necessarily know about other pieces of code that create instances, so it has to be done in the library - nobody knows what to .clear()
However, this is not all that's needed for more advanced cases where bars may complete in any order - for example, I want to do a current-and-past parallel download presentation like aptitude
does - essentially, every completed tqdm
should be moved above all active tqdm
s (which then need to all be redrawn), and then forgotten.