robotkernel icon indicating copy to clipboard operation
robotkernel copied to clipboard

ipywidgets 8 support

Open bollwyvl opened this issue 3 years ago • 9 comments

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.

bollwyvl avatar Apr 06 '22 15:04 bollwyvl

Thanks for the heads up.

datakurre avatar Apr 06 '22 16:04 datakurre

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).

datakurre avatar Apr 06 '22 18:04 datakurre

Sometimes it's better to be lucky than good.

bollwyvl avatar Apr 06 '22 19:04 bollwyvl

Only worked on my computer https://gist.github.com/datakurre/c1c4c4f31bf3438a4232e082d2af2b4a

datakurre avatar Apr 07 '22 07:04 datakurre

Oh, just "accident". Works now.

datakurre avatar Apr 07 '22 08:04 datakurre

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.

datakurre avatar Apr 14 '22 13:04 datakurre

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()))

RomaCZ avatar Sep 13 '22 11:09 RomaCZ

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

datakurre avatar Sep 13 '22 12:09 datakurre

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

datakurre avatar Sep 22 '22 18:09 datakurre