[PyKDE] C++ to Python Datatypes

Phil Thompson phil at riverbankcomputing.co.uk
Mon Oct 13 10:08:00 BST 2003


On Monday 13 October 2003 1:41 am, Russell Valentine wrote:
> I'm having trouble sometimes figuring out what Python datatype goes with
> the C++ datatype.
>
> An example a 2x2 grayscale QImage:
>
> **C++ Define
>
> QImage ( uchar * yourdata, int w, int h, int depth, QRgb * colortable, int
> numColors, Endian bitOrder )
>
>
> How do you know what type to use for uchar *yourdata?

Unless the documentation says otherwise, uchar * corresponds to a Python 
string. So your buffer initialisation should be something like...

buffer = "\xff\x00\xff\x00"

Phil




More information about the PyQt mailing list