No subject
Thu Mar 8 10:26:06 GMT 2007
uchar *bits();
The return value is a sip.voidptr object which is only useful if passed to
another Python module.
I'm using the following (swig-ed) to get the bits of the QImage as a
python raw string so I can manipulate it later using PIL or using it as a
texture in PyOpenGL. Where data_ptr, n = qimage.bits(), qimage.numBytes()
PyObject *pointer_to_pystring(long data_ptr, int n)
{
return PyString_FromStringAndSize(data_ptr, n);
}
This works for me(TM) but I wonder if this should be added/included in
PyQt by default. Probably under a different name to avoid surprises,
something like "bits_pystr()" or so.
Of course, you may say, if we do this for bits() we should do it for all
the other funcs returning sip.voidptr ...
Any commments/flames on this?
Best regards.
--roberto
More information about the PyQt
mailing list