jupyterq
jupyterq copied to clipboard
using ipywidgets
Most of the things I tried with ipywidgets work well, but here I don't understand what's wrong.
/%python
import ipywidgets as widgets
from IPython.display import display
out = widgets.Output()
def foo(x):
with out:
print(x)
b = widgets.Button(description='Button')
b.on_click(foo)
display(b)
display(out)
When calling foo('bar')
directly it works well : 'bar' is printed in the Output widget.
When pressing the button it doesn't.
Doing exactly the same thing with a python kernel works.
Hi, Could you let me know what the expected output is here when you push the button? With the latest version of jupyterq I see the same behaviour on clicking the button as with a python 3 kernel.
JupyterQ kernel after 2 button clicks
Python kernel after 2 button clicks.
Do you see something different with a python kernel?
The expected output is what you see. In fact I just realized that it does work in jupyter notebook, but it doesn't work in jupyter lab.
So to sum up : jupyter notebook + python kernel -> something is printed when button pressed jupyter notebook + q kernel -> something is printed when button pressed jupyter lab + python kernel -> something is printed when button pressed jupyter lab + q kernel -> nothing happens when button pressed
Yes, widgets are a bit experimental and we've not done any testing with jupyterlab really as it's only in beta (moved from alpha this year I believe). Will look at adding support for widgets in jupyterlab in a future release, if you've any ideas as to what might be needed to support jupyterlab do post them here.