on_event works beautifully for me when I apply it to a figure. However, this method is also provided for individual renderers. I figured this was the logical way to say, listen for a mouse scroll event while the mouse is hovering a certain patch, like this:
from bokeh.plotting import figure from bokeh.events import MouseWheel import panel as pn f = figure() p = f.patch([0, 1, 2], [0, 1, 0]) f.on_event(MouseWheel, lambda evt: print("Figure Event", evt)) p.on_event(MouseWheel, lambda evt: print("Patch Event", evt)) pn.pane.Bokeh(f).show()
However, I only ever get the “Figure Event” callback, not the “Patch Event”. This is on bokeh 2.2.3 (latest) with Chrome or Firefox on Windows 10. It’s the same if I try the Tap event.
Am I mis-interpreting or mis-using the patch’s
on_event? Is there another way to listen for events happening over a specific patch?
Thanks a lot in advance!