1
import pygame, sys
from pygame.locals import *

pygame.init()
window = pygame.display.set_mode((400, 300))

my_image = pygame.image.load(r'/Users/Humberto/documents/python/games/alien')
posX, posY = 200, 150

window.blit(my_image, (posX, PosY))


while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()


    pygame.display.update()

I am trying to load an image that is in the same folder and it will return an error saying pygame.error: Couldn't open /Users/Humberto/documents/python/games/alien I have tried writing the .png extension, also writing the whole path using / and // and also tried the raw string. How can I fix the problem?

martineau
  • 119,623
  • 25
  • 170
  • 301
Humberto
  • 39
  • 1
  • 7

0 Answers0