CoCalc Public Filestmp / Untitled3.ipynbOpen in with one click!
Authors: Harald Schilly, ℏal Snyder, William A. Stein
In [6]:
from ipywidgets import * out = Output() s = IntSlider() Box([s, out])
In [7]:
out.append_stdout('foo')
In [8]:
VBox([s, out])
In [9]:
import ipywidgets as widgets int_range = widgets.IntSlider() display(int_range) def on_value_change(change): print(change['new']) int_range.observe(on_value_change, names='value')
12 32 46 86 100 85 76 72 71 69 68 67 66 65 64 79 23
In [13]:
import ipywidgets as widgets int_range = widgets.IntSlider() display(int_range) import time def on_value_change2(change): time.sleep(5) print(change['new'])
In [16]:
int_range.observe(on_value_change2, names='value')
In [17]:
display(int_range)
90 90 14 14 72 72 9 9
In [18]:
from ipywidgets import * out = Output() display(out) import time def f(x): out.clear_output() out.append_stdout(x['new']) s = IntSlider(); display(s) s.observe(f, names='value')
In [26]:
out.append_stdout('foo')
In [23]:
out.append_stderr('bar')
In [25]:
out.clear_output()
In [ ]: