Hi,
There is a dusty and not-often used facility called ToolEvents that you can use at the moment:
from bokeh.plotting import figure
from bokeh.io import curdoc
p = figure(tools="box_select")
p.circle([1,2,3], [4,5,6])
def cb(attr, old, new):
print(p.tool_events.geometries)
p.tool_events.on_change('geometries', cb)
curdoc().add_root(p)
Running this will generate output like
[{'type': 'rect', 'vx0': 169.18383026123047, 'vx1': 405.18383026123047, 'vy0': 143, 'vy1': 365, 'x0': 1.4736090642078281, 'y0': 4.357899409085795, 'x1': 2.4312257718798547, 'y1': 5.213532885154276}]
Which is what you are after, if I understand your question.
HOWEVER, please be advised that we are currently in the process of revamping the events system to be more general and consistent, and the ToolEvents mode will probably be deprecated in the process. (i.e. just understand that the code above will have to change at some point in the future).
Thanks,
Bryan
···
On Feb 25, 2017, at 16:30, nicolas.fr <[email protected]> wrote:
I forgot to mention that the problem for us is to access the selection 'geometry' from python.
We used to inject the selection coordinates into the python world asking the ipython kernel to execute a cmd from the JS callback attached to the BoxSelectTool. Unfortunately, this approach doesn't work properly with the 'embed server'.--
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/66fd63e6-c3e0-4a44-b922-d056849908e9%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.