Skip to content

Changing options of Select widget triggers Callback #2230

Closed
@nickpollari

Description

@nickpollari

@jasongrout we should have a way to change the options of a Select widget without triggering the callback function. Whenever the options are changed for the widget the value attribute is automatically set which forces the callback to be triggered. See code below;

from ipywidgets import Select

# callback
def cb(change):
    print(change)

# widget
s_w = Select(value=None, options=['a','b'])
s_w.observe(cb, names='value')

# triggers no callback
s_w.value = None
# triggers callback
s_w.options = ['1', '2', '3']

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions