i followed official pygame tutorials, and stuck on the first one, the "introduction":$. there's a line 10 that goes :

ball = pygame.image.load("ball.bmp")

and, since i don't have a "ball.bmp" in my computer, i decided to draw it in paint. now, when i write that line in the python interpreter, it returns me an error. what is the problem? i tried giving path, but there was error again. what to do?

Recommended Answers

All 8 Replies

Post the exact error you are getting, that helps a lot :)

If you use Linux, be aware that filenames are case sensitive.

If you use Linux, be aware that filenames are case sensitive.

Do you have the ball.bmp image in the same folder that your code is in? It took me a while to figure that out but now im making games all the time with jpgs, bmps, gifs, etc. Like i have a pic of a space ship and a gimp(its freeware version of photoshop) picture from the game Qbert and i made a little spacehip game alright. However, I use windows so i dont have to list the file path in python/pygame.

i followed official pygame tutorials, and stuck on the first one, the "introduction":$. there's a line 10 that goes :

ball = pygame.image.load("ball.bmp")

and, since i don't have a "ball.bmp" in my computer, i decided to draw it in paint. now, when i write that line in the python interpreter, it returns me an error. what is the problem? i tried giving path, but there was error again. what to do?

If you go to the offical ball.bmp tutorial in this link:

http://www.pygame.org/docs/tut/intro/intro.html

than you can download the picture ball.bmp on your same folder that your storing your source code for your pygame tut code. remember: the code and images must be in the SAME folder or the screen you make in pygame will be blank.

ok, i just copied code into python interpreter. i have some kind of problem with modules, when i save it in notepad, as "something.py" (with the quotes, so notepad wouldn't add .txt extension) and write "import something", it would return an error saying "no module named something".

.

Do you have the ball.bmp image in the same folder that your code is in? It took me a while to figure that out but now im making games all the time with jpgs, bmps, gifs, etc. Like i have a pic of a space ship and a gimp(its freeware version of photoshop) picture from the game Qbert and i made a little spacehip game alright. However, I use windows so i dont have to list the file path in python/pygame.

Who said i use linux? I'm on windows

Who said i use linux? I'm on windows

For your module problem, thats the thing. There is no module named something. Idk if you can create a module. I dont even know if you have to import the image-i just save it to a folder and put the test code in there an la la! I followed that ball.bmp tutorial and what i did came out fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.