Open jkitchin opened 4 years ago
This is currently one of the top results for this question in a major search engine. For people from the future: When using jupyterlab with ipympl, then as described in the ipympl documentation, the errors can either be looked at in the jupyterlab log console (View > Show Log Console), or captured via an ipywidgets widgets.Output
:
out = widgets.Output()
@out.capture()
def onpick(event):
...
I do not know whether this also works in a classic notebook, which this question was about, but wanted to leave this trace for others.
The example below should highlight the point that you click on, and change the title of the graph to show the label associated with that point.
If I run this Python script as a script, when I click on a point I will get an error " line 15, in onpick TypeError: only integer scalar arrays can be converted to a scalar index", which is expected. event.ind is a list, and I need to change that to ind = event.ind[0] to be correct here.
However, when I run this in a Jupyter notebook, the figure appears, but the error is silently ignored, so it just appears that the code does not work. Is there a way to get Jupyter to show me that an error has occurred?