I want to achieve following:
run my GUI (made in Tkinter interface) application automatically as I boot the RPi (i.e. no desktop screen loading). But I want to be able kill the application so I can access the desktop though.
I have tried several methods which I found previously asked here, here and also here. I also played with adding my executable file in /home/pi/.config./autostart
folder - no effect unfortunately.
I'm getting little desperate as this at first seemed as an easy task with lots of support online. However, after watching several tutorial, I have been stuck on this for days and cannot get it running properly.
What do I need to have it set in Boot Options (sudo raspi-config
)?
Here is the code of the GUI app:
from Tkinter import *
root = Tk()
root.title('Scanner')
# create the top container
top_frame = Frame(root)
top_frame.pack( side = TOP )
scan_pcb=Label(top_frame,text='SCANNED CODE: ')
scan_pcb.grid(row=0,column=0)
pcb_entry=Entry(top_frame,background='white')
pcb_entry.grid(row=0,column=1)
pcb_entry.focus_set()
# create the left container
left_frame = Frame(root)
left_frame.pack( side = LEFT )
A_label=Label(left_frame,text='A')
A_label.grid(row=0,column=0)
A_entry=Entry(left_frame,background='white')
A_entry.grid(row=0,column=1)
B_label=Label(left_frame,text='B')
B_label.grid(row=1,column=0)
B_entry=Entry(left_frame,background='white')
B_entry.grid(row=1,column=1)
C_label=Label(left_frame,text='C')
C_label.grid(row=2,column=0)
C_entry=Entry(left_frame,background='white')
C_entry.grid(row=2,column=1)
# create the right container
right_frame = Frame(root)
right_frame.pack( side = RIGHT )
D_label=Label(right_frame,text='D')
D_label.grid(row=0,column=2)
D_entry=Entry(right_frame,background='white')
D_entry.grid(row=0,column=3)
E_label=Label(right_frame,text='E')
E_label.grid(row=1,column=2)
E_entry=Entry(right_frame,background='white')
E_entry.grid(row=1,column=3)
E_label=Label(right_frame,text='F')
E_label.grid(row=2,column=2)
E_entry=Entry(right_frame,background='white')
E_entry.grid(row=2,column=3)
root.mainloop()
Here is the desktop shortcut text file:
[Desktop Entry]
Name=SCANNER
Comment=My application which does this
Icon=/home/pi/Desktop/scan.png
Exec=python /home/pi/Desktop/SCANNER.py
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
Perhaps the methods mentioned in the links are outdated? Can anybody share relevant, precise and consise procedure for autorun boot, please?
Thank you very much.
/etc/xdg/lxsession/LXDE-pi
is the place to look at. Here the autostart file looks like this:@lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash point-rpi
So how do change content so it runs my .desktop file automatically? This thread suggest a method but I do not understand it fully. Would you please explain it to me if possible?
– Staflik Nov 29 '18 at 15:59/etc/rc.local
has limitations due to Compatibility with SysV. Following the recommendation of the developers from systemd you should avoid using it. – Ingo Dec 07 '18 at 17:59