This issue is breaking my mindI cannot pass simple variable to python from JS in Bokeh.So, something like this is working fine:
from IPython.display import HTMLinput_form = """<div style="background-color:gainsboro; border:solid black; width:300px; padding:20px;">Variable Name: <input type="text" id="var_name" value="foo"><br>Variable Value: <input type="text" id="var_value" value="bar"><br><button onclick="set_value()">Set Value</button></div>"""javascript = """<script type="text/Javascript"> function set_value(){ var var_name = document.getElementById('var_name').value; var var_value = document.getElementById('var_value').value; var command = var_name +" = '" + var_value +"'"; console.log("Executing Command: " + command); var kernel = IPython.notebook.kernel; kernel.execute(command); }</script>"""HTML(input_form + javascript)
While this code from Bokeh is not working!!!Python keeps returning "name 'inds' is not defined"
source.callback = CustomJS(args=dict(p=p), code="""var inds = cb_obj.get('selected')['1d'].indices; var d1 = cb_obj.get('data'); console.log(d1) var kernel = IPython.notebook.kernel; IPython.notebook.kernel.execute("inds = " + inds); """)
Any help?