I am trying to create a small project using Button and Dropdown widgets from ipywidgets in Jupyter Lab. Sample code is
btn = widgets.Button(description='Mark')
display(btn)
def btn_eventhandler(obj):
print('The name is {} !'.format(obj.description))
btn.on_click(btn_eventhandler)
I get the button but it does not give any output on clicking as seen in image below. There is no error message either.
The result that i want can be seen in the log classified under warning as seen in the image below
The same issue also arises in using Dropdown. However, Intslider widget works fine without any issues
I have tried some of the suggestions mentioned in these threads but none worked
- How to get ipywidgets working in Jupyter Lab?
- jupyter notebook ipywidgets not showing (no error)
- Interactive Jupyter Widgets not working in Jupyter Lab
These are the jupyter versions that are currently installed-
- jupyter core : 4.7.0
- jupyter-notebook : 6.2.0
- qtconsole : 5.0.1
- ipython : 7.31.0
- ipykernel : 5.4.2
- jupyter client : 6.1.7
- jupyter lab : 3.0.12
- nbconvert : 6.0.7
- ipywidgets : 7.6.5
- nbformat : 5.0.8
- traitlets : 4.3.3
Is there something that I am doing wrong? I tried running the same in Jupyter Notebook where it works fine Thank you