I'm trying to write a sample Python application using Pygame:
import pygame, sys
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello world!')
while True: # main game loop
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
However, PyDev complains that init() is an undefined variable even though it recognizes the Pygame library. I'm using Python 2.7.6 as the interpretor.
Here's the stack trace:
Traceback (most recent call last):
File "/Users/dannychia/Documents/workspace/PygameSample/PygameSample.py", line 6, in <module>
import pygame, sys
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
Anyone have a solution?