Pygame on full screen & auto start


I’d like to have my pygame autostart at boot.
The pygame/python deps are all ok (already succeed to start it through xfce term).
But I’d like to avoid start xfce and work directly with X11.

So I seek for Autostart Options in config menu and and setup to 17 (custom script in foreground & autologin)

Added the following line :

xinit which python3 ‘/home/dietpi/Devel/battleship/’

And I’d like to run into dietpi user.

Seems that /var/lib/dietpi/dietpi-autostart/ was not executable (this is a bug?) so I chmoded +x it

I see that X11 should work in unprivileged user but can’t get it working.
I added tty group to dietpi user, and added g+rw to /dev/tty0

The error that I have is :

cannot open virtual console 2

Of course I can start it a root, but I’d like to avoid this solution if possible.

Thanks a lot

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_LIVE_PATCH_STATUS[0]=‘not applicable’

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bullseye 0

  • Kernel version | uname -a
    Linux DietPi 5.15.84-v7+ #1613 SMP Thu Jan 5 11:59:48 GMT 2023 armv7l GNU/Linux

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    RPi 2 Model B (armv7l)

  • Power supply used | (EG: 5V 1A RAVpower)
    enough :wink:

  • SD card used | (EG: SanDisk ultra)
    enough :wink:

it might need special commands to start in full screen mode
pygame.display — pygame v2.1.4 documentation


Yes indeed, the fullscreen flag is already set into code. All code is already working as expected in “conventional” raspbian.

I’d like to transpose it into dietpi.

I solved the previous error I had (cannot open virtual console 2) with the installation of xserver-xorg-legacy but I have another errors: touch screen not working in this mode and the display resolution is a bit weird.

I fall back into “classic” auto login xfce (desktop) to have that. And created a Desktop file ~/.config/autostart/app.desktop

Into that I have touchscreen & sound working, only thing in error is the flickering into pygame.

I check a bit the thing of double buffering but can’t have something working for the moment.

If you have any idea, It’s very welcome !