In [7]:
15 * 15
Out[7]:
In [8]:
def f(x, y):
print(x * y)
In [9]:
from ipywidgets import *
from traitlets import dlink
In [10]:
interact(f, x=(0, 100), y=['a', 'b']);
In [11]:
slider = FloatSlider(
value=7.5,
min=5.0,
max=10.0,
step=0.1,
description='Input:',
)
slider
In [12]:
slider
In [14]:
slider.value
Out[14]:
In [15]:
slider.keys
Out[15]:
In [16]:
slider.readout_format = '.4f'
In [17]:
text = FloatText(description='Value')
dlink((slider, 'value'), (text, 'value'))
text
In [18]:
slider
Widgets are represented in the back-end by a single object. Each time a widget is displayed, a new representation of that same object is created in the front-end. These representations are called views.
In [ ]:
slider
In [ ]:
ft = FloatText()
In [ ]:
def foo(change):
ft.value = change.new
slider.observe(foo, names=['value'])
In [ ]:
ft
In [ ]:
from ipywidgets import HBox
In [ ]:
HBox([slider, slider, ft])