As Dan pointed out, entering the absolute path of the image could definitely work.
Alternatively, you can navigate up the folder hierarchy from the local directory (the directory in which your code file is stored). Let's say that your filesystem appears as follows:
- You have a directory,
Stuff
, that contains two folders, Python
and Image
.
- The
Python
folder contains your code, test_python.py
.
- The
Image
folder contains your image, pixel16.png
.
Then, the command would look something like this:
image1 = pygame.image.load("../Image/pixel16.png")
Because the ..
takes you up the file tree from the Python
folder to the Stuff
folder (because when in a given directory, the ..
command takes you to the parent directory), and from there the rest of the path navigates you to the image that you're hoping to access.
Hope this helps!