how to make the background of a pygame surface transparent code example

Example 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)

Example 2: pygame fill transparent

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