I’m new to this and I am really not sure why my images won’t show.
I tried so many times and yet nothing seems to work.
Please help, I’m trying to add all my images, but starting with the image “download 3.jpg.”
That’s all I need, I just want my images to show up, nothing else.
Link to my project.
main.py - badCOPY - Replit
Hi @Pcx061 welcome to the community!
From a quick look at your code the images aren’t showing because you aren’t
blit ing the images loaded into memory to the screen.
You commented out line 60 which does this. When I uncommented it the following error was shown:
I recommend taking a look at the code here Python | Display images with PyGame - GeeksforGeeks to see if this helps.
I used the link that you sent and copied the coding, but when I add my images it says "“SyntaxError: (unicode error: ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape.”
I’m so confused, thanks for the help though!
No problem @Pcx061 the error is because it is looking for a file on the C:\ (which isn’t possible in a Repl). Just change the filename in line 43 to something that exists in the files section of your Repl.
Just to expand on what Ian said, the way a Repl works is it essentially runs on a computer that Replit owns, not your computer, so it cannot see the files on your computer, only the files in your Repl’s hierarchy.
I have been working on this problem four 3-4 days straight, and I FINALLY got it!!!
I added the correct file name on line 43, but I needed to do one last thing, which was to change this \ to that /
(Mygame PHOTIOS free\checkmark.png ----> Mygame PHOTIOS free/checkmark.png.
THANK YOU SOOO MUCH!!!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.