Drag with constraints

Hello!

I was thinking that it would be nice to program a pendulum with bokeh, where one can drag the tip of the pendulum and release.
Now, I would like to focus on the dragging part, ignoring the physics part of the problem for the moment.
So, I have one point that I can drag around with the constraint that it must stay at the same distance of some other point. Is it in principle possible to have this in bokeh?

Thanks a lot!

Definitely. You have access to x, y positions in the drag event callback. It’s most typical to set the glyph positions to be these same values to follow the mouse anywhere, but you can update the glyph positions differently in any way you need according to your needs.

Thank you! I will start to have a look and let you know if I managed something.

I am trying the PointDrawTool. When I select a point, is it possible that the other points don’t change their colors?

From what you have described I don’t think the PointDrawTool is what you want. It’s a high level tool that has many of its behaviors baked in. I think you want to define your own callbacks for discrete pan events.