[OLPC-Games] Buddy icons in pygame

Joshua Minor j at lux.vu
Tue Dec 11 11:30:38 EST 2007


On Dec 11, 2007, at 5:47 AM, Luke Paireepinart wrote:

> Joshua Minor wrote:
>> Is there an easy way to turn a buddy icon into a pygame surface?  It
>> looks like I might be able to write it out to disk and then read it
>> back in, but that seems wasteful.
> If you can get it into a string in memory, you can use frombuffer  
> pygame
> method to convert it to a surface.

Thanks.  It also seems that I could also use pygame.image.load to read  
from a file-like object that is just a string in memory.

After digging further it seems that the main problem is that  
buddy.props.icon is just 4-bytes long.  buddy.get_icon_pixbuf() throws  
an error.  I could have sworn that buddy.props.icon was giving me more  
data in an earlier build (I'm using 649 now).  I can't find any  
examples of anyone using either of these, so I'm guessing that this is  
just not implemented yet.

Maybe I can poke the buddy's color into an svg and then render that  
into an image.

-josh



More information about the Games mailing list