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
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
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 [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/6b22c474-5001-48f0-8842-b5b9813c0977%40continuum.io?utm_medium=email&utm_source=footer) .
For more options, visit .
–
Sarah Bird
Developer, Bokeh
[

](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
Bryan
May 12, 2016, 2:47pm
4
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 <[email protected] > 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 [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/CAKGpf60ucVD%2BE%2B-f1ftzwMoc9vQHWD06b1Ur%2Bd3grv3hupb2Ag%40mail.gmail.com\ .
For more options, visit https://groups.google.com/a/continuum.io/d/optout\ .