Skip to content

context manager version of outputs widget does not work with metakernel #217

@joequant

Description

@joequant
import ipywidgets
from IPython.display import display
a=1
button = ipywidgets.Button(description="Click Me!")
output = ipywidgets.Output();

def on_button_clicked(button):
    global a
    a=a+1
    with output:
       print('foo")
    output.append_stdout("bar")

button.on_click(on_button_clicked)

"foo" will not appear in the output widget but "bar"

The problem is with ipywidgets which calls get_ipython to get kernel information. This can be fixed by monkey patching widget_outputs, but for now it can be worked around by using the append_stdout syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions