Icons for custom toolbar tool

Hi All,
I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated

I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

···

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,
I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated

I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

···

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,
I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated

I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea

Hi Eugene,
ok thanks. I see there are only few of them. Do you think is possible to point the code in my local folder and use my icon?

Thanks,
Andrea

···

On 1 December 2017 at 17:58, Eugene Pakhomov [email protected] wrote:

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,
I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated

I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

* The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

* built in Toolbar icons are provided by .less files here:

  https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I *believe* that will work.

THanks,

Bryan

···

On Dec 1, 2017, at 10:58, Eugene Pakhomov <[email protected]> wrote:

Hi Andrea,

I don't think there's a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,
Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:
More detail:

into the JS_CODE i have
icon: "bk-tool-icon-arrow-right"

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:
Hi All,
I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.
I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it's quite dated
I couldn't find any updated doc.
Anyone has an idea about it?

Many thanks,
Andrea

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Just to expand on it a bit - to facilitate sharing of static HTML files, and to potentially ease configuration of Bokeh server, it may make more sense to embed CSS into the HTML template, as well as icons in base64, as described e.g. here: https://css-tricks.com/data-uris/

  • Eugene
···

On Saturday, December 2, 2017 at 12:11:12 AM UTC+7, Bryan Van de ven wrote:

Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

  • The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

  • built in Toolbar icons are provided by .less files here:

      [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less)
    

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I believe that will work.

THanks,

Bryan

On Dec 1, 2017, at 10:58, Eugene Pakhomov [email protected] wrote:

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,

I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated
I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Eugene/Bryan,
thanks for the reply. I am sorry but i am kind of lost about what you wrote. Would you mind to provide a very basic but real example of how to incorporate an image into html and where to put that code? Or how can i edit the icon.less doc?

Thanks,
Andrea

···

On 1 December 2017 at 18:14, Eugene Pakhomov [email protected] wrote:

Just to expand on it a bit - to facilitate sharing of static HTML files, and to potentially ease configuration of Bokeh server, it may make more sense to embed CSS into the HTML template, as well as icons in base64, as described e.g. here: https://css-tricks.com/data-uris/

  • Eugene

On Saturday, December 2, 2017 at 12:11:12 AM UTC+7, Bryan Van de ven wrote:

Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

  • The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

  • built in Toolbar icons are provided by .less files here:

      [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less)
    

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I believe that will work.

THanks,

Bryan

On Dec 1, 2017, at 10:58, Eugene Pakhomov [email protected] wrote:

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,

I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated
I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/436a0be0-7732-42af-84ce-806a786ad7d5%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I am afraid what you are asking is not trivial to produce, and I currently have a new critical regression to handle that will necessitate a new release sooner than expected. Apologies, but I will not be able to work on this in the immediate future.

Bryan

···

On Dec 1, 2017, at 11:30, Andrea Tagliabue <[email protected]> wrote:

Hi Eugene/Bryan,
thanks for the reply. I am sorry but i am kind of lost about what you wrote. Would you mind to provide a very basic but real example of how to incorporate an image into html and where to put that code? Or how can i edit the icon.less doc?

Thanks,
Andrea

On 1 December 2017 at 18:14, Eugene Pakhomov <[email protected]> wrote:
Just to expand on it a bit - to facilitate sharing of static HTML files, and to potentially ease configuration of Bokeh server, it may make more sense to embed CSS into the HTML template, as well as icons in base64, as described e.g. here: https://css-tricks.com/data-uris/

- Eugene

On Saturday, December 2, 2017 at 12:11:12 AM UTC+7, Bryan Van de ven wrote:
Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

* The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

* built in Toolbar icons are provided by .less files here:

        https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I *believe* that will work.

THanks,

Bryan

