Open Gadgetoid opened 3 years ago
Thank you for this info - updating pygame fixed the issue on the Pi Zero. 👍
this helped me today I got the error about pygame.error: No video mode large enough for 640x480
however adding the config to boot did not help
I upgrade pygame without sudo in that worked pip3 install pygame --upgrade
In some instances the examples may look like this:
This is due to somewhat old pygame/SDL versions being shipped with Raspberry Pi OS.
Raspberry Pi 3 etc
On Pi 3B+, Pi Zero and other pre-Pi4 boards you can update pygame from pip to fix glitchiness:
Raspberry Pi 4
On Pi 4, you should upgrade pygame as above but it will probably result in this error when you try and run an example:
I believe this, followed by the unhelpful hard
exit(1)
is caused by this code: https://github.com/raspberrypi/userland/blob/97bc8180ad682b004ea224d1db7b8e108eda4397/interface/khronos/common/linux/khrn_client_rpc_linux.c#L214-L216In any case the only way to work around this seems to be by compiling SDL from source... :grimacing: ... and using your shiny new SDL to replace the system one used by pygame.
You can do that with the following steps:
This will install SDL into an "install" directory within the "SDL2-2.0.14" directory, so don't delete it. (You can change the
--prefix
when configuring to something like/opt/SDL2-2.0.14
if you're so inclined, it doesn't really matter where you put it.)Once built the new SDL libraries will be available in
install/lib
, find the full path by typing:In my case the path is
/home/pi/SDL2-2.0.14/install/lib
.Now when running an example from this repository, you should prefix the command line with
LD_LIBRARY_PATH=/home/pi/SDL2-2.0.14/install/lib
, for example:If everything is set up correctly on your Pi 4 you should see "Using driver: kmsdrm"