Bokeh server and on.click (on.change) doing nothing
<p>I am trying to get Bokeh server to print out, however all I get is an instance running on <a href="http://localhost:5006/?bokeh-session-id=default" rel="nofollow">http://localhost:5006/?bokeh-session-id=default</a> with the radio buttons. When I click the buttons nothing happens. Is there something I am missing?</p>

<pre><code>from bokeh.models.widgets import RadioButtonGroup
from bokeh.plotting import figure, show, output_server


def my_radio_handler():
    print 'Radio button option selected.'


radio_button_group = RadioButtonGroup(
        labels=["Option 1", "Option 2", "Option 3"], active=0)

radio_button_group.on_click(my_radio_handler)

output_server()

show(radio_button_group)
</code></pre>

<p>You need to sync the server and the current session to get informations back.</p>

<pre><code>from bokeh.client import push_session
from bokeh.models.widgets import RadioButtonGroup
from bokeh.plotting import curdoc, figure, show, output_server


def my_radio_handler(new):
    print 'Radio button ' + str(new) + ' option selected.'


radio_button_group = RadioButtonGroup(
    labels=['Option 1', 'Option 2', 'Option 3'], active=0)
radio_button_group.on_click(my_radio_handler)

# Open a session to keep our local document in sync with server
session = push_session(curdoc())

# Open the document in a browser
session.show(radio_button_group)

# Run forever (this is crucial to retrive callback's data)
session.loop_until_closed()
</code></pre>

<p>You can get more control on the click handler using <code>on_change()</code>:</p>

<pre><code>def my_radio_handler_complete(attr, old, new):
    print(attr, old, new)
    print('Radio button ' + str(new) + ' option selected.')

radio_button_group.on_change('active', my_radio_handler_complete)
</code></pre>

<p>FYI, in the source-code, <code>on_click</code> is just a proxy for <code>on_change()</code> and defined as:</p>

<pre><code>def on_click(self, handler):
   self.on_change('active', lambda attr, old, new: handler(new))
</code></pre>

python bokeh