Hi,
I would like to have a button that trigger a python callback on my plot. But the button does nothing.
The plot is correctly plotted and when I change the values of r1 or r2 in the console, the synchronisation works. It’s only the other way around that is not working.
import numpy as np
from numpy import pi
from bokeh.client import push_session
from bokeh.driving import cosine
from bokeh.plotting import figure, curdoc
from bokeh.models import Button
x = np.linspace(0, 4*pi, 80)
y = np.sin(x)
p = figure()
r1 = p.line([0, 4*pi], [-1, 1], color=“firebrick”)
r2 = p.line(x, y, color=“navy”, line_width=4)
open a session to keep our local document in sync with server
session = push_session(document=curdoc())
def update():
r1.data_source.data[‘x’]=[0,100]
add a button widget and configure with the call back
button = Button(label=“Press Me”)
button.on_click(update)
put the button and plot in a layout and add to the document
curdoc().add_root(vplot(button, p))
session.show()
``
Can someone guide me for the right thing to do.
Thanks a lot,
Robin

