Recommended way to have multiple progress bars & multiple status spinners active at the same time #3440
Unanswered
akhileshraju
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My use case requires that I have a way to support multiple status spinners and progress bars active at the same time.
I followed the recipe from #1500 (comment) and came up with the below snippet.
This works as I expect to and shows up like so
MultipleProgressAndSpinner.mp4
Questions
Is this the recommended way to achieve multiple active progress & spinners?
Since there can be only one
Live
instance active at any given time, I had to find a way to get theStatus
andProgress
classes to use theLive
instance that I am creating.Progress
seems to already have a way to get the current console like below.rich/rich/progress.py
Line 1095 in e1e6d74
However,
Status
doesn't seem to have any such provision.rich/rich/status.py
Line 39 in e1e6d74
So, I had to resort to overriding the
Status._live
attribute to get it to use theLive
instance I am creating. I don't feel very comfortable override a "protected" member variable. Is this a safe approach? Alternatively, would the maintainers be willing to entertain a PR for gettingStatus
to callget_console()
when creating itsLive
instance?NOTE - I see that
Progress
is creating its ownLive
instance different from the one I am creating, but that does seem to peacefully co-exist with theLive
I am creating. I assume that this is has something to do with theget_console()
call within theLive
instance creation inProgress
Beta Was this translation helpful? Give feedback.
All reactions