Images in pygame | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Images in pygame

Hi, I've been trying to make a simple game in python using pygame. I can't get the images for the characters to load. How do you do this?

5th Jun 2020, 1:00 PM
Bailey Beckett
Bailey Beckett - avatar
1 Answer
+ 2
You first need to load the image with the load method: img = pygame.image.load("example.png") Then you use the blit method to insert it to the wanted surface: surface.blit(img, img.get_rect())
5th Jun 2020, 2:12 PM
Seb TheS
Seb TheS - avatar