Displaying fullscreen jpeg on X server (from Raspberry Pi) using Python 3

I am developing software in Python that generates static jpeg files that are written to the file system. The software launches on startup and is triggered by some external and internal events, generates a corresponding jpeg image and should show it full screen on the connected HDMI screen with no visible user control or menu bar.

A window manager (Gnome, KDE, ...) is installed and running. The device is passive and remotely controlled.

I am currently running the feh process to view the image and kill it before the next one is shown. It works, but not very pleasant.

Do you have any idea how I can get a Python 3 program to display jpeg on an X server?

+3


source to share


2 answers


Use feh with one of the options --bg-

. This sets the background of the X root window and then exits. This way you don't have to deal with killing feh to restart it, just call the command every time you want to change the image.

feh --bg-scale image1.jpeg

      



This does not work with some desktop environments (kde, gnome, xfce, etc.), but will work with lightweight window managers (evilwm, goomwwm, etc.), as well as work without a window manager.

+1


source


Do you really need an X server? If you are not using any kind of GUI or mouse, you can better write images to framebuffers without X-Server. You can just use fbi for this.



+1


source







All Articles