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

Re: [pygame] Surfaces with Transparent Backgrounds



Aha.

There might be something weird about the image as well, because when I used another one with a transparent background it worked as well - without modifications to the code. Despite that, I couldn't find anything strange in the png.

On Fri, Aug 21, 2009 at 00:23, pymike <pymike93@xxxxxxxxx> wrote:
Aha! Figured it out!


def load_strip(filename, width):
    imgs = []
    img = load_image(filename)
    for x in range(img.get_width()/width):
        i = pygame.Surface((width, img.get_height())).convert_alpha()
        i = i.convert_alpha()
        i.fill((255,255,255,0))

        i.blit(img, (-x*width, 0))
        imgs.append(i)
    return imgs

Everything's working awesome now.

--
- pymike