In [61]:
publish.html("""
<input id='arg'>
<button id='run'>Run</button>
<div id="output"></div>
""")
In [68]:
publish.javascript("""$("#run").click(function(data) {
var data = "val arg=\""+$("#arg").val()+"\""
IPython.notebook.get_cell(2).code_mirror.setValue(data)
IPython.notebook.select(2)
IPython.notebook.execute_cells_below()
})
""")
def message(s:String) = publish.javascript("$('#output').text('"+s+"')")
Out[68]:
In [73]:
val arg="prova"
Out[73]:
In [75]:
for(i <- 1 to 10) {
message(s"count $i")
Thread.sleep(1000)
}
In [ ]: