Best way to implement a callback besides the javascript coding

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.

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, [email protected] 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 [email protected].
To post to this group, send email to [email protected].
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\.

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, [email protected] 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 [email protected].

To post to this group, send email to [email protected].

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.