Testing ipywidgets: http://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html
In [6]:
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
from IPython.display import display
In [11]:
dd1 = widgets.Dropdown(
options={'One': 1, 'Two': 2, 'Three': 3},
value=2,
description='Number:',
)
dd2 = widgets.Dropdown(
options={'One': 1, 'Two': 2, 'Three': 3},
value=2,
description='Number:',
)
display(dd1, dd2)
def on_dd1_change(change):
dd2.options = {'new': change['new'], 'old': change['old']}
dd2.value = change['new']
#print(change['new'])
dd1.observe(on_dd1_change, names='value')
int_range = widgets.IntSlider()
display(int_range)
def on_value_change(change):
print(change['new'])
int_range.observe(on_value_change, names='value')
In [7]:
def f(x):
return x
In [8]:
interact(f, x=(-100,100,5), continuous_update=False)
Out[8]:
Out[8]:
In [9]:
interact(f, x=(-100,100,5), continuous_update=True)
Out[9]:
Out[9]:
In [10]:
interact(f, x=(-100,100,5), __manual=True)
Out[10]:
In [ ]:
In [ ]:
In [ ]: