From: Michael D. <md...@st...> - 2008-07-31 14:06:09
|
There was a thread on this a few weeks ago (which unfortunately I can't find). Supporting wx 2.6 is not a goal for the Wx backend in 0.98.x. It is impossible to support matplotlib's new drawing API (which includes Bezier curves and alpha transparency) with the old wx API. If you need to use wx 2.6, however, you can use the WxAgg backend, which has the added bonus of being faster. Unfortunately, throwing an exception/warning when using the wx backend with wx2.6 fell through the cracks. I'll add that to SVN. Cheers, Mike David Kaplan wrote: > Hi, > > I am still getting crashes using the WX backend with the latest SVN. > For example: > > In [1]: figure() > ------------------------------------------------------------ > Traceback (most recent call last): > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_wx.py", > line 1092, in _onSize > self.draw() > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_wx.py", > line 892, in draw > self.figure.draw(self.renderer) > File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line > 724, in draw > if self.frameon: self.patch.draw(renderer) > File "/usr/lib/python2.5/site-packages/matplotlib/patches.py", line > 257, in draw > gc = renderer.new_gc() > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_wx.py", > line 366, in new_gc > self.gc = GraphicsContextWx(self.bitmap, self) > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_wx.py", > line 463, in __init__ > gfx_ctx = wx.GraphicsContext.Create(dc) > <type 'exceptions.AttributeError'>: 'module' object has no attribute > 'GraphicsContext' > > It appears that this GraphicsContext either isn't in my version of > wxPython or isn't initialized properly. Updating to wxPython 2.8 fixed > the problem, but I think that breaks other things on my system (like > system tools on Ubuntu that I need to use). For now I will just use > 2.8, but I may have to revert. Is supporting wx 2.6 a goal? > > Cheers, > David > > On Thu, 2008-07-24 at 11:55 -0400, Paul Kienzle wrote: > >> On Thu, Jul 24, 2008 at 05:14:42PM +0200, David Kaplan wrote: >> >>> Hi, >>> >>> No, it doesn't appear to work with or without my changes. Also, it >>> looks to me like the following code is now misplaced in backend_wx.py: >>> >>> # Event binding code changed after version 2.5 >>> if wx.VERSION_STRING >= '2.5': >>> def bind(actor,event,action,**kw): >>> actor.Bind(event,action,**kw) >>> else: >>> def bind(actor,event,action,id=None): >>> if id is not None: >>> event(actor, id, action) >>> else: >>> event(actor,action) >>> >>> It now appears after some functions not in the class. Is this OK? >>> >> This code is not part of any class. Anyway, I moved it to the top >> of the file. >> >> >>> Also, I noticed that this defines bind, while elsewhere in the class >>> self.Bind is used. Is this correct? If so, should these other >>> references perhaps take advantage of your abstraction? >>> >> I've committed a change so that all functions now use >> >> bind(self, wx.EVT, callback, id=id) >> >> rather than >> >> if wx.VERSION_STRING >= '2.5': >> self.Bind(wx.EVT,callback,id=id) >> else: >> wx.EVT(self, id, callback) >> >> I'm not set up to test against wx < 2.5, though given its age >> and the small user base of matplotlib wx, I'm not sure that >> it is relevant anymore. >> >> >> - Paul >> >> -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |