from IPython.display import display
import ipywidgets as W
from traitlets import link
def coreCalculationFunction(myOptions):
return myOptions
def optionsRelatedFunction():
myOptions=['a', 'b', 'c']
label = W.HTML(value="Hello World")
the_interact = W.interactive(coreCalculationFunction,
myOptions=myOptions)
dropdown = the_interact.children[0]
# link ensures that when dropdown.value changes,
# label.value gets the same value, and vice versa.
# dlink is a unidirectional alternative.
link((dropdown, 'value'),
(label, 'value'),
)
display(label, the_interact)
optionsRelatedFunction()