> On Dec 1, 2017, at 10:58, Eugene Pakhomov <[email protected]> wrote:
>
> Hi Andrea,
>
> I don't think there's a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons
>
> Regards,
> Eugene
>
> On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:
> More detail:
>
> into the JS_CODE i have
> icon: "bk-tool-icon-arrow-right"
>
> => no icon in the browser
>
>
>
>
> On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:
> Hi All,
> I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.
> I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it's quite dated
> I couldn't find any updated doc.
> Anyone has an idea about it?
>
> Many thanks,
> Andrea
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/436a0be0-7732-42af-84ce-806a786ad7d5%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAKUye6DHj34jbukHoB%2B9bYWdeJwHQg6Y2VQ573bF4KciXCxV2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

main.py (the custom tool is there just to show the icon):

from os.path import dirname

from jinja2 import FileSystemLoader, Environment

from bokeh.embed.standalone import file_html
from bokeh.models import TapTool
from bokeh.plotting import figure
from bokeh.resources import CDN

class CustomTapTool(TapTool):
    __implementation__ = """
    import {TapToolView, TapTool} from "models/tools/gestures/tap_tool"

    export class CustomTapTool extends TapTool
      icon: "my-awesome-icon"
    """

fig = figure(tools=[CustomTapTool()])
fig.x(x=[1], y=[1])

env = Environment(loader=FileSystemLoader(dirname(__file__)))
template = env.get_template('template.html')

with open('out.html', 'w') as f:
    f.write(file_html(fig, resources=CDN, template=template))

template.html (has to be in the same directory):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{{ title|e if title else "Bokeh Plot" }}</title>
    {{ bokeh_css }}
    {{ bokeh_js }}
    <style>
        html {
            width: 100%;
            height: 100%;
        }

        body {
            width: 90%;
            height: 100%;
            margin: auto;
        }

        .my-awesome-icon {
            background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAACkFpQ0NQSUNDIFByb2ZpbGUAAEgNnZZ3VFPZFofPvTe90BIiICX0GnoJINI7SBUEUYlJgFAChoQmdkQFRhQRKVZkVMABR4ciY0UUC4OCYtcJ8hBQxsFRREXl3YxrCe+tNfPemv3HWd/Z57fX2Wfvfde6AFD8ggTCdFgBgDShWBTu68FcEhPLxPcCGBABDlgBwOFmZgRH+EQC1Py9PZmZqEjGs/buLoBku9ssv1Amc9b/f5EiN0MkBgAKRdU2PH4mF+UClFOzxRky/wTK9JUpMoYxMhahCaKsIuPEr2z2p+Yru8mYlybkoRpZzhm8NJ6Mu1DemiXho4wEoVyYJeBno3wHZb1USZoA5fco09P4nEwAMBSZX8znJqFsiTJFFBnuifICAAiUxDm8cg6L+TlongB4pmfkigSJSWKmEdeYaeXoyGb68bNT+WIxK5TDTeGIeEzP9LQMjjAXgK9vlkUBJVltmWiR7a0c7e1Z1uZo+b/Z3x5+U/09yHr7VfEm7M+eQYyeWd9s7KwvvRYA9iRamx2zvpVVALRtBkDl4axP7yAA8gUAtN6c8x6GbF6SxOIMJwuL7OxscwGfay4r6Df7n4Jvyr+GOfeZy+77VjumFz+BI0kVM2VF5aanpktEzMwMDpfPZP33EP/jwDlpzcnDLJyfwBfxhehVUeiUCYSJaLuFPIFYkC5kCoR/1eF/GDYnBxl+nWsUaHVfAH2FOVC4SQfIbz0AQyMDJG4/egJ961sQMQrIvrxorZGvc48yev7n+h8LXIpu4UxBIlPm9gyPZHIloiwZo9+EbMECEpAHdKAKNIEuMA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7Ujxkc9HhUelx8KPddU71Nc3qDeUNsKNksax43HHb/3g9UN7E6vpUDOjufgEOCE58eLH+B/vngw82XmKfarpJ/2f9rbQWopaodbc1om2pDZpe0x73+mA050dzh0tP5v/fPSM9pmas8pnS8+RzhWcmzmfd37yQsaF8YuJF4c6V3Q+urTk0p2usK7ey4GXr17xuXKp2737/FWXq2euOV07fZ19ve2G/Y3WHruell/sfmnpte9tvelws/2W462OvgV95/pd+y/e9rp95Y7/nRsDiwb67i6+e/9e3D3pfd790QepD14/zHo4/Wj9Y+zjoicKTyqeqj+t/dX412apvfTsoNdgz7OIZ4+GuEMv/5X5r0/DBc+pzytGtEbqR61Hz4z5jN16sfTF8MuMl9Pjhb8p/rb3ldGrn353+71nYsnE8GvR65k/St6ovjn61vZt52To5NN3ae+mp4req74/9oH9oftj9MeR6exP+E+Vn40/d3wJ/PJ4Jm1m5t/3hPP7MjpZfgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAXpJREFUOBGNUz1Lw1AUPelrK5kKQqdAQRAEVyfB1R/gJoIgODm5uvZPdHUSBKHg6loQhEJBcHOpuAkiOBRt2nrOfeElaQh4Icm995z7+V4i1EsPLXQNnuOD37d6ahFxOKE5QRsrOHzZI10+jxXZJT1GhDuSvtHAJZGdgG5g23zCxAHigAUlwhBNjJjgCAqoSo/4oXHELYlac3inr8NK19a+TzbmHp6Jjc3XRt84DlP6NGoQzXdulsNNRl5VvsIknjsxna+EVX/41Vxd6mklUEvMn13j+pikwZm2COuIZmw3oe2o18sSmwRnFsPYRok5xyvr/5Z860ZavQ/FETTfae0YDoMsX5yNnXhbm27hjMEDS+D3chXmdrjlaAehGXEVE8Qf45R2hwkeSL7nhXkKCZp4DFzPqRwjLEhnr+pN7DPBMCTIqwkbGTfLmC8xxTF9n+zgBUvsUV9kHHCxMVu+MGzBH8tzA1xWtERVzM/d3wH5hK1JtGYXzX/9zn+sD29baIuoLwAAAABJRU5ErkJggg==);
        }
    </style>
