OS: WSL
Python: 3.7
Bokeh: 2.3.2
I’m trying to attach a callback to a ResetTool
.
This is what I’ve tried to do:
from bokeh.events import Reset
from bokeh.io.doc import curdoc
from bokeh.models.callbacks import CustomJS
from bokeh.models.tools import ResetTool
from bokeh.plotting.figure import figure
def on_reset(event):
print("clicked")
rt = ResetTool()
rt.on_event(Reset, on_reset)
rt.js_on_event(Reset, CustomJS(code="console.log('clicked')"))
plot = figure(tools=[rt])
plot.line(x=[1, 2, 3], y=[2, 4, 6])
curdoc().add_root(plot)
Am I missing something?