Change color of Toggle buttons on Change

Greetings:

Does the toggle button have attributes that allow for a change in color of the toggle box when active, i.e. going from the standard green to blue or red? Im currently using funtools to change my button functionality as below.

import functools

def handler(metadata, attr, old_value, new_value):

print(metadata[“IO”], attr, new_value) // “EIO0”, etc, for Ar

Tog_Ar = Toggle(label=“Argon Off”, button_type = “success”)

Tog_Ar.on_change(“active”, functools.partial(handler, {“IO”: “EIO0”}))

Thank you.

–V

Hi,

AGAIK there's not any properties that directly control the color, but buttons do have a "button_type" property, that takes these values:

  http://bokeh.pydata.org/en/latest/docs/reference/core/enums.html#bokeh.core.enums.ButtonType

Setting button_type to "danger" should give you a red button.

Otherwise, it might be possible to set the css_classes property and also include some appropriate extra CSS that changes the styling of the button, but I can't provide any details offhand. I'd suggest trying "button_type" first.

FYI I note that the enum docs nor the button docs do not have any images of what the button types look like. That would be helpful, can you make a GH issue to request this docs feature?

Thanks,

Bryan

···

On Jan 25, 2017, at 8:44 AM, Vivek Dwivedi <[email protected]> wrote:

Greetings:

Does the toggle button have attributes that allow for a change in color of the toggle box when active, i.e. going from the standard green to blue or red? Im currently using funtools to change my button functionality as below.

import functools

def handler(metadata, attr, old_value, new_value):
  print(metadata["IO"], attr, new_value) // "EIO0", etc, for Ar

Tog_Ar = Toggle(label="Argon Off", button_type = "success")
Tog_Ar.on_change("active", functools.partial(handler, {"IO": "EIO0"}))

Thank you.

--V

--
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/5ee5ae0d-e495-4420-8305-9a84ba5dee35%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan:

I got the toggle button to change color work by changing the button type from success to danger, I basically had to pass that to my handler function.

Thanks for you help.

BTW it would be helpful if an example to embed widgets along with streaming plots into FLASK or HTML could be provided.

···

On Wednesday, January 25, 2017 at 10:58:44 AM UTC-5, Bryan Van de ven wrote:

Hi,

AGAIK there’s not any properties that directly control the color, but buttons do have a “button_type” property, that takes these values:

    [http://bokeh.pydata.org/en/latest/docs/reference/core/enums.html#bokeh.core.enums.ButtonType](http://bokeh.pydata.org/en/latest/docs/reference/core/enums.html#bokeh.core.enums.ButtonType)

Setting button_type to “danger” should give you a red button.

Otherwise, it might be possible to set the css_classes property and also include some appropriate extra CSS that changes the styling of the button, but I can’t provide any details offhand. I’d suggest trying “button_type” first.

FYI I note that the enum docs nor the button docs do not have any images of what the button types look like. That would be helpful, can you make a GH issue to request this docs feature?

Thanks,

Bryan

On Jan 25, 2017, at 8:44 AM, Vivek Dwivedi [email protected] wrote:

Greetings:

Does the toggle button have attributes that allow for a change in color of the toggle box when active, i.e. going from the standard green to blue or red? Im currently using funtools to change my button functionality as below.

import functools

def handler(metadata, attr, old_value, new_value):

print(metadata[“IO”], attr, new_value) // “EIO0”, etc, for Ar

Tog_Ar = Toggle(label=“Argon Off”, button_type = “success”)

Tog_Ar.on_change(“active”, functools.partial(handler, {“IO”: “EIO0”}))

Thank you.

–V


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/5ee5ae0d-e495-4420-8305-9a84ba5dee35%40continuum.io.

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