Dropdown ipywidget after unobserve_all() does not accept any further observe()
See original GitHub issueI use ipywidget 7.0.5 (py35_0) The dropdown ipywidget after unobserve_all() does not work for any further observe(). This is easily reproducible with the following code:
import ipywidgets.widgets as widgets
from IPython.display import display
def helloWorld(_=None):
print("Hello World!")
# the dropdown is not working properly
widget = widgets.Dropdown(
options=[('One', 1),
('Two', 2),
('Three', 3)],
description='dropdown_w:',
value = 2
)
widget.observe(helloWorld, 'value')
display(widget)
widget.unobserve_all()
widget.observe(helloWorld, 'value')
## instead same code works for other widgets (as it should)
w = widget = widgets.FloatSlider(value = 0.5, min = 0, max = 1, step = 0.1, description = "w")
w.observe(helloWorld, 'value')
display(w)
w.unobserve_all()
w.observe(helloWorld, 'value')
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
ipywidget observe method called several times for every ...
So the observe method is called 4 times for one single change of the dropdown of the menu. Why is that? secondly this...
Read more >ipywidgets changelog — Jupyter Widgets 7.6.4 documentation
The main change in this release is that installing ipywidgets 7.6.0 will now automatically enable ipywidgets support in JupyterLab 3.0—a user has no...
Read more >Ipywidgets with matplotlib - Kapernikov
A simple use case could be adding some basic controls to a plot for interactive data exploration. On the other side of the...
Read more >ipywidgets Examples of Slider, Dropdown, Checkbox, Text Box
Master the ipywidgets interact function with this tutorial. ipywidgets is a Python library for building interactive HTML widgets for your ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not sure if this is still relevant. But it may help some one.
w.unobserve(None,...)
does something like whatunobserve_all
is expected to do. Of course you’d still need to passnames
whenever needed. But at least you don’t need to know the exact name of the handler. Specially if you have used apartial
when setting the observer.I just ran into this with select as well. Got a minimum working example below for future reference: