On Oct 28, 2016, at 2:45 PM, 'Daniel Krause' via Bokeh Discussion - Public <[email protected]> wrote:
Ok, I am a step further.
The handler / callback is working when I change the value of the select widget on the python side:
from bokeh.layouts import layout, widgetbox
from bokeh.models.widgets import Select
import subprocess
import time
def select_handler(attr, old, new):
print('Select value changed from {} to {}'.format(old, new))
if __name__ == '__main__':
args = ['python', '-m', 'bokeh', 'serve']
p = subprocess.Popen(args)
time.sleep(1)
select = Select(title="Select Test:", value="no1",
options=["no1", "no2"])
select.on_change('value', select_handler)
layout = layout([[widgetbox(select)]], sizing_mode='scale_width')
session = push_session(curdoc())
session.show(layout)
select.value = 'no2'
But it is not reacting to changes in the browser.
The console output:
2016-10-28 21:40:51,144 Starting Bokeh server version 0.12.3
2016-10-28 21:40:51,151 Starting Bokeh server on port 5006 with applications at paths ['/']
2016-10-28 21:40:51,151 Starting Bokeh server with process id: 7104
2016-10-28 21:40:51,209 WebSocket connection opened
2016-10-28 21:40:51,210 ServerConnection created
Select value changed from no1 to no2
2016-10-28 21:40:51,481 WebSocket connection closed: code=None, reason=None
2016-10-28 21:40:51,506 200 GET /?bokeh-session-id=6TOg0Ksc3oLaAUvyO0LNOyrni7wLzDagLkqa8QI8z194 (::1) 11.51ms
2016-10-28 21:40:51,974 WebSocket connection opened
2016-10-28 21:40:51,975 ServerConnection created
Am Freitag, 28. Oktober 2016 21:29:10 UTC+2 schrieb Daniel Krause:
Hello,
I tried to define a select widget and a handler / callback that is executed when the selected item is changed.
from bokeh.client import push_session
from bokeh.plotting import curdoc
from bokeh.layouts import layout, widgetbox
from bokeh.models.widgets import Select
import subprocess
import time
def select_handler(attr, old, new):
print('Select value changed from {} to {}'.format(old, new))
if __name__ == '__main__':
args = ['python', '-m', 'bokeh', 'serve']
p = subprocess.Popen(args)
time.sleep(1)
select = Select(title="Select Test:", value="no1",
options=["no1", "no2"])
select.on_change('value', select_handler)
layout = layout([[widgetbox(select)]], sizing_mode='scale_width')
session = push_session(curdoc())
session.show(layout)
Result:
But the callback is not triggered when I change between 'no1' and 'no2'.
Any help is appreciated.
Thanks
Daniel
--
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/1e8fdf80-ad00-44f4-8f3c-8d55b1201dca%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.