[Tutor] Need help on modifying buffer passed to python script from c

R. Alan Monroe R. Alan Monroe" <amonroe@columbus.rr.com
Sat Jun 7 15:32:02 2003


>> problem I'm running into is that python thinks the buffer is a big
>> string, but I want it to be treated as integers (it's an offscreen
>> ARGB buffer to be blitted to the screen). Is there a way of
> "tricking"
>> Python into seeing it as something other than 'str'?

> Use the struct module to convert it within Python.

>From one Alan to another... you da man!

thepointer[0] = struct.pack('B',99)  # B is unsigned char

works perfectly.

Alan