[Python] How to run from boot (raspberry Pi4B+) a Tkinter Python Program - error no display...

Discussão em 'Python' iniciado por Stack, Março 8, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python program that use the Tkinter Library. It is running from Thonny and from Terminal. I want to launch it when my Raspberry boot. To do this I created a Launcher.sh that is called when the pi boot via crontab.

    Everything works but each time it boots I have the error "_tkinter.TclError: no display name and no $DISPLAY environment variable".

    I Checked for solution but everyone is talking about "Matplotlib" that I don't use

    Here is my Launcher.sh :

    sudo pigpiod
    cd /home/pi4004/Desktop/Arm_survey
    python Arm_survey.py


    If I run those commands line by line on terminal it works.

    If I run in terminal:

    sudo pigpiod
    python home/pi4004/Desktop/Arm_survey/Arm_survey.py


    I have another error for finding an image that exist...

    I tried to modify the autostart in /etc/xdg/lxsession/LXDE Also tried the DISPLAY=:0.0

    Nothing works...

    Did someone manage to do this ?

    Thanks guys

    Continue reading...

Compartilhe esta Página