[pygtk] bitmap_create_from_data in C and python
Ed Catmur
ed at catmur.co.uk
Mon Mar 19 06:11:26 WST 2007
On Sun, 2007-03-18 at 18:28 +0530, Suresh Jeevanandam wrote:
> Whats the python equivalent of the following C code?
>
> #define gray50_width 4
> #define gray50_height 4
> static char gray50_bits[] = {
> 0x01, 0x02, 0x04, 0x08 };
> stipple = gdk_bitmap_create_from_data (NULL, gray50_bits,
> gray50_width, gray50_height);
>
>
> I created this stipple pattern this way in python:
> stipple = gtk.gdk.bitmap_create_from_data(None, '0x01, 0x02, 0x04,
> 0x08', 4, 4)
PyGTK doesn't parse the data string for you. You want: '\x01\x02\x04
\x08'.
Ed
More information about the pygtk
mailing list