I'm using Buildroot 2018.02 to create a custom Linux to run my raspberry pi 3.

I'm trying to display a pygame window on the external hdmi screen from command line.

So far, I've been able to boot the pi3 with the default configuration running make raspberrypi3_defconfig, I've just changed the toolchain to use glibc instead of uClibc-ng.

Flashing the first default configuration

make raspberrypi3_defconfig
make menuconfig
dd if=output/images/sdcard.img of=/dev/sdb bs=4M

The rpi boot well, I can log as root using a FTDI cable.

Adding pygame ans ssh support

I run make menuconfig to select both open-ssh and python3 packages and I select the external python3 package python-pygame

After reflashing, the rpi boots well and I can connect through ssh.

At this moment nothing is printed on the hdmi screen. If I open a pygame window running a python3 shell nothing happens.

# python3
Python 3.6.3 (default, Jun 17 2018, 20:05:31) 
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> screen = pygame.display.set_mode((300, 200))
>>> pygame.display.flip()
>>> quit()

Adding X.org support

I have then enabled X.org X Window System with the following configuration.


At this moment, when the rpi3 boot, I can see kernel logs on the hdmi screen. If I run startx from command line, several windows appear as follow enter image description here

However if I run again the python instructions above, the screen become totally black.
If I quit the python shell, the screen returns to the picture state.

I have also tried after exporting display with export DISPLAY=:0.0 but with the same result.

If I don't run startx the result is the same except that console log replace the windows on the picture.

What else could I do to be able to display a pygame window from command line ?

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.