The problem for me was on Python 2.7.2, so is there maybe an problem
that wx doesn't recognize the Python buffer object?
-------- Original Message --------
On 04/26/2013 02:57 AM, Werner F. Bruhin wrote:
> Hi,
>
> Anyone can provide some info on what "agg.buffer_rgba" returns and maybe
> even some suggestion on how to resolve this issue in the wxagg backend.
It returns a Python buffer object on Python 2, though on Python 3 it is
a memoryview, since buffer was deprecated. Perhaps wx is also doing
something different depending on the version of Python.
>
> Thanks
> Werner
>
> P.S.
> The archive on Sourceforge for this list stops in June 2012, noticed
> this as I wanted to check if there are answers I didn't get for some reason.
> http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users
Yeah -- I've reported that to sourceforge many times. Not sure what the
issue is. Personally, I use gmane when I need to search the archive and
it works rather well.
Mike
>
> On 20/04/2013 08:58, Werner F. Bruhin wrote:
>> 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())
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotl...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> Matplotlib-users mailing list
> Matplotl...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Matplotlib-users mailing list
Matplotl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users