On Sun, Jul 27, 2008 at 7:43 AM, Paul Kienzle <[EMAIL PROTECTED]> wrote: > On Sat, Jul 26, 2008 at 7:26 PM, John Hunter <[EMAIL PROTECTED]> wrote: >> But this example revealed a serious problem for wxagg -- the wx >> backend save method was getting triggered. So wxagg couuld display an >> image, but if we try to save it, it fails because backend_wx's >> print_figure is getting called. I fixed this by reversing the order >> of the inheritance in FigureCanvasWXAgg so that FigureCanvasAgg is >> first. *please test*. > > That one is my fault. I was having trouble getting start_event_loop > and draw_idle from Wx to trigger from WxAgg. I have no explanation > why it works now with Agg before Wx --- Agg should pick up the default > draw_idle from Base so WxAgg shouldn't try to look for it in Wx.
It doesn't appear to be working for me. To keep things simple, I am working with backend_wx so there are no issues of diamond inheritance. It just appears that the specialization is broken. I get this endless loop when I try to run the demo -- I have some extra debug prints inserted to see what is getting called. Eg when I start the example, a window pops up with the "you will define a triangle" title, and the following is printed to the console home:~/mpl/examples/pylab_examples> python ginput_manual_clabel.py -dWX You will define a triangle, click to begin BlockingInput.__call__: calling canvas.start_event_loop <matplotlib.backends.backend_wx.FigureCanvasWx; proxy of <Swig Object of type 'wxPanel *' at 0xff091a0> > FigureCanvasWx.start_event_loop and then it waits for me. When I click just a single time on the axes to select a point, before I can actually select the points for the triangle, it enters the following loop and the console prints the output FigureCanvasWx.stop_event_loop BlockingInput.__call__: finally Select 3 corners with mouse BlockingInput.__call__: calling canvas.start_event_loop <matplotlib.backends.backend_wx.FigureCanvasWx; proxy of <Swig Object of type 'wxPanel *' at 0xff091a0> > FigureCanvasWx.start_event_loop BlockingInput.__call__: finally Too few points, starting over Select 3 corners with mouse BlockingInput.__call__: calling canvas.start_event_loop <matplotlib.backends.backend_wx.FigureCanvasWx; proxy of <Swig Object of type 'wxPanel *' at 0xff091a0> > FigureCanvasWx.start_event_loop BlockingInput.__call__: finally Too few points, starting over Select 3 corners with mouse BlockingInput.__call__: calling canvas.start_event_loop <matplotlib.backends.backend_wx.FigureCanvasWx; proxy of <Swig Object of type 'wxPanel *' at 0xff091a0> > FigureCanvasWx.start_event_loop BlockingInput.__call__: finally Too few points, starting over Select 3 corners with mouse BlockingInput.__call__: calling canvas.start_event_loop <matplotlib.backends.backend_wx.FigureCanvasWx; proxy of <Swig Object of type 'wxPanel *' at 0xff091a0> > FigureCanvasWx.start_event_loop FigureCanvasWx.stop_event_loop BlockingInput.__call__: finally and so on endlessly until I finally click 'x' to close the figure, I get the following dead object error raceback (most recent call last): File "ginput_manual_clabel.py", line 40, in <module> pts = np.asarray( plt.ginput(3,timeout=-1) ) File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/pyplot.py", line 355, in ginput return gcf().ginput(*args, **kwargs) File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/figure.py", line 1041, in ginput show_clicks=show_clicks) File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py", line 239, in __call__ BlockingInput.__call__(self,n=n,timeout=timeout) File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py", line 109, in __call__ self.cleanup() File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py", line 226, in cleanup self.fig.canvas.draw() File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 14029, in __getattr__ raise PyDeadObjectError(self.attrStr % self._name) wx._core.PyDeadObjectError: The C++ part of the FigureCanvasWx object has been deleted, attribute access no longer allowed. On a separate note, I also see the strangeness you are seeing with the multiple inheritance order. When I run the example with backend wxagg, I get the wx specialization called even though FigureCanvasAgg is defined first in the multiple inheritance heirarchy and so the base method should be picked up. And yet when I try and replicate this in test code, I always get the base class method ... Looks like we've got some work to do to sort all of this out. class Base: def speak(self, timeout): raise NotImplementedError class Agg(Base): pass class Wx(Base): def speak(self, timeout): print 'wx' class WXAgg(Agg,Wx): pass wxagg = WXAgg() wxagg.speak(timeout=1) Here is my version info -- running on os x leopard with home:~/mpl/examples/pylab_examples> python simple_plot.py --verbose-helpful -dWX$HOME=/Users/jdhunter CONFIGDIR=/Users/jdhunter/.matplotlib matplotlib data path /Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /Users/jdhunter/.matplotlib/matplotlibrc matplotlib version 0.98.3rc1 verbose.level helpful interactive is False units is False platform is darwin Using fontManager instance from /Users/jdhunter/.matplotlib/fontManager.cache backend WX version 2.8.3.0 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel