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

ipywidgets 8 support #99

Open
bollwyvl opened this issue Apr 6, 2022 · 9 comments
Open

ipywidgets 8 support #99

bollwyvl opened this issue Apr 6, 2022 · 9 comments

Comments

@bollwyvl
Copy link
Contributor

bollwyvl commented Apr 6, 2022

ipywidgets 8 has an RC out:

https://pypi.org/project/ipywidgets/8.0.0rc0/

Here's a gist that uses it:

https://gist.github.com/bollwyvl/e076adf9e761b2ba2a7485b7f9376f0a

It looks like we can't yet draw some of the inline widgets.

@datakurre
Copy link
Collaborator

Thanks for the heads up.

@datakurre
Copy link
Collaborator

datakurre commented Apr 6, 2022

Maybe it has been working by accident so far.

Change I'm trying that seems to make it work:

-    display(ui, out, display_id=display_id)
+    display(ipywidgets.widgets.VBox([ui, out]), display_id=f"{display_id}.widgets")

The first issue is that with display(ui, out, display_id=display_id) only the widget execution output ipywidgets.widgets.Out remains displayed.

The second issue is that later rendering of Log | Result hides the widgets. Rendering the widgets (and output) with different display_id keeps them visible after Log | Result. I have no idea why it worked before (why rendering Log | Result with overlapping display_id did not remove them before).

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Apr 6, 2022

Sometimes it's better to be lucky than good.

@datakurre datakurre reopened this Apr 7, 2022
@datakurre
Copy link
Collaborator

@datakurre
Copy link
Collaborator

Oh, just "accident". Works now.

@datakurre
Copy link
Collaborator

up to widgets...

I think getting to that fully working is part of the carrot of upgrading to the upcoming ipywidgets 8 stuff? the widget graph usually isn't being serialized to the notebook format fast enough to work well, and i think they had to do something new...

I'd love to be able to persist state of RobotKernel keyword button widgets so that keyword buttons would work from executed notebooks without re-executing the whole notebook. Would make even more sense with Lite (maybe we have ubiquitous Lite rendering for ipynb files some day).

Last time, I tried, I could not find how it could work with back then versions of Classic Notebook or Lab. Will re-read docs and try again, once ipywidgets 8 is ready.

@RomaCZ
Copy link
Contributor

RomaCZ commented Sep 13, 2022

Hello, thank you for great kernel.
Unfortunately suggested:

-    display(ui, out, display_id=display_id)
+    display(ipywidgets.widgets.VBox([ui, out]), display_id=f"{display_id}.widgets")

modify result of all buttons, not just the pressed one.

Neither code from 1.6rc1

      display(ipywidgets.widgets.VBox([ui, out]), display_id=display_id)

did not work for me, cause Log | Result hides it.

So I ended up with dirty solution:

      display(ipywidgets.widgets.VBox([ui, out]), display_id=str(uuid.uuid4()))

@datakurre
Copy link
Collaborator

Thanks for the heads up. I have not tried this yet with final ipywidgets release.

@datakurre
Copy link
Collaborator

@RomaCZ I found the issue and it should be fixed now in 1.6rc2

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

No branches or pull requests

3 participants