我尝试使用Python 3.4.3对pygame 1.9.2进行尝试,它给了我一个我根本不理解的错误。代码是一个基本的hello世界:
import sys
import pygame
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello World!')
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
这是我得到的错误:
2015-03-16 22:41:23.073 Python[71068:8424090] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 281'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8c69364c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff93ede6de objc_exception_throw + 43
2 CoreFoundation 0x00007fff8c6934fd +[NSException raise:format:] + 205
3 AppKit 0x00007fff8a1769dd _NSCreateWindowWithOpaqueShape2 + 1417
4 AppKit 0x00007fff8a174d3c -[NSWindow _commonAwake] + 1808
5 AppKit 0x00007fff8a082ee0 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 864
6 AppKit 0x00007fff8a08254c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1477
7 AppKit 0x00007fff8a081f7a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
8 libSDL-1.2.0.dylib 0x00000001020af0f4 -[SDL_QuartzWindow initWithContentRect:styleMask:backing:defer:] + 279
9 libSDL-1.2.0.dylib 0x00000001020aca6a QZ_SetVideoMode + 1172
10 libSDL-1.2.0.dylib 0x00000001020a3dfa SDL_SetVideoMode + 907
11 display.so 0x0000000102108667 set_mode + 263
12 Python 0x00000001000e4745 PyEval_EvalFrameEx + 29589
13 Python 0x00000001000e604d PyEval_EvalCodeEx + 2349
14 Python 0x00000001000e610f PyEval_EvalCode + 63
15 Python 0x000000010011064e PyRun_FileExFlags + 206
16 Python 0x00000001001109fd PyRun_SimpleFileExFlags + 717
17 Python 0x00000001001281be Py_Main + 3262
18 Python 0x0000000100000e32 Python + 3634
19 Python 0x0000000100000c84 Python + 3204
)
libc++abi.dylib: terminating with uncaught exception of type NSException