bif="bg.jpg"
mif="ball.png"

import pygame, sys
from pygame import *

pygame.init()

screen=pygame.display.set_mode((420,300),0,32)

background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert_alpha()

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    screen.blit(background, (0,0))

Traceback (most recent call last):
File "C:/Documents and Settings//Desktop/Programming/PYGAME TEST/pygame.py", line 4, in <module>
import pygame, sys
File "C:/Documents and Settings//Desktop/Programming/PYGAME TEST\pygame.py", line 5, in <module>
from pygame.locals import *
ImportError: No module named locals

I've install Pygame; and everything else.

Edited 6 Years Ago by DocBreen: n/a

What version of Python are you running? I can't think of any reason it would do that. It works fine for me.

What version of Python are you running? I can't think of any reason it would do that. It works fine for me.

I'm using Python2.6

This has been a great problem (downloading pygame and making it work with mac).

Now, fortunately for you, I was searching for the exact same thing all day today... (10 hours of nonstop searching...)

I'm not going to explain it because this website here, has it all documented well:
http://programming.itcarlow.ie/pygame.html

Go to it, download the pdf there, and IT WILL WORK. I guarantee you, if you follow all the instructions properly.

And be patient, it takes a while to download all the files necessary for the task.

*NOTE: After you do all this, there will be a folder called, "pygame-1.9.1release"
You MUST put all your pygame scripts into this folder, otherwise, it will give you the same error that you had before. Use terminal to execute your scripts.

Hope this helped. :)

This has been a great problem (downloading pygame and making it work with mac).

Now, fortunately for you, I was searching for the exact same thing all day today... (10 hours of nonstop searching...)

I'm not going to explain it because this website here, has it all documented well:
http://programming.itcarlow.ie/pygame.html

Go to it, download the pdf there, and IT WILL WORK. I guarantee you, if you follow all the instructions properly.

And be patient, it takes a while to download all the files necessary for the task.

*NOTE: After you do all this, there will be a folder called, "pygame-1.9.1release"
You MUST put all your pygame scripts into this folder, otherwise, it will give you the same error that you had before. Use terminal to execute your scripts.

Hope this helped. :)

Is that for Macintosh only?

This article has been dead for over six months. Start a new discussion instead.