#!/usr/bin/env python # coding: utf-8 # In[6]: from IPython.display import display import ipywidgets as W from traitlets import link # In[21]: 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) # In[20]: optionsRelatedFunction()