I'm really struggling to get even basic code to run in Pycharm with Pygame. It's coming up with a load of errors and I've searched and searched and nothing has worked so far. I'm on a mac laptop. Below is the code I'm trying to run:
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, 0, 255), (250, 250), 75)
pygame.display.flip()
pygame.quit()
And here is the error response I am getting:
[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)
I am running the latest Pygame, python and pip.