Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC BUG] Nesting Lives #3044

Open
kfsone opened this issue Jul 20, 2023 · 1 comment
Open

[DOC BUG] Nesting Lives #3044

kfsone opened this issue Jul 20, 2023 · 1 comment

Comments

@kfsone
Copy link

kfsone commented Jul 20, 2023

  • [./ ] I've checked docs and closed issues for possible solutions.
  • [./ ] I can't find my issue in the FAQ.

Describe the bug

The "Nesting Lives" is a natural landing point for people trying to solve certain types of issues, but the documentation says that you can't do it, but then says you can - or at least, the current wording seems to do this:

Note that only a single live context may be active at any one time. The following will raise a LiveError because status also uses Live:

with Live(table, console=console):
    with console.status("working"):  # Will not work
        do_work()

In practice this is rarely a problem because you can display any combination of renderables in a Live context.

To a beginner, it is very unclear what this last line means, isn't that nesting?

The example given is also tantalizingly close to what a user might be there looking for, to be able to render output with a spinner but make it transient via Live, without having to significantly change other code, for example:

with Live(transient=True) as tr:
  with Status(console=tr.console) as st:
    time.sleep(1)
    print("Hi")
    time.sleep(2)
    print("Bye")
    time.sleep(1)

the lack of a counter example, demonstrating what to do instead, is a missed opportunity.

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant