-1

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?

5
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by python user
0

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.

0

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.

0

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".

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.