robotkernel
robotkernel copied to clipboard
ipywidgets 8 support
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.
Thanks for the heads up.
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).
Sometimes it's better to be lucky than good.
Only worked on my computer https://gist.github.com/datakurre/c1c4c4f31bf3438a4232e082d2af2b4a
Oh, just "accident". Works now.
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.
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()))
Thanks for the heads up. I have not tried this yet with final ipywidgets release.
@RomaCZ I found the issue and it should be fixed now in 1.6rc2