Ask coding questions

← Back to all posts
loading a pygame image
Yoesh (0)

how do you load an image in pygame? here is my code:
background_colour = (255,255,255)
(width, height) = (600,600)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('load')
screen.fill(background_colour)
pygame.display.flip()
peasant= pygame.image.load("my.png").convert()
px = 100
py = 100
running = True
while running:
screen.blit(peasant, (10, 10))
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.update()
pygame.quit()
please help as soon as possible!

Voters
Yoesh (0)
Comments
hotnewtop
Yoesh (0)

it won't display the pygame image @Wumi4

Wumi4 (486)

What's the problem you got with the code? I don't see anything wrong.

Yoesh (0)

this is in pygame by the way!

Yoesh (0)

this is in python by the way