Answers for "pygame transparent background"

2

pygame draw transparent rectangle

s = pygame.Surface((1000,750))  # the size of your rect
s.set_alpha(128)                # alpha level
s.fill((255,255,255))           # this fills the entire surface
windowSurface.blit(s, (0,0))    # (0,0) are the top-left coordinates
Posted by: Guest on November-04-2020
1

pygame how to make a transparent surface

#Creates an empty per-pixel alpha Surface
#surface_name = pygame.Surface((x, y), pygame.SRCALPHA)
my_surface = pygame.Surface((500, 500), pygame.SRCALPHA)
Posted by: Guest on December-01-2020
1

how to set background color of an image to transparent in pygame

image = pygame.image.load("Your file location")
image.set_colorkey((0, 0, 0))  # If your bg color is black for the image
Posted by: Guest on December-23-2020

Code answers related to "pygame transparent background"

Python Answers by Framework

Browse Popular Code Answers by Language