此代码在 jupyter notebook 中有效,但在 jupyterlab 中无效:
import ipywidgets as widgets
from IPython.display import display
button = widgets.Button(description="Click Me!")
display(button)
def on_button_clicked(b):
print("Button clicked.")
button.on_click(on_button_clicked)
有没有人有办法解决吗 ?
环境:
- macOS 10 10.12.2
- Python 2.7.14 :: Anaconda, Inc.
- Jupyter 笔记本 5.4.0
- Jupyter 实验室 0.31.5