[Python] Image in pygame is black

Discussão em 'Python' iniciado por Stack, Abril 14, 2025.

  1. Stack

    Stack Membro Participativo

    When I load my image in pygame (see code below), the image appears pitch black, instead of drawing properly!

    Using Python 3.12.8

    import pygame

    pygame.init()

    def imageload(imagepath):
    return pygame.image.load(imagepath)

    screen = pygame.display.set_mode((300, 200), 0, 32)
    pygame.display.set_caption('Python Clicker')
    background_colour = (255,255,255)
    cookieimage = Surface.convert(imageload('images/python.bmp'))
    running = True

    while running:
    screen.fill(background_colour)
    screen.blit(pygame.Surface((64,64), 0, cookieimage), (150, 100), None, 0)
    pygame.display.flip()

    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    running = False
    pygame.quit()



    [​IMG]

    Continue reading...

Compartilhe esta Página