@Bryan Thank you for your answer. The solution you proposed is exactly what I tried to do, but it does not work, at least in my implementation. These are my test scripts (main.py and index.html); am I doing something wrong ?
Paolo
from bokeh.plotting import figure, curdoc
from bokeh.models import ColumnDataSource
y = range(100)
x = range(100)
def callback(attrname, old, new):
print ('I AM HERE')
print ('I CAN PRINT')
source = ColumnDataSource(data=dict(x=x, y=y))
coords = ColumnDataSource(data=dict(x=(1,), y=(1,)), name='coords')
coords.on_change('data', callback)
plot = figure(plot_height=400, plot_width=1000, title="1 1",
tools="crosshair,pan,reset,save,wheel_zoom",name="spec")
plot.line('x', 'y', source=source, line_width=1, line_alpha=1)
plot.line('x', 'y', source=coords, line_width=0, line_alpha=1)
curdoc().add_root(plot)
.
{% extends base %}
<!-- goes in head -->
{% block preamble %}
<script type="text/javascript">
<!--
function test()
{
var ds = Bokeh.documents[0].get_model_by_name('coords');
ds.data['x'][0] = 1000;
ds.data['y'][0] = 1000;
ds.change.emit();
}
//-->
</script>
{% endblock %}
<!-- goes in body -->
{% block contents %}
<input type="button" value="click me" onclick="test()" />
<div id="plot"> {{ embed(roots.spec) }} </div>
{% endblock %}