Hi,
I am trying to get matplotlib 1.2.0 to work with wxPython Phoenix - will provide a patch when it is working.
Made the changes to backend_wx* for things like EmptyImage/EmptyBitmap and Toolbar but I am stuck on the following.
if bbox is None:
# agg => rgba buffer -> bitmap
if 'phoenix' in wx.PlatformInfo:
return wx.Bitmap.FromBufferRGBA(int(agg.width), int(agg.height),
memoryview(agg.buffer_rgba()))
else:
return wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height),
agg.buffer_rgba())
else:
# agg => rgba buffer -> bitmap => clipped bitmap
return _WX28_clipped_agg_as_bitmap(agg, bbox)
TypeError: cannot make memory view because object does not have the buffer interface
File "h:\devProjectsT\aaTests\matplotlib\wxembedding-5.py", line 63, in <module>
demo()
File "h:\devProjectsT\aaTests\matplotlib\wxembedding-5.py", line 60, in demo
app.MainLoop()
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\core.py", line 1841, in MainLoop
rv = wx.PyApp.MainLoop(self)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wx.py", line 1209, in _onPaint
self.draw(drawDC=drawDC)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 61, in draw
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 173, in _convert_agg_to_wx_bitmap
memoryview(agg.buffer_rgba()))
I tried using "memoryview" based on a suggestion by Robin Dunn, and based on the following info I see in the debugger that should work no?
agg.buffer_rgba()
<read-write buffer ptr 0x05400638, size 229200 at 0x055FC680>
type(agg.buffer_rgba())
<type 'buffer'>
agg
<matplotlib.backends.backend_agg.RendererAgg instance at 0x04BA0670>
If I don't use "memoryview" (which would probably be preferred) I get the following exception.
Can someone help us figure this one out.
Thanks
Werner
TypeError: Bitmap.FromBufferRGBA(): argument 3 has unexpected type 'buffer'
File "h:\devProjectsT\aaTests\matplotlib\wxembedding-5.py", line 63, in <module>
demo()
File "h:\devProjectsT\aaTests\matplotlib\wxembedding-5.py", line 60, in demo
app.MainLoop()
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\core.py", line 1841, in MainLoop
rv = wx.PyApp.MainLoop(self)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wx.py", line 1209, in _onPaint
self.draw(drawDC=drawDC)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 61, in draw
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
File "c:\Python27\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 173, in _convert_agg_to_wx_bitmap
agg.buffer_rgba())