0
我想使用BoxSelect工具,但我的回调不会被调用。这是我根据我在网上找到的片段尝试的。如何使用Bokeh BoxSelect工具?
from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import figure, curdoc
x = [1,2,3,4,5,6]
y = [i*i for i in x]
source = ColumnDataSource(data=dict(x=x,y=y))
p = figure(tools="xbox_select")
p.line("x", "y", source=source)
def selectedCallback(attr, old, new):
print("Selected callback")
source.on_change('selected', selectedCallback)
curdoc().add_root(p)
选择框在拖动鼠标时显示,但未调用回调。
(使用散景0.11.1和Python 3.5.1)