</head>
<body>
{{ plot_div|indent(8) }}
{{ plot_script|indent(8) }}
</body>
</html>

You can add new CSS classes into the HTML for your icons created with some services similar to https://websemantics.uk/tools/image-to-data-uri-converter/

Regards,

Eugene

···

On Saturday, December 2, 2017 at 12:30:33 AM UTC+7, Andrea Tagliabue wrote:

Hi Eugene/Bryan,
thanks for the reply. I am sorry but i am kind of lost about what you wrote. Would you mind to provide a very basic but real example of how to incorporate an image into html and where to put that code? Or how can i edit the icon.less doc?

Thanks,
Andrea

On 1 December 2017 at 18:14, Eugene Pakhomov [email protected] wrote:

Just to expand on it a bit - to facilitate sharing of static HTML files, and to potentially ease configuration of Bokeh server, it may make more sense to embed CSS into the HTML template, as well as icons in base64, as described e.g. here: https://css-tricks.com/data-uris/

  • Eugene

On Saturday, December 2, 2017 at 12:11:12 AM UTC+7, Bryan Van de ven wrote:

Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

  • The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

  • built in Toolbar icons are provided by .less files here:

      [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less)
    

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I believe that will work.

THanks,

Bryan

On Dec 1, 2017, at 10:58, Eugene Pakhomov [email protected] wrote:

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,

I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated
I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/436a0be0-7732-42af-84ce-806a786ad7d5%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Eugene,
your example works great! really stunning finishing!

Regards,
Andrea

···

On 1 December 2017 at 18:54, Eugene Pakhomov [email protected] wrote:

main.py (the custom tool is there just to show the icon):

from os.path import dirname

from jinja2 import FileSystemLoader, Environment

from bokeh.embed.standalone import file_html
from bokeh.models import TapTool
from bokeh.plotting import figure
from bokeh.resources import CDN


class CustomTapTool(TapTool):
    __implementation__ = """
    import {TapToolView, TapTool} from "models/tools/gestures/tap_tool"

    export class CustomTapTool extends TapTool
      icon: "my-awesome-icon"
    """


fig = figure(tools=[CustomTapTool()])
fig.x(x=[1], y=[1])

