☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Change the RadioButtonGroup values based on Select widget

Community Support
Tyler_Nickerson
Tyler_Nickerson

Yes, you can do this by assigning a new value to the attribute you wish to change within a callback. Using bokeh server, one such callback could look like this:

def myCallback(attr, old, new):
    myRbgWidget.labels = newLabels
mySelectWidget.on_change('value', myCallback)

Using a javascript callback it might look like this:

cb = CustomJS(args=dict(myRgbWidget=myRgbWidget, newLabels=newLabels), code=    '''
myRgbWidget.labels = newLabels;
'''
)
mySelectWidget.js_on_change('value', cb)

If you aren’t familiar with callbacks, the tutorial notebooks on Bokeh Apps and Adding Interactions should help you put these snippets in context.

​

···

On Thu, Feb 2, 2017 at 5:10 AM, pratikkgandhi@gmail.com wrote:

Hello,

Is it possible to change the RadioButtonGroup values based on Select widget in Bokeh?

Thanks

Pratik

–

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/08cb5629-4aea-4f0a-9b01-312cc28b1361%40continuum.io.

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

⌁   Link to post
pratikkgandhi
pratikkgandhi

Hi Tyler,

Do you mind providing a small example of it?

Thank you,

Pratik

···

On Thursday, 2 February 2017 16:29:38 UTC-5, Tyler Nickerson wrote:

Yes, you can do this by assigning a new value to the attribute you wish to change within a callback. Using bokeh server, one such callback could look like this:

def myCallback(attr, old, new):
    myRbgWidget.labels = newLabels
mySelectWidget.on_change('value', myCallback)

Using a javascript callback it might look like this:

cb = CustomJS(args=dict(myRgbWidget=myRgbWidget, newLabels=newLabels), code=    '''
myRgbWidget.labels = newLabels;
'''
)
mySelectWidget.js_on_change('value', cb)

If you aren’t familiar with callbacks, the tutorial notebooks on Bokeh Apps and Adding Interactions should help you put these snippets in context.

​

On Thu, Feb 2, 2017 at 5:10 AM, pratik...@gmail.com wrote:

Hello,

Is it possible to change the RadioButtonGroup values based on Select widget in Bokeh?

Thanks

Pratik

–

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/08cb5629-4aea-4f0a-9b01-312cc28b1361%40continuum.io.

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

⌁   Link to post
Tyler_Nickerson
Tyler_Nickerson

No problem, here’s a working example using Bokeh Server

from [bokeh.io](http://bokeh.io) import curdoc
from bokeh.layouts import row
from bokeh.models.widgets import Select, RadioButtonGroup
select = Select(options=['foo', 'bar'], value='foo'
)
newLabels = {
'foo': ['foobar', 'foobaz'    ],
'bar': ['barfoo', 'barbaz'
]
}
radio = RadioButtonGroup(labels=newLabels['foo'
])
layout = row(select, radio)
def callback(attr, old, new):
    radio.labels = newLabels[select.value]
select.on_change('value'
, callback)
curdoc().add_root(layout)

​

···

On Thu, Feb 2, 2017 at 4:45 PM, pratikkgandhi@gmail.com wrote:

Hi Tyler,

Do you mind providing a small example of it?

Thank you,

Pratik

On Thursday, 2 February 2017 16:29:38 UTC-5, Tyler Nickerson wrote:

Yes, you can do this by assigning a new value to the attribute you wish to change within a callback. Using bokeh server, one such callback could look like this:

def myCallback(attr, old, new):
    myRbgWidget.labels = newLabels
mySelectWidget.on_change('value', myCallback)

Using a javascript callback it might look like this:

cb = CustomJS(args=dict(myRgbWidget=myRgbWidget, newLabels=newLabels), code=    '''
myRgbWidget.labels = newLabels;
'''
)
mySelectWidget.js_on_change('value', cb)

If you aren’t familiar with callbacks, the tutorial notebooks on Bokeh Apps and Adding Interactions should help you put these snippets in context.

​

On Thu, Feb 2, 2017 at 5:10 AM, pratik...@gmail.com wrote:

Hello,

Is it possible to change the RadioButtonGroup values based on Select widget in Bokeh?

Thanks

Pratik

–

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/08cb5629-4aea-4f0a-9b01-312cc28b1361%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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c99b6a9-fa43-4bee-ba4d-3d9146183771%40continuum.io.

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

⌁   Link to post
pratikkgandhi
pratikkgandhi

Thank you so much Tyler. Really appreciate your help!

···

On Thursday, 2 February 2017 20:34:34 UTC-5, Tyler Nickerson wrote:

No problem, here’s a working example using Bokeh Server

from [bokeh.io](http://bokeh.io) import curdoc
from bokeh.layouts import row
from bokeh.models.widgets import Select, RadioButtonGroup
select = Select(options=['foo', 'bar'], value='foo'
)
newLabels = {
'foo': ['foobar', 'foobaz'    ],
'bar': ['barfoo', 'barbaz'
]
}
radio = RadioButtonGroup(labels=newLabels['foo'
])
layout = row(select, radio)
def callback(attr, old, new):
    radio.labels = newLabels[select.value]
select.on_change('value'
, callback)
curdoc().add_root(layout)

​

On Thu, Feb 2, 2017 at 4:45 PM, pratik...@gmail.com wrote:

Hi Tyler,

Do you mind providing a small example of it?

Thank you,

Pratik

On Thursday, 2 February 2017 16:29:38 UTC-5, Tyler Nickerson wrote:

Yes, you can do this by assigning a new value to the attribute you wish to change within a callback. Using bokeh server, one such callback could look like this:

def myCallback(attr, old, new):
    myRbgWidget.labels = newLabels
mySelectWidget.on_change('value', myCallback)

Using a javascript callback it might look like this:

cb = CustomJS(args=dict(myRgbWidget=myRgbWidget, newLabels=newLabels), code=    '''
myRgbWidget.labels = newLabels;
'''
)
mySelectWidget.js_on_change('value', cb)

If you aren’t familiar with callbacks, the tutorial notebooks on Bokeh Apps and Adding Interactions should help you put these snippets in context.

​

On Thu, Feb 2, 2017 at 5:10 AM, pratik...@gmail.com wrote:

Hello,

Is it possible to change the RadioButtonGroup values based on Select widget in Bokeh?

Thanks

Pratik

–

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/08cb5629-4aea-4f0a-9b01-312cc28b1361%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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c99b6a9-fa43-4bee-ba4d-3d9146183771%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled