You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine when I use this class within jupyter notebooks using the %matplotlib widget magic before executing the above code.
When executed within ipython I get TraitError: Element of the 'children' trait of a MyVis instance must be a Widget, but a value of <matplotlib.backends.backend_tkagg.FigureCanvasTkAgg object at 0x7f0c48d731d0> <class 'matplotlib.backends.backend_tkagg.FigureCanvasTkAgg'> was specified.
since of course ipympl and its magic are not active.
Since I also want to have unit-tests for this class (and others that make use of this class) using pytest, it would be nice to get around this problem.
Can I enable the ipympl way of handling figures somehow in the python shell (similar to using the %matplotlib widget magic in the notebook) that would allow my tests to run?
The text was updated successfully, but these errors were encountered:
I have a class that inherits from the
ipywidgets.widgets.VBox
and adds afigure.canvas
instance of a matplotlib figure to its children like so:This works fine when I use this class within jupyter notebooks using the
%matplotlib widget
magic before executing the above code.When executed within ipython I get
TraitError: Element of the 'children' trait of a MyVis instance must be a Widget, but a value of <matplotlib.backends.backend_tkagg.FigureCanvasTkAgg object at 0x7f0c48d731d0> <class 'matplotlib.backends.backend_tkagg.FigureCanvasTkAgg'> was specified.
since of course
ipympl
and its magic are not active.Since I also want to have unit-tests for this class (and others that make use of this class) using
pytest
, it would be nice to get around this problem.Can I enable the
ipympl
way of handling figures somehow in the python shell (similar to using the%matplotlib widget
magic in the notebook) that would allow my tests to run?The text was updated successfully, but these errors were encountered: