capture the option that is selected in the Select widget

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

select.on_change(‘value’, call)

should be what you need.

···

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

[email protected]

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 [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/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)

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:

[email protected]

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 [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/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)

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:

[email protected]

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 [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/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)