From: Benjamin R. <ben...@ou...> - 2013-01-30 16:03:42
|
On Tue, Jan 29, 2013 at 5:12 PM, Mads Ipsen <mad...@gm...> wrote: > Hi, > > I spend some time writing up the question below on Stackoverflow which > immediately was closed as a duplicate of other posts. To my best knowledge, > these posts did not answer my questions - so I'll try my luck here instead: > > I am using the qt backengine for setting up a QWidget that embeds a > matplotlib scene. When the widget is closed it appears that many of the > matplotlib objects that were part of the plot still are alive in Python > space. > > My question is basically the following: What actions should I take to > clean up the figure and axes objects etc. that were part of the plot > widget? The qt backend comes with a figure manager, but it appears a little > unclear how it should be used. > > I have attached a small unit test example that sets up a plot. When the > plot appears, just close it, and the test will garbage collects the plot, > and then display info of the matplotlib objects that are still alive in > Python space. Clearly both the path of the plot, and several Bbox objects > are still referenced. > > Our current unit test suite contains almost 10000 GUI tests and its > imperative that proper object space clean up is done after each test. Any > help is much appreciated. > > Best regards, > > Mads > > Would "fig.clf()" do what you need? Ben Root |