Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joequant opened this issue Aug 27, 2020 · 0 comments
Open

Comments

@joequant
Copy link
Contributor

joequant commented Aug 27, 2020

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.

joequant pushed a commit to joequant/ipywidgets that referenced this issue Aug 28, 2020
This modifies the outputs widget to use comm rather than calling
ipython directly.  This fixes jupyter-widgets#2953 and Calysto/metakernel#217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant