If the PyArg_ParseTuple function is modified so that the "s#" code accepts
buffer objects, then pygtk will get buffer support for free.
As for numpy arrays, they also store the dimensions, which can be useful
for image data. I sometimes think it would be nice if the numpy array
object was distributed with python, as it is very useful for passing large
chunks of data around, especially when you want to pass dimension
information along with it. It also allows you to modify the data from
python.
I don't know if I want to add python-1.5.2 specific features to pygtk just
yet, as it seems like a lot of linux distributions are still shipping
python-1.5.1 (red hat, caldera, turbolinux, etc). The buffer interface
looks like a good idea all the same.
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Thu, 5 Aug 1999, Fred L. Drake, Jr. wrote:
>
> James Henstridge writes:
> > How does this buffer interface relate to numeric python arrays? Numpy
> > arrays sound like a useful way of passing buffers round. You can get the
> > array to use the data from another your t1python's internal structures.
>
> I've never used NumPy, and would hate to introduce a new
> dependency. Buffer objects and the buffer C interface have the
> advantage of being part of the Python core.
>
> > As for keeping things consistent, it looks like you can get the numpy
> > array to keep a reference to the t1python structure, so that the array
> > data is not freed while the array is still in use, by setting the
>
> Cool; fortunately, you can do this with buffer objects as well.
>
> > I am going to write wrappers for some of the gdkrgb functions for pygtk,
> > and will include numpy versions that can render from a numpy array (if
> > numpy is available). This would remove most the array copying from the
>
> Based on Mark Hammond's message, it sounds like we should all the
> using the buffer type/interface. Does NumPy implement it?
>
> > Of course, I may have misunderstood what you want this buffer interface to
> > do. If so, could you point out what features you are after that aren't
> > provided by numpy?
>
> Sounds like you got it right!
>
>
> -Fred
>
> --
> Fred L. Drake, Jr. <[EMAIL PROTECTED]>
> Corporation for National Research Initiatives
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]