yeah, that worked for me, here's my (messy) example code:

import pygame
from pygame.locals import *
import os

pygame.init()

screen = pygame.display.set_mode((100,100))
screen.fill([0, 0, 0]) # blank the screen.

#random image
fartherback = pygame.image.load(os.path.join("Images",
"Blocks.png")).convert_alpha()

#equivalent to the background in your example
notasfar = pygame.Surface((100,100)).convert_alpha()
notasfar.fill((0,0,0,50))

#another random image
image = pygame.image.load(os.path.join("Images",
"girl-walking-down.png")).convert_alpha()

while True:
    screen.blit(fartherback.subsurface((0,0),(100,100)), (0, 0, 100, 100))
    screen.blit(notasfar, (0,0,100,100))
    screen.blit(image, (0,0,64,64))

    pygame.display.update()
    pygame.time.wait(200)





On Thu, Apr 22, 2010 at 2:12 PM, Lee Buckingham <lee.bucking...@gmail.com>wrote:

> Instead of using set_alpha(), try using a fill, like:
>
>  backgroundsurface.fill((0,0,0,100))
>
> that should make the background use per-pixel alpha too, since there's a
> fourth number in the color (for alpha) so blitting another per-pixel alpha
> image shouldn't cause problems.   Hmm... maybe I'll try it out too.
>
> -Lee-
>
>
>
>
> On Thu, Apr 22, 2010 at 12:46 PM, stas zytkiewicz <
> stas.zytkiew...@gmail.com> wrote:
>
>> On Thu, Apr 22, 2010 at 6:56 PM, Lee Buckingham
>> <lee.bucking...@gmail.com> wrote:
>>
>> > As far as the alpha goes, my guess is that you're getting hung up
>> because
>> > you've mixed two different alpha modes.  There's some caveats about
>> using
>> > per-pixel alpha (like the .png file probably has) and the other modes
>> (color
>> > key or single value alpha like you've got).
>> That's my guess to and as I'm no alpha stuff expert I turned to this list.
>>
>> > So i'd first try just eliminating the transparency on the background, if
>> in
>> > fact there's nothing behind it anyway.
>> I want to create a semi transparent GUI button with a solid image or text
>> so transparency of the background is the whole purpose :-)
>>
>> Stas
>>
>> --
>> Free-source educational programs for schools
>> http://www.schoolsplay.org  and http://wiki.laptop.org/go/Schoolsplay
>> http://gvr.sf.net and http://wiki.laptop.org/go/Guido_van_Robot
>>
>
>

Reply via email to