Is there a way to handle a large progress display incrementally? #4046
|
I'm using rich.progress to show progress on converting an audiobook. This works fine for most cases, but when I have a book with more parts than fit on a screen, it shows the screenful with I read through the progress docs, and the closest thing I found was to selectively set Thanks! |
Replies: 2 comments 2 replies
|
An initial answer is yes, I can use |
|
You're on the right track, Two ways to do it: # hide completed tasks (keeps them in the object, just not rendered)
progress.update(task_id, visible=False)
# or drop them entirely once you're done with them
progress.remove_task(task_id)
If you ever want a hard cap (say, only ever show the 10 most recent active tasks) you'd manage that yourself by hiding/removing as you go, since |
You're on the right track,
visible=Falseis the intended lever here. There's no built-in scrolling viewport forProgress, so hiding finished tasks so the active ones stay on screen is the way people do this.Two ways to do it:
remove_taskis a bit cleaner if you don't need the completed tasks around anymore, it takes them out of the render completely instead of just flagging them invisible. Either one shifts the still-running tasks up into view as the ones above finish, which is the "scroll" effect yo…