I am trying to draw simple semi-transparent rectangle in pygame. I have tried this code:
import pygame, sys,pygame.mixer
pygame.init()
size = (width, height) = (400, 400)
screen = pygame.display.set_mode(size)
screen.fill((255,255,255))
pygame.draw.rect(screen, (23, 100, 255, 50), (100,100,100,100),0)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
running = False
But as you can see, the rectangle is not semi-transparent. It's like I inserted the color 23, 100, 255, 255) rather than (23, 100, 255, 50).