[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Surfaces with Transparent Backgrounds

On Fri, Aug 21, 2009 at 7:39 AM, Rolf Sievers <rolf.sievers@xxxxxxxx> wrote:
Hi, I don't know Pygame that well and have never used subsurfaces
but it it looks kinda interesting. Would you do the subsurface
approach in the following way?

def load_strip(filename, width):
 imgs = []
 img = load_image(filename)
 for x in range(img.get_width()/width):
     i = img.subsurface(pygame.Rect(-x*width, 0, width, img.get_height()))

 return imgs

Oh wow, that does work. I had to remove the minus sign in -x*width, but otherwise it works fantastic.

Thanks guys. :)

- pymike