I’m trying to have a Python program that uses Tkinter autostart when the BBB boots. This can normally be done by adding a file to the /home/debian/.config/autostart folder but this does not always work. My environment is a BBB, with a 4D Systems Gen4 LCD display and I’m running Debian v9.5 (Stretch)
The program I have is a Python program that uses Tkinter and also uses the PRU. If this program is started from a terminal on the desktop everything works fine. Since the Python program uses the LCD display I’ve added ‘xhost +’ to the system .bashrc file so that the Python program can be started ffrom any terminal (SSH for example) and display the Tkinter generated results on the LCD.
The problem comes when I try to use the autostart function. I have tried all of the following. In each case the Python program fails when trying to load the PRU with it’s associated BIN code.
Case 1: autostart file includes the command ‘Exec=python myProgram.py’
Case 2: autostart file includes the command ‘Exec=qterminal -e myBash.sh’, where myBash.sh is a Bash script file contains the command ‘python myProgram.py’
Case 3: autostart file includes the command ‘Exec=myBash2.sh’, where myBash2.sh is a Bash script file contains the command 'qterminal -e myBash.sh. This opens a terminal and executes myBash.sh which contains the command ‘python myProgram.py’
But if have an autostart command that only opens a terminal (i.e Contains ‘Exec=qterminal’ then on boot a terminal is opened and if I type run either myBash.sh or myBash2.sh the Python program works correctly.
I’ve also tried adding delay in the two bash files to give the system time to settle without success.
Is there some delay that has to happen on boot for the display to allow the PRU to work?