Figure events raise errors in the presence of a BoxEditTool


I’m trying to create a figure with both an on_event(Tap) and a BoxEditTool with Bokeh 2.3.0. I’m finding that when a tap event occurs, I get error messages related to the BoxEditTool's custom_icon. Same goes for other events that aren’t Tap. Hopefully I’m either doing something wrong or there’s a workaround.


from import curdoc
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, BoxEditTool
from import Tap

def tap_event(tap):
    print('tap at', tap.x, tap.y)

plot = figure(plot_width=300, plot_height=300)
cds = ColumnDataSource(data=dict(x=[], y=[], width=[], height=[]))
rect = plot.rect('x', 'y', 'width', 'height', source=cds)
plot.on_event(Tap, tap_event)

data_cds = ColumnDataSource(data=dict(x=[1, 2, 3], y=[1, 2, 3]))
plot.scatter(x='x', y='y', source=data_cds)

Using bokeh serve with this, I’m able to use the BoxEditTool as expected, but when I tap the figure, tap_event() is not called and I get a rather lengthy error message that ends with
ValueError: failed to validate BoxEditTool(id='1039', ...).custom_icon: invalid value: None; allowed values are string filenames, PIL.Image.Image instances, or RGB(A) NumPy arrays.

Thanks in advance,

This is a bug, please file a GitHub Issue.

CC @mateusz this likely affects all the tools that can accept an icon

1 Like

If anyone else is curious the issue was created here:

This will be fixed in 2.3.1

1 Like