Created
June 14, 2017 04:19
-
-
Save nicain/dfaa88e98a4a373b11ce2319e349da8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bokeh.io import show, curdoc | |
from bokeh.models.widgets import Button | |
from bokeh.layouts import row, widgetbox | |
from bokeh.models import ColumnDataSource, CustomJS | |
from bokeh import events | |
button = Button(label = 'Send HelloWorld to console') | |
source = ColumnDataSource(data=dict()) | |
jscb = CustomJS(code=''' | |
console.log('HelloWorld'); | |
''') | |
source.js_on_change('data', jscb) | |
def send_hello_world_to_console(): | |
source.data = {'data':['str']} | |
print 'Confirm that python CB worked' | |
button.on_click(send_hello_world_to_console) | |
# Comment this in to make sure that JS code is correct | |
# button.js_on_event(events.ButtonClick, jscb) | |
curdoc().add_root(row(widgetbox(button))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment