☰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 options from Select from callback

Community Support
Rakesh_Partapsing
Rakesh_Partapsing

Hi,

I am trying to change the options from a selection toolbox from a callback using the bokeh server.

My code:

from bokeh.io import curdoc

from bokeh.models import VBox, Select

def update(attrname, old, new):

var1 = select1.value

varA = int(var1) *5.0

varB = int(var1) *3.0

varC = int(var1) *8.0

newVar = [str(varA), str(varB), str(varC)]

select2.set(‘options’, newVar);

categories=[“1”,“2”,“3”]

select1 = Select(title=“Cat1”, value=categories[0], options=categories)

select1.on_change(‘value’, update)

select2 = Select(title=“Cat2”, value="")

layout = VBox(select1,select2)

#add to document

curdoc().add_root(layout)

my error:

set() takes 1 positional argument but 3 were given.

Could someone please tell me the correct way to do this?

Regards,

Rakesh

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

I found the solution, see code below:

from bokeh.io import curdoc

from bokeh.models import VBox, Select

def update(attrname, old, new):

var1 = select1.value

varA = int(var1) *5.0

varB = int(var1) *3.0

varC = int(var1) *8.0

newVar = [str(varA), str(varB), str(varC)]

select2.options = newVar

categories=[“1”,“2”,“3”]

select1 = Select(title=“Cat1”, value=categories[0], options=categories)

select1.on_change(‘value’, update)

select2 = Select(title=“Cat2”, value=“”)

layout = VBox(select1,select2)

#add to document

curdoc().add_root(layout)

···

On Monday, May 9, 2016 at 5:52:09 PM UTC+2, Raki wrote:

Hi,

I am trying to change the options from a selection toolbox from a callback using the bokeh server.

My code:

from bokeh.io import curdoc

from bokeh.models import VBox, Select

def update(attrname, old, new):

var1 = select1.value

varA = int(var1) *5.0

varB = int(var1) *3.0

varC = int(var1) *8.0

newVar = [str(varA), str(varB), str(varC)]

select2.set(‘options’, newVar);

categories=[“1”,“2”,“3”]

select1 = Select(title=“Cat1”, value=categories[0], options=categories)

select1.on_change(‘value’, update)

select2 = Select(title=“Cat2”, value=“”)

layout = VBox(select1,select2)

#add to document

curdoc().add_root(layout)

my error:

set() takes 1 positional argument but 3 were given.

Could someone please tell me the correct way to do this?

Regards,

Rakesh

⌁   Link to post
birdsarah_continuum
birdsarah_continuum

Thanks so much for
sharing.

···

On 5/10/16 8:57 AM, Raki wrote:

I found the solution, see code below:

from bokeh.io import curdoc

from bokeh.models import VBox, Select

def update(attrname, old, new):

var1 = select1.value

varA = int(var1) *5.0

varB = int(var1) *3.0

varC = int(var1) *8.0

newVar = [str(varA), str(varB), str(varC)]

select2.options = newVar

categories=[“1”,“2”,“3”]

        select1 = Select(title="Cat1", value=categories[0],

options=categories)

select1.on_change(‘value’, update)

select2 = Select(title=“Cat2”, value=“”)

layout = VBox(select1,select2)

#add to document

curdoc().add_root(layout)

      On Monday, May 9, 2016 at 5:52:09 PM UTC+2, Raki wrote:

Hi,

            I am trying to change the options from a selection

toolbox from a callback using the bokeh server.

My code:

from bokeh.io import curdoc

from bokeh.models import VBox, Select

def update(attrname, old, new):

var1 = select1.value

varA = int(var1) *5.0

varB = int(var1) *3.0

varC = int(var1) *8.0

newVar = [str(varA), str(varB), str(varC)]

select2.set(‘options’, newVar);

categories=[“1”,“2”,“3”]

              select1 = Select(title="Cat1", value=categories[0],

options=categories)

select1.on_change(‘value’, update)

select2 = Select(title=“Cat2”, value=“”)

layout = VBox(select1,select2)

#add to document

curdoc().add_root(layout)

my error:

set() takes 1 positional argument but 3 were given.

            Could someone please tell me the correct way to do

this?

Regards,

Rakesh

–

  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/6b22c474-5001-48f0-8842-b5b9813c0977%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .

–
Sarah Bird
Developer, Bokeh

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

https://groups.google.com/a/continuum.io/d/msgid/bokeh/6b22c474-5001-48f0-8842-b5b9813c0977%40continuum.io
https://groups.google.com/a/continuum.io/d/optout

⌁   Link to post
Bryan
Bryan

Rakesh,

On the JS side, the .set method is called exactly as you have given it. But on the python side, it only accepts keyword argument pairs. You'd need to call it like:

  select2.set(options=newVar)

Thanks,

Bryan

···

On May 9, 2016, at 4:52 PM, Rakesh Partapsing <r.partapsing@gmail.com> wrote:

Hi,

I am trying to change the options from a selection toolbox from a callback using the bokeh server.
My code:

from bokeh.io import curdoc
from bokeh.models import VBox, Select

def update(attrname, old, new):
    var1 = select1.value
    varA = int(var1) *5.0
    varB = int(var1) *3.0
    varC = int(var1) *8.0
    newVar = [str(varA), str(varB), str(varC)]
    select2.set('options', newVar);

categories=["1","2","3"]

select1 = Select(title="Cat1", value=categories[0], options=categories)
select1.on_change('value', update)
select2 = Select(title="Cat2", value="")

layout = VBox(select1,select2)

#add to document
curdoc().add_root(layout)

my error:
set() takes 1 positional argument but 3 were given.

Could someone please tell me the correct way to do this?

Regards,
Rakesh

--
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/CAKGpf60ucVD%2BE%2B-f1ftzwMoc9vQHWD06b1Ur%2Bd3grv3hupb2Ag%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled