[bokeh] How to access the coordinates of the 'box select tool' rect?

Hi,

This example shows a bokeh app that uses the bokeh.events machinery to print selection geometries:

    [https://github.com/bokeh/bokeh/blob/masieter/examples/howto/events_app.py](https://github.com/bokeh/bokeh/blob/masieter/examples/howto/events_app.py)

For a notebook, that means embedding a Bokeh server app, e.g. like

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb)

Thanks! My goal is to be able to draw points, lines, areas in images and get the geometry back.

Here is what I got so far:

https://gist.github.com/ocefpaf/c7706893a525c6d40c5ca07e16f6e746

Things that could improve this but I have no idea on how to implement them:

  1. The polygon select does not show the points and lines when I click.

  2. It would be nice if the last thing drawn could persist on the image.

Ideally I could draw stuff, modify it, and then reset the figure to remove them.

  1. Add a button that activates the callback only when clicked,

so the user can draw multiple times and save only the “correct” ones.

For (2) I saw an example of creating a patch with the drawing and then adding it to the image.

Maybe that is the best way to implement that? Not sure.

(1) Looks like a bug and I maybe there is already an example for (3) somewhere but I could not find it.

Thanks again,

-Filipe

PS: the first link above is a 404, the correct one is:

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