env = Environment(loader=FileSystemLoader(dirname(__file__)))
template = env.get_template('template.html')

with open('out.html', 'w') as f:
    f.write(file_html(fig, resources=CDN, template=template))

template.html (has to be in the same directory):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{{ title|e if title else "Bokeh Plot" }}</title>
    {{ bokeh_css }}
    {{ bokeh_js }}
    <style>
        html {
            width: 100%;
            height: 100%;
        }

        body {
            width: 90%;
            height: 100%;
            margin: auto;
        }

        .my-awesome-icon {
            background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAACkFpQ0NQSUNDIFByb2ZpbGUAAEgNnZZ3VFPZFofPvTe90BIiICX0GnoJINI7SBUEUYlJgFAChoQmdkQFRhQRKVZkVMABR4ciY0UUC4OCYtcJ8hBQxsFRREXl3YxrCe+tNfPemv3HWd/Z57fX2Wfvfde6AFD8ggTCdFgBgDShWBTu68FcEhPLxPcCGBABDlgBwOFmZgRH+EQC1Py9PZmZqEjGs/buLoBku9ssv1Amc9b/f5EiN0MkBgAKRdU2PH4mF+UClFOzxRky/wTK9JUpMoYxMhahCaKsIuPEr2z2p+Yru8mYlybkoRpZzhm8NJ6Mu1DemiXho4wEoVyYJeBno3wHZb1USZoA5fco09P4nEwAMBSZX8znJqFsiTJFFBnuifICAAiUxDm8cg6L+TlongB4pmfkigSJSWKmEdeYaeXoyGb68bNT+WIxK5TDTeGIeEzP9LQMjjAXgK9vlkUBJVltmWiR7a0c7e1Z1uZo+b/Z3x5+U/09yHr7VfEm7M+eQYyeWd9s7KwvvRYA9iRamx2zvpVVALRtBkDl4axP7yAA8gUAtN6c8x6GbF6SxOIMJwuL7OxscwGfay4r6Df7n4Jvyr+GOfeZy+77VjumFz+BI0kVM2VF5aanpktEzMwMDpfPZP33EP/jwDlpzcnDLJyfwBfxhehVUeiUCYSJaLuFPIFYkC5kCoR/1eF/GDYnBxl+nWsUaHVfAH2FOVC4SQfIbz0AQyMDJG4/egJ961sQMQrIvrxorZGvc48yev7n+h8LXIpu4UxBIlPm9gyPZHIloiwZo9+EbMECEpAHdKAKNIEuMAIsYA0cgDNwA94gAISASBADlgMuSAJpQASyQT7YAApBMdg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g9UN7E6vpUDOjufgEOCE58eLH+B/vngw82XmKfarpJ/2f9rbQWopaodbc1om2pDZpe0x73+mA050dzh0tP5v/fPSM9pmas8pnS8+RzhWcmzmfd37yQsaF8YuJF4c6V3Q+urTk0p2usK7ey4GXr17xuXKp2737/FWXq2euOV07fZ19ve2G/Y3WHruell/sfmnpte9tvelws/2W462OvgV95/pd+y/e9rp95Y7/nRsDiwb67i6+e/9e3D3pfd790QepD14/zHo4/Wj9Y+zjoicKTyqeqj+t/dX412apvfTsoNdgz7OIZ4+GuEMv/5X5r0/DBc+pzytGtEbqR61Hz4z5jN16sfTF8MuMl9Pjhb8p/rb3ldGrn353+71nYsnE8GvR65k/St6ovjn61vZt52To5NN3ae+mp4req74/9oH9oftj9MeR6exP+E+Vn40/d3wJ/PJ4Jm1m5t/3hPP7MjpZfgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAXpJREFUOBGNUz1Lw1AUPelrK5kKQqdAQRAEVyfB1R/gJoIgODm5uvZPdHUSBKHg6loQhEJBcHOpuAkiOBRt2nrOfeElaQh4Icm995z7+V4i1EsPLXQNnuOD37d6ahFxOKE5QRsrOHzZI10+jxXZJT1GhDuSvtHAJZGdgG5g23zCxAHigAUlwhBNjJjgCAqoSo/4oXHELYlac3inr8NK19a+TzbmHp6Jjc3XRt84DlP6NGoQzXdulsNNRl5VvsIknjsxna+EVX/41Vxd6mklUEvMn13j+pikwZm2COuIZmw3oe2o18sSmwRnFsPYRok5xyvr/5Z860ZavQ/FETTfae0YDoMsX5yNnXhbm27hjMEDS+D3chXmdrjlaAehGXEVE8Qf45R2hwkeSL7nhXkKCZp4DFzPqRwjLEhnr+pN7DPBMCTIqwkbGTfLmC8xxTF9n+zgBUvsUV9kHHCxMVu+MGzBH8tzA1xWtERVzM/d3wH5hK1JtGYXzX/9zn+sD29baIuoLwAAAABJRU5ErkJggg==);
        }
    </style>
