Насколько я могу судить, вы хотите этот шаблон:
# Set up multiple widgets
offset = Slider(title="offset", value=0.0, start=-5.0, end=5.0, step=0.1)
amplitude = Slider(title="amplitude", value=1.0, start=-5.0, end=5.0, step=0.1)
phase = Slider(title="phase", value=0.0, start=0.0, end=2*np.pi)
freq = Slider(title="frequency", value=1.0, start=0.1, end=5.1, step=0.1)
# Set up one callback for all the widgets, that uses all their values
def update_data(attrname, old, new):
# Get all the current slider values
a = amplitude.value
b = offset.value
w = phase.value
k = freq.value
# Generate the new curve based on all the values
x = np.linspace(0, 4*np.pi, N)
y = a*np.sin(k*x + w) + b
# This update uses values from all four sliders at the same time
source.data = dict(x=x, y=y)
Здесь я проиллюстрировал Slider
, но принцип справедлив для любых виджетов.