python pygame library is not working properly

– Please Write here your help request, –
First of all, I am Japanese. Sorry for my bad English. I installed python and pygame on parrot os. I installed python and pygame on parrot os, but pygame doesn’t work properly and the sample program of pygame doesn’t work either. The pygame sample program doesn’t work either. How can I get it to work?

  • Parrot version in useparrot os 5.0

Hi, you should provide us some screenshots or errors you encounter when trying to use pygame.

Sample programs also work on other Linux systems.
And the program I am trying to run also works.
I think I’m making a lot of mistakes in the way I do things, but I can’t figure out
why. I have looked up and run various sites but have not been able to solve the problem.

Many Linux package maintainers (Debian, Ubuntu) have removed the examples from pygame, like pygame.examples.aliens.

And it appears pygame needs additional dependences to use some of it’s functionality. Make sure to install the following packages:

sudo apt-get install git python3-dev python3-numpy libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev

You can grab the examples from the pygame github:

git clone https://github.com/pygame/pygame.git
cd pygame/examples
python3 -m aliens

1 Like

Thank you for taking the time to let me know.

Did I do something wrong?

The python program now works. Thank you from the bottom of my heart.

The sample program doesn’t work though.

You are welcome! Glad some of it is working for you. I already had many of the sdl2 packages installed before installing, so you may need to install them as well.

2022-04-21_12-00

i see So if I install these, does that mean I can run various programs?

You should be. I ran the following before installing the various SDL12-dev packages

python3 -m setup

And kept installing SDL2 packages until I finally got to this output:

Hunting dependencies…
SDL : found 2.0.20
FONT : found
IMAGE : found
MIXER : found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: not found
PORTTIME: found
FREETYPE: found

Then I installed the additional SDL1.2 packages. Probably I could have stuck with all the SDL2 packages and only needed libportmidi-dev.