In jupyter cell, I have the following code, and I can see the it works with "hello world!" printed out in Chrome console.
from IPython.display import Javascript
my_js = """
console.log('hello world!');
"""
Javascript(my_js)
Now, I create a button in jupyter and move that function to button click event. Now, when I click button, the event is executed, but the javascript doesn't work and no output in chrome console:
button = widgets.Button(
description='Button',
disabled=False,
button_style='',
tooltip='Button',
icon='check'
)
def on_button_clicked(b):
print("on_button_clicked called")
my_js = """
console.log('Hello world2!');
"""
Javascript(my_js)
print("on_button_clicked call ended")
button.on_click(on_button_clicked)
display(button)
Any idea? Thanks.
