6
votes

Running:
macOS Catalina 10.15.1
Python 3.8.0
Pygame 1.9.6
IDE - Visual Studio Code 1.40.2

When I launch the Pygame test:

python3 -m pygame.examples.aliens

The music begins playing and after about 5 seconds the app closes. No window appears. The icon in dock shows up until it's closed.

The same thing happens with a basic test code such as

import pygame

pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False

while not done:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        done = True

pygame.display.flip()

There are no error messages in the terminal.

Anybody have this issue? I've tried reinstalling both Python 3.8.0 from the website (as recommended in a different thread) as well as Pygame.

2
Maybe install Python 3.7. Python 3.8 is very new version and many modules are not ready or not tested for this version. - furas
@furas Thank you, that was the solution. Pygame 1.9.8 works on Python 3.7.5. - dburenok

2 Answers

0
votes

This solution was given by furas in this comment:

Maybe install Python 3.7. Python 3.8 is very new version and many modules are not ready or not tested for this version.

This works on Python 3.7.8.

0
votes

After several trials I have found out that the problem can be solved with one of two ways, You may try each solution one by one as one have worked with some friends and other have worked with others.

My system info: macOS Catalina 10.15.6 Python 3.8.5

All solutions depends on trying latest Pygame developer versions (knowing many would say its not final release and it might be not stable but i believe this is much better than downgrading your macOS version).

Solution A: At Terminal, try installing Pygame dev 4

pip3 install pygame==2.0.0.dev4

This solution allow me to work with most codes but when I try some samples online it give me this error "Sorry, extended image module required"

Solution B: At Terminal, try installing Pygame dev 4

pip3 install pygame==2.0.0.dev6 

This time it works perfectly form we for all online and offline codes

To Test result try this sample

python3 -m pygame.examples.aliens

Here is a screenshot for the previous sample after fixing the issue:

enter image description here