jupyter-widgets / tutorial

A tutorial for widgets
BSD 3-Clause "New" or "Revised" License
394 stars 164 forks source link

Examples that fail in JupyterLab #10

Closed mwcraig closed 6 years ago

mwcraig commented 6 years ago

The only failure I've found so far is this, from the "Widget Events" notebook (and the example a couple cells below it):

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)

In classic, this prints "Button clicked" in the same cell as the widget. In Lab, nothing is printed. @jasongrout, is the best fix for now to put the prints into a new widget (output, or an HTML widget, or something)?

I find that pattern -- put your pdebugging-style print statements into some kind of widget you can display very useful anyway, so am inclined to go that route.