Here below the custom action tool extension (KillTool) code to remove the graph (removal is executed by an associated Toggle python callback). Works perfect.
BUT
without success, I tried to change the tool icon to fontawesome “close” or “remove”
-
tried to import Fontawesome and set at the end of the script below
icon: Fontawesome(‘remove’))
and
icon: "remove"
- tried on python side to set KillTool(icon = FontAwesomeIcon(icon_name=‘remove’))
but ActionTool do not accept parameters
Seems that there is no way to set the icon of tools on the python side, did not see a corresponding attribute
Is that so ? maybe missing something obvious ? Any help appreciated. Thanks
Code:
from bokeh.models import Tool
JS_CODE = “”"
import * as p from “core/properties”
import {ActionTool, ActionToolView} from “models/tools/actions/action_tool”
export class KillToolView extends ActionToolView
doit: () →
label = this.model.name
g = Bokeh.documents[0]._all_models_by_name._dict["g_"+label]
b = Bokeh.documents[0]._all_models_by_name.dict["b"+label]
b.active = false
return null
export class KillTool extends ActionTool
default_view: KillToolView
type: “KillTool”
tool_name: “Kill”
icon: “bk-tool-icon-reset”
“”"
class KillTool(Tool):
__implementation__ = JS_CODE