-
Notifications
You must be signed in to change notification settings - Fork 294
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
Basic widget button to display text on press does not work #1994
Comments
Another example from ipywidgets import widgets
lbl1 = widgets.Label('')
display(lbl1)
txt1 = widgets.Text()
txt1 Note that the label will not display unless it's not empty. |
Root cause is how output is wrapped in jupyter. We don't do this wrapping. Essentially all io_pub messages are routed to an output wrapper during widget creation. In this code here (inside the widget manager that jupyter has):
We might be able to do something similar were we remap all output etc to a custom output widget we stick below everything else? |
Note that classic Notebook and JupyterLab handle this differently. When a widget view generates a comm message that causes output:
There has been quite a bit of discussion about these behaviors: jupyter-widgets/ipywidgets#2380, sagemathinc/cocalc#3854 |
Thanks @jasongrout, I'm thinking we'll probably not fix this before we ship. |
Until JupyterLab 1.2, we silently discarded such output messages, and we had lots of complaints. One particular problem is that it discards not only print messages, but also error messages, so debugging a callback that throws an error becomes hard. A workaround for users is to use an Output widget to capture output. |
I thought vscode had logging capabilities already built in? It may be useful to surface uncaptured output somewhere so the user at least sees error messages, etc. For example, here is where we send them to the jlab log console: https://github.com/jupyter-widgets/ipywidgets/blob/master/packages/jupyterlab-manager/src/plugin.ts#L181-L199 |
Thanks. That would likely be a good workaround for now. We do log a lot of stuff to our developer console though. We'd likely have to put this somewhere else. I'm thinking the 'jupyter' output tab might be a good spot. |
@rchiodo Should this be validated? I validated the workaround here. But that's just a workaround. Are we ever looking at supporting this? Or should I just close the item? |
Yeah that was our decision. We can't fix this without doing the same thing jupyter notebooks do. Jupyter labs is not going to support this either. |
btn = widgets.Button(description='Medium')
display(btn)
def btn_eventhandler(obj):
print('Hello from the {} button!'.format(obj.description))
btn.on_click(btn_eventhandler)
In VSCode pressing the button does nothing.
The text was updated successfully, but these errors were encountered: