☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Callback for ResetTool not working

Community Support
tony12624120
tony12624120

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!’); } ‘’’

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {‘custom_callbacks’: [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)

``

⌁   Link to post
Bryan
Bryan

Hi,

Users should never have to mess with the callbacks dictionary directly, and are certainly never advised to, and why it is purposefully not demonstrated anywhere in the docs. It would have been made private except for some technical hurdles with doing so. Instead you should always use the js_on_event method which is what is demonstrated in all the docs and examples, e.g.

  https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py

Thanks,

Bryan

···

On Mar 29, 2019, at 9:18 AM, tony12624120@gmail.com wrote:

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = '')
p.line(x = [1, 2], y = [3, 4])
code = ''' console.log(' !!! INSIDE !!!'); } '''

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {'custom_callbacks': [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/78c7a36f-d4ec-4aeb-b59b-82c41b4cbf51%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
tony12624120
tony12624120

I first tried on_js_event but it didn’t work that is why I came up with my previous solution. Is there any way to get it work? Thanks

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!‘) ‘’’

rest_tool = ResetTool()
rest_tool.js_on_event(‘tap’, CustomJS(code = code))
p.add_tools(rest_tool)

show(p)

``

···

On Friday, March 29, 2019 at 5:23:23 PM UTC+1, Bryan Van de ven wrote:

Hi,

Users should never have to mess with the callbacks dictionary directly, and are certainly never advised to, and why it is purposefully not demonstrated anywhere in the docs. It would have been made private except for some technical hurdles with doing so. Instead you should always use the js_on_event method which is what is demonstrated in all the docs and examples, e.g.

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py](https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py)

Thanks,

Bryan

On Mar 29, 2019, at 9:18 AM, tony12...@gmail.com wrote:

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS

from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!‘); } ‘’’

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {‘custom_callbacks’: [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)

–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bo...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/78c7a36f-d4ec-4aeb-b59b-82c41b4cbf51%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled