Hi Bryan,
Thanks for the quick response! I am using bokeh 2.2.3, however not seeing those params when looking in the API docs under BoxSelectTool (the links you provided were for the BoxEditTool
). Those params seem to be present in all classes inheriting the EditTool
, but not in those inheriting the SelectTool
.
Just in case, below is my reprex:
import pandas as pd
from bokeh.models import BoxSelectTool, CrosshairTool, PointDrawTool
from bokeh.plotting import ColumnDataSource, figure, output_file, reset_output, show
p = figure()
# Draw some random points
x_coords = [0, 1, 2, 3, 4]
y_coords = [0, 1, 2, 3, 4]
p.scatter(x=x_coords, y=y_coords, color='red')
# Setup source, renderer, icon, and PointDrawTool -> this works fine and my icon shows up
src = ColumnDataSource(pd.DataFrame({'x': [], 'y': []}))
r1 = p.rect(x='x', y='y', width=0.5, height=0.5, source=src)
pd_icon = '/home/user/icon.png' # this is a 200x200 transparent png file
pd_tool = PointDrawTool(renderers=[r1], custom_tooltip='Add New Rect', custom_icon=pd_icon)
# Try the same with tool of type SelectTool -> this does not work, causes error (below)
select_icon = '/home/user/icon2.png'
box_sel = BoxSelectTool(dimensions='height', mode=None, custom_tooltip='Box Select Test', custom_icon=select_icon)
p.add_tools(pd_tool, box_sel)
show(p)
This ends up giving me the following traceback (which makes sense):
Traceback (most recent call last):
File "<ipython-input-65-fe6b63b66c18>", line 16, in <module>
box_sel = BoxSelectTool(dimensions='height', mode=None, custom_tooltip='Box Select Test', custom_icon=select_icon)
File "/home/user/anaconda3/envs/bokeh-test/lib/python3.8/site-packages/bokeh/model.py", line 235, in __init__
super().__init__(**kwargs)
File "/home/user/anaconda3/envs/bokeh-test/lib/python3.8/site-packages/bokeh/core/has_props.py", line 249, in __init__
setattr(self, name, value)
File "/home/user/anaconda3/envs/bokeh-test/lib/python3.8/site-packages/bokeh/core/has_props.py", line 285, in __setattr__
raise AttributeError("unexpected attribute '%s' to %s, %s attributes are %s" %
AttributeError: unexpected attribute 'custom_tooltip' to BoxSelectTool, possible attributes are dimensions, js_event_callbacks, js_property_callbacks, mode, name, names, origin, overlay, renderers, select_every_mousemove, subscribed_events or tags