0

I'm new to pygame, and having difficulties with it.

Pygame is not displaying any images, showing:

    Traceback (most recent call last):
  File "/Users/peterbrown/Documents/First game.py", line 61, in <module>
playerImage = pygame.image.load('player.png')
error: Couldn't open player.png

This is after downloading from a site, but every other strategy (including direct rooting) seems to do nothing. Furthermore, even using the example code (aliens.py) still returns:

    Could not load image "data/player1.gif" Couldn't open  data/player1.gif

Is there something I did wrong? If so, can someone explain it clearly so I don't make this mistake again?

David Mašek
  • 913
  • 8
  • 23
John Doe
  • 126
  • 1
  • 3
  • 15
  • [check this other similar question](http://stackoverflow.com/questions/11389768/pygame-image-load-not-working) and name the file First_game.py and make sure the you have the correctly named files in the correct folder. The player1.gif should be in the data folder. launch the game from the same directory game and images are in. if not create a path to them and remember to escape it with \\ backslashes – john taylor Aug 11 '15 at 15:06
  • 2
    If difficult to tell what you're doing wrong when there's no code in your question. – martineau Aug 11 '15 at 15:27
  • @johntaylor, how do you launch the game using the same directory? i just go into recent files and open the code up. – John Doe Aug 11 '15 at 22:56
  • open a command prompt form the folder with First_game.py in it and run it from there – john taylor Aug 11 '15 at 23:04
  • @johntaylor , thank you for the help, program is now running smoothly. – John Doe Aug 11 '15 at 23:38

0 Answers0