I have a Python program using Kivy to generate the GUI running in a window on a Raspberry Pi running the normal Raspberry Pi OS DeskTop & X Server.

I want to convert this Python / Kivy program to run in a secure kiosk mode.

But after stopping the Raspberry Pi's X Server and Desk Top from starting, I have not discovered the proper way to alter the Pyton / Kivy program to write directly to the FrameBuffer. The goal is make what was once displayed in the application's window to be sent to the FrameBuffer to be displayed directly on the LCD screen.

I am using a Raspberry Pi 4 and the standard (official) Raspberry Pi 7 inch touch screen which has a FrameBuffer that shows up as /dev/fb0.

  • Last time I tried Kivy it used hardware accelerated libraries on PiOS Lite. No desktop in sight. If you use a Pi4 see kivy.org/doc/stable/installation/… about compiling SDL2
    – Dirk
    Commented Mar 2, 2021 at 2:11
  • I will edit the question @jsotola so the final goal is clearer. Thanks.
    – st2000
    Commented Mar 2, 2021 at 2:26
  • @Dirk, thank you very much for pointing out the SDL was only packaged for X11 and needed to be recompiled. But I'm still having difficulties. I feel all I need is one stand alone Python/Kivy code example to set me straight. Do you happen to know where I could find a short working Python/Kivy example which writes to the FrameBuffer (works w/o X11)?
    – st2000
    Commented Mar 3, 2021 at 13:46
  • Hi @Dirk, if you copy your comment into an answer I will mark it as the solution to this question and we can close it. I will then ask a new more specific question regarding how to write a Python / Kivy program to use the FrameBuffer instead of the X11 server.
    – st2000
    Commented Mar 4, 2021 at 13:55

1 Answer 1


Kivy can use hardware accelerated libraries on PiOS Lite. Desktop / X is not necessary.

However, for the Pi4 you need to compile the SDL2 libraries from source. The version in the repos was not compiled with the kmsdrm backend, so it only works under X11. See Kivy documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.