问题描述
我真的很难用 Pygame 获得在 Pycharm 中运行的基本代码。它出现了大量错误,我已经搜索并搜索过,但到目前为止没有任何效果。我在 Mac 笔记本电脑上。下面是我试图运行的代码:
import pygame
pygame.init()
screen = pygame.display.set_mode([500,500])
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill((255,255,255))
pygame.draw.circle(screen,(0,255),(250,250),75)
pygame.display.flip()
pygame.quit()
这是我得到的错误响应:
[cametallayer setdisplaySyncEnabled:]: unrecognized selector sent to instance 0x7fa6d971e5f0
*** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-[cametallayer setdisplaySyncEnabled:]: unrecognized selector sent to instance 0x7fa6d971e5f0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fffba6717eb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffcf4b248d objc_exception_throw + 48
2 CoreFoundation 0x00007fffba6f3464 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fffba5e2e65 ___forwarding___ + 1061
4 CoreFoundation 0x00007fffba5e29b8 _CF_forwarding_prep_0 + 120
5 libSDL2-2.0.dylib 0x0000000102c93ad1 MetaL_CreateRenderer + 2353
6 libSDL2-2.0.dylib 0x0000000102bd306d SDL_CreateRenderer_REAL + 189
7 libSDL2-2.0.dylib 0x0000000102c4efd9 SDL_CreateWindowTexture + 457
8 libSDL2-2.0.dylib 0x0000000102c5369a SDL_GetwindowSurface_REAL + 170
9 display.cpython-39-darwin.so 0x0000000102ef2723 pg_set_mode + 2147
10 Python 0x0000000102589f3b cfunction_call + 59
11 Python 0x000000010254b26d _PyObject_MakeTpCall + 365
12 Python 0x000000010262199c call_function + 876
13 Python 0x000000010261ee33 _PyEval_EvalFrameDefault + 25219
14 Python 0x0000000102622603 _PyEval_EvalCode + 2611
15 Python 0x0000000102618a8b PyEval_EvalCode + 139
16 Python 0x000000010266b382 PyRun_FileExFlags + 434
17 Python 0x000000010266a95f PyRun_SimpleFileExFlags + 831
18 Python 0x0000000102687829 Py_RunMain + 1801
19 Python 0x0000000102687cbf pymain_main + 223
20 Python 0x0000000102687ebb Py_BytesMain + 43
21 libdyld.dylib 0x00007fffcfdec235 start + 1
22 ??? 0x0000000000000002 0x0 + 2
libc++abi.dylib: terminating with uncaught exception of type NSException
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
我正在运行最新的 Pygame、python 和 pip。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)