Hi,
I’ve been able to add fontawesome icons to a button widget, following the example in the src-code - which is great
I was now trying to move some of those actions, directly into the bokeh toolbar as bokeh.models.tools.customAction
I first had to change the callbacks to use js instead of python, so that a simple custom action looks like:
# js code to sho/hide a bokeh layout
show_hide_metadata_js = CustomJS(args=dict(metadata_layout=metadata_layout), code="""
if (metadata_layout.visible) {
metadata_layout.visible=false;
} else {
metadata_layout.visible=true;
}
""")
# attach the callback to a custom action item into the plot toolbar
show_hide_metadata = CustomAction(icon=os.path.join(os.path.dirname(__file__),
'static',
'icons',
'db.jpg'),
callback=show_hide_metadata_js,
action_tooltip='Show/Hide Metadata Table')
In the example above, I am using a direct link to an icon file, stored in the static folder of my application.
However, I was wondering if it is possible to re-use the icons from font-awesome. similar to what we have in the src-example:
icon=FontAwesomeIcon(icon_name="chevron-left", size=1)
I tried this way, but the custom action refuses the font awesome datatype.
I was mow trying to extract the data behind a FontAwesomeIcon
object, and use that as e.g.: a numpy array … but I can’t manage toaccomplish it.
is there a simpler way?