☰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

Triggering JS callback when activating/deactivating a tool

Community Support
d-que
d-que

Hello everyone,

Apologies for spamming, but I have a question regarding tools. I have got a TapTool with my personal callback. Now, I would like to trigger a different js callback (hiding and showing some lines) upon (de)activation of the plot tool. Can I do that? I was searching around and could not find a solution.

TapTool.js_on_change('active') or a js_link did not do the job.

Many thanks in advance!
Daniel

⌁   Link to post
p-himik
p-himik

active is an internal property (don’t know the reason) so you can’t really do anything with it except for direct changes.

I think you would have to create a custom tool model for this.

⌁   Link to post
Bryan
Bryan

It doesn’t make sense for it to be user-settable, since which tools are active is coordinated at a higher level. But it well-predates the introduction of readonly properties, so at the time all that could be done was to hide it. Now that readonly properties ar ean option, we could consider adding it as such.

⌁   Link to post
d-que
d-que

Hi!

Thanks for the infos. I also tried to do plot.toolbar.js_on_change('active_tap', callback) which probably does not work for similar reasons. Having those properties as readonly would be great. But I am not sure how widespread the usage would be (though I would appreciate it).

My workaround is to have a Button with a js_link to line visibility. Thanks for your efforts!

Cheers,
Daniel

⌁   Link to post

End of archived discussion · Replies are disabled