This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
box_layout = widgets.Layout( | |
border='solid 1px red', | |
margin='0px 10px 10px 0px', | |
padding='5px 5px 5px 5px') | |
vbox1, vbox2 = make_boxes() | |
vbox1.layout = box_layout | |
vbox2.layout = box_layout | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
box_layout = widgets.Layout( | |
border='solid 1px red', | |
margin='0px 10px 10px 0px', | |
padding='5px 5px 5px 5px') | |
vbox1, vbox2 = make_boxes() | |
vbox1.layout = box_layout | |
vbox2.layout = box_layout | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_boxes(): | |
vbox1 = widgets.VBox([widgets.Label('Left'), b1, b2]) | |
vbox2 = widgets.VBox([widgets.Label('Right'), dropdown, radiobuttons]) | |
return vbox1, vbox2 | |
vbox1, vbox2 = make_boxes() | |
widgets.HBox([vbox1, vbox2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
widgets.VBox([b1, b2, b3]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
widgets.HBox([b1, b2, b3]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b1 = widgets.Button(description='button 1') | |
b2 = widgets.Button(description='button 2') | |
b3 = widgets.Button(description='button 3') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sl1 = widgets.IntSlider(description='slider 1', min=0, max=10) | |
sl2 = widgets.IntSlider(description='slider 2', min=0, max=10) | |
link = widgets.link( | |
(sl1, 'value'), | |
(sl2, 'min') | |
) | |
sl1.value = 5 | |
widgets.VBox([sl1, sl2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_change(change): | |
display(change) | |
int_slider = widgets.IntSlider(value=7, min=0, max=10) | |
int_slider.observe(show_change, 'value') | |
int_slider.value = 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = np.linspace(0, 2 * np.pi, 100) | |
fig, ax = plt.subplots() | |
line, = ax.plot(x, np.sin(x)) | |
ax.grid(True) | |
def update(change): | |
line.set_ydata(np.sin(change.new * x)) | |
fig.canvas.draw() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_slider = widgets.IntSlider( | |
value=5, | |
min=0, max=10, step=1, | |
description='slider' | |
) | |
int_range_slider = widgets.IntRangeSlider( | |
value=(20, 40), | |
min=0, max=100, step=2, | |
description='range slider' |