☰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

capture the option that is selected in the Select widget

Community Support
spg2731476
spg2731476

Hi,
Can someone please tell me how could the option selected in the ‘select’ widget be captured.
I tried the following and expected that when I change the selection in drop down menu, it should print the newly selected option. But it’s not happening.

from bokeh.models.widgets import Select
from bokeh.io import output_notebook, show, vform
from bokeh.models import CustomJS

output_notebook()
states=[‘VA’,‘MD’,‘SC’]

select = Select(title=“Select State:”, value=“VA”, options=states)

show(vform(select))

def call(attr,old,new):
print new

select.on_change(‘value’,select,call)

``

Regards,
Praveen

⌁   Link to post
birdsarah_continuum
birdsarah_continuum

select.on_change(‘value’, call)

should be what you need.

···

On 10/7/16 12:26 PM,
wrote:

spg2731476@gmail.com

Hi,

    Can someone please tell me how could the option selected in the

‘select’ widget be captured.

    I tried the following and expected that when I change the

selection in drop down menu, it should print the newly selected
option. But it’s not happening.

          from bokeh.models.              widgets

import Select

          from bokeh.io import
            output_notebook, show, vform

          from bokeh.models import CustomJS



            output_notebook()

            states=['VA','MD','SC']



          select = Select(title=                "Select

State:", value=“VA”, options=states)

            show(vform(select))



          def call(attr,old,new):

                print new

               

          select.on_change('value',select,call)

``

    Regards,

    Praveen

–

  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/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io?utm_medium=email&utm_source=footer).

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

–
Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)
⌁   Link to post
birdsarah_continuum
birdsarah_continuum

See an example here:

        Here's the example running:
···

https://github.com/bokeh/bokeh-demos/blob/master/weather/main.py#L88https://demo.bokehplots.com/apps/weather
On 10/7/16 12:26 PM,
wrote:

spg2731476@gmail.com

Hi,

    Can someone please tell me how could the option selected in the

‘select’ widget be captured.

    I tried the following and expected that when I change the

selection in drop down menu, it should print the newly selected
option. But it’s not happening.

          from bokeh.models.              widgets

import Select

          from bokeh.io import
            output_notebook, show, vform

          from bokeh.models import CustomJS



            output_notebook()

            states=['VA','MD','SC']



          select = Select(title=                "Select

State:", value=“VA”, options=states)

            show(vform(select))



          def call(attr,old,new):

                print new

               

          select.on_change('value',select,call)

``

    Regards,

    Praveen

–

  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/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io?utm_medium=email&utm_source=footer).

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

–
Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)
⌁   Link to post
birdsarah_continuum
birdsarah_continuum

Just noticed you’re
in the notebook.

You probably also need “push_notebook()”

          See examples of

interaction in notebook here:

···

https://github.com/bokeh/bokeh/tree/master/examples/howto/notebook_comms
On 10/7/16 12:26 PM,
wrote:

spg2731476@gmail.com

Hi,

    Can someone please tell me how could the option selected in the

‘select’ widget be captured.

    I tried the following and expected that when I change the

selection in drop down menu, it should print the newly selected
option. But it’s not happening.

          from bokeh.models.              widgets

import Select

          from bokeh.io import
            output_notebook, show, vform

          from bokeh.models import CustomJS



            output_notebook()

            states=['VA','MD','SC']



          select = Select(title=                "Select

State:", value=“VA”, options=states)

            show(vform(select))



          def call(attr,old,new):

                print new

               

          select.on_change('value',select,call)

``

    Regards,

    Praveen

–

  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/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/547700e7-3328-4eae-9c79-4201b7c8e206%40continuum.io?utm_medium=email&utm_source=footer).

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

–
Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)
⌁   Link to post

End of archived discussion · Replies are disabled