Hello there,
I am a Python / Pygame newbie...
Installed Pygame by installing the following files located at:
http://pythonmac.org/packages/py25-fat/index.html
Am running Python 2.5 on OS X Leopard...
Copied the following code from Pygame online tutorial:
#!/usr/local/bin/python
import pygame
from pygame.locals import *
def main():
# Initialize screen
pygame.init()
screen = pygame.display.set_mode((400,100))
pygame.display.set_caption('Basic Pygame program')
# Fill background
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((250, 250, 250))
# Display some text
font = pygame.font.Font(None, 36)
text = font.render("Hello Unnsse!", 1, (10, 10, 10))
textpos = text.get_rect()
textpos.centerx = background.get_rect().centerx
# Blit everything to the screen
screen.blit(background, (0, 0))
pygame.display.flip()
# Event loop
while 1:
for event in pygame.event.get():
if event.type == QUIT:
return
screen.blit(background, (0, 0))
pygame.display.flip()
if __name__ == '__main__': main()
When I ran this program, I receive the following error message:
Traceback (most recent call last):
File "/Users/untz/DevResources/Python/pygame_helloworld/hello.py",
line 3, in <module>
import pygame
ImportError: No module named pygame
What am I possibly doing wrong?
Happy programming,
Unnsse