[PyKDE] QGLWidget rendering problems

David Boddie david at boddie.org.uk
Fri Dec 19 04:21:01 GMT 2003


On Thursday 18 December 2003 23:30, Phil Thompson wrote:

> The problem is '\0' termination. SIP assumes uchar * and char * refer to C
> strings unless the length is also passed as a parameter at the C/C++ level
> - in which case you have to use the /Array/ and /ArraySize/ tags.
>
> To convert in the other direction the "natural" thing to do is implement
> str() of a sip.voidptr, but that would assume a '\0' terminated string. So
> I will have to invent toString() which will allow the explicit length to be
> specified.

In the meantime, as a workaround, I've created a small extension module which
will extract the image data from a QImage to a Python string:

http://www.boddie.org.uk/david/Projects/Python/Qt/Software/qimage-0.01.tar.gz

The example script included (main.py) will load an image using a QImage
object and save it using the Python Imaging Library. The example won't work
if you don't have the PIL, but it's not used by the actual module.

I hope it's useful to Tom, anyway!

David




More information about the PyQt mailing list