[wxPython-users] using wxImage in C++ python extension

Josiah Carlson jcarlson at uci.edu
Tue Aug 15 11:16:29 PDT 2006


Depending on the implementation of the object that the buffer points to,
that may not matter.

>>> import array
>>> a = array.array('B', 'a')
>>> b = buffer(a)
>>> ia = a.buffer_info()[0]
>>> while ia == a.buffer_info()[0]:
...     a.extend(a)
...
>>> c = buffer(a)
>>> b
<read-only buffer for 0x0077A158, ptr 0x007B1DD8, size 1 at 0x007DAAC0>
>>> c
<read-only buffer for 0x0077A158, ptr 0x008135C0, size 32 at 0x007DAD40>
>>> len(a)
32
>>>




Christopher Barker <Chris.Barker at noaa.gov> wrote:
> Robin Dunn wrote:
> > There is also the wx.Image.SetDataBuffer 
> > method, which will have the wxImage use the buffer passed in without 
> > making a copy, but if the buffer doesn't live as long as the image does 
> > it will likely cause a crash.
> 
> Could the reference count of the Buffer object be Py_INCREF() when 
> SetDataBuffer() is called, then Py_DECREF() when the wx.Image is destroyed?
> 
> -CHB
> 
> 
> 
> -- 
> Christopher Barker, Ph.D.
> Oceanographer
>                                      		
> NOAA/OR&R/HAZMAT         (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
> 
> Chris.Barker at noaa.gov
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org





More information about the wxpython-users mailing list