</head>
<body>
{{ plot_div|indent(8) }}
{{ plot_script|indent(8) }}
</body>
</html>

You can add new CSS classes into the HTML for your icons created with some services similar to https://websemantics.uk/tools/image-to-data-uri-converter/

Regards,

Eugene

On Saturday, December 2, 2017 at 12:30:33 AM UTC+7, Andrea Tagliabue wrote:

Hi Eugene/Bryan,
thanks for the reply. I am sorry but i am kind of lost about what you wrote. Would you mind to provide a very basic but real example of how to incorporate an image into html and where to put that code? Or how can i edit the icon.less doc?

Thanks,
Andrea

On 1 December 2017 at 18:14, Eugene Pakhomov [email protected] wrote:

Just to expand on it a bit - to facilitate sharing of static HTML files, and to potentially ease configuration of Bokeh server, it may make more sense to embed CSS into the HTML template, as well as icons in base64, as described e.g. here: https://css-tricks.com/data-uris/

  • Eugene

On Saturday, December 2, 2017 at 12:11:12 AM UTC+7, Bryan Van de ven wrote:

Hi,

This is a nearly unexplored corner of Bokeh. I believe you are the first person ever to want a custom icon for a custom tool. Everything about making tools and their icons was previously and for a very long time purely an implementation detail, of interest only to core devs. Even now that making custom extensions more common, custom tools specifically are a niche use case. So there is not much by way of documentation for it.

That said, a few notes may help:

  • The bokeh.icons stuff you linked is not related to toolbar icons at all. In any case, it has also been completely removed since then, which is why there are no new references to it. You can safely forget about it.

  • built in Toolbar icons are provided by .less files here:

      [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less)
    

I believe you will have to similarly encode your icons in a CSS file (not exactly sure what Less does with the image files, maybe base64 encodes them?) then supply the CSS in a template for your app or standalone document. Then the tool can be configured to use the CSS name of the icon you defined. I believe that will work.

THanks,

Bryan

On Dec 1, 2017, at 10:58, Eugene Pakhomov [email protected] wrote:

Hi Andrea,

I don’t think there’s a documentation for that, but you can look at the source code here https://github.com/bokeh/bokeh/blob/master/bokehjs/src/less/icons.less and at the images themselves here https://github.com/bokeh/bokeh/tree/master/sphinx/source/_images/icons

Regards,

Eugene

On Friday, December 1, 2017 at 11:55:41 PM UTC+7, Andrea Tagliabue wrote:

More detail:

into the JS_CODE i have
icon: “bk-tool-icon-arrow-right”

=> no icon in the browser

On Friday, December 1, 2017 at 5:51:27 PM UTC+1, Andrea Tagliabue wrote:

Hi All,

I am trying to change the name of the icon which need to be used for a custom toolbar tool but i am getting some probs.

I am using this ref http://bokeh.pydata.org/en/0.11.0/docs/reference/icons.html but it’s quite dated
I couldn’t find any updated doc.

Anyone has an idea about it?

Many thanks,

Andrea


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9f9d0cc7-4832-4889-b055-8d6776a33f3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/436a0be0-7732-42af-84ce-806a786ad7d5%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e40e5aa3-1018-45d1-b167-1b7c2a99ea47%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.