1

Im new to python and programing in general, but Im wondering if someone could help me with adding a sprite image to pygame. I have already looked into the exact code to do something like that. I have tried using playerImg=pg.image.load('C:\Users\"my name"\Documents\Python\igrica\koms.png') **koms.png is the name of the file

and... playerImg=pg.image.load('koms.png')

but i only get errors:this is only the ('koms.png') one btw the rest of the code is ok, cuz i tried it without the image

pera robot
  • 11
  • 3
  • Please read [Why not upload images of code on SO when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) and please read [Discourage screenshots of code and/or errors](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Do not post screenshots of the code. Paste the code. – Rabbid76 Mar 14 '21 at 17:29
  • 1
    Try a [raw string literal](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals): `playerImg=pg.image.load(r'C:\Users\"my name"\Documents\Python\igrica\koms.png')` (fcus on `r` before the string) – Rabbid76 Mar 14 '21 at 17:30
  • Hi, Welcome to StackOverflow. kindly try to explain the question on the main part itself. **The question should be written so that it makes sense even if the links break or change.** Read [here](https://stackoverflow.com/help/how-to-ask) to get a clear idea of how to ask a question. – Mohamed Shabeer kp Mar 14 '21 at 18:06

0 Answers0