☰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

Best way to implement a callback besides the javascript coding

Community Support
arashaga
arashaga

I was trying to update two lines based on the information I get from the first line and calculate some optimal points and construct the second line. I wanted to to know if there are any methods that I can use within bokeh that I could use to create a callback to do the job.

In the following code I have implemented the callback for the first line but I I need to somehow call a second function once there is a change on the line to modify the second line, since the callback code is done in the javascript code I need to call a python function after that call back and pass the data to the second line. I would appreciate any help.

⌁   Link to post
Bryan
Bryan

There's no way to call python functions from JS callbacks. If you need to call python code for your interactions, the only option is to use the Bokeh Server. You can see a server example that updates data when a slider is changed here:

  https://github.com/bokeh/bokeh/blob/master/examples/app/sliders_applet/sliders_app.py

Thanks,

Bryan

···

On Jun 1, 2015, at 9:13 AM, arashaga@gmail.com wrote:

I was trying to update two lines based on the information I get from the first line and calculate some optimal points and construct the second line. I wanted to to know if there are any methods that I can use within bokeh that I could use to create a callback to do the job.

In the following code I have implemented the callback for the first line but I I need to somehow call a second function once there is a change on the line to modify the second line, since the callback code is done in the javascript code I need to call a python function after that call back and pass the data to the second line. I would appreciate any help.

test.py · GitHub

--
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/4b32f590-da67-4afd-bd42-e83f7ab4c752%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
arashaga
arashaga

Thanks Bryan!

···

On Wednesday, June 3, 2015 at 10:27:49 PM UTC-5, Bryan Van de ven wrote:

There’s no way to call python functions from JS callbacks. If you need to call python code for your interactions, the only option is to use the Bokeh Server. You can see a server example that updates data when a slider is changed here:

    [https://github.com/bokeh/bokeh/blob/master/examples/app/sliders_applet/sliders_app.py](https://github.com/bokeh/bokeh/blob/master/examples/app/sliders_applet/sliders_app.py)

Thanks,

Bryan

On Jun 1, 2015, at 9:13 AM, aras...@gmail.com wrote:

I was trying to update two lines based on the information I get from the first line and calculate some optimal points and construct the second line. I wanted to to know if there are any methods that I can use within bokeh that I could use to create a callback to do the job.

In the following code I have implemented the callback for the first line but I I need to somehow call a second function once there is a change on the line to modify the second line, since the callback code is done in the javascript code I need to call a python function after that call back and pass the data to the second line. I would appreciate any help.

https://gist.github.com/arashaga/a99934b0aa54feef938e

–
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+un...@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/4b32f590-da67-4afd-bd42-e83f7ab4c752%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