Mar-13-2022, 01:35 PM
(This post was last modified: Mar-13-2022, 01:35 PM by BashBedlam.)
This works as expected on my system. Will you please post enough code to produce the problem?
import pygame pygame.init () SCREEN = pygame.display.set_mode ((300, 100)) TRANSPARENT = (0, 0, 0) def create_image(file, color=None): """ Create image from a file. If color is specified, replace all FOREGROUND pixels with color pixels. Modify image so TRANSPARENT colored pixels are transparent. """ if color: # Recolor the image image = Image.open(file).convert("RGB") for xy in product(range(image.width), range(image.height)): if image.getpixel(xy) == FOREGROUND: image.putpixel(xy, color) image = pygame.image.fromstring(image.tobytes(), image.size, "RGB") else: image = pygame.image.load(file) image.set_colorkey(TRANSPARENT) return image.convert_alpha() paddle = create_image ('paddle.png') while True : for event in pygame.event.get () : if event.type == pygame.QUIT : pygame.quit () quit () SCREEN.fill ((0, 0, 0)) SCREEN.blit (paddle, (70, 40)) pygame.display.update ()