My tkinter app wont start on armbian startup

84 views Asked by At

I have orangepi lite card and armbian in it. I have pyhon tkinter app that needs to start at boot so i write sh file for it.

#!/bin/bash
cd /folder-to-main-script
sudo python3 PinReader.py

#for the test purposes
echo "insertedtext" > file.txt

Here is my startup.sh when triggered from terminal it works perfectly. Then i added a .desktop file in /etc/xdg/autostart

[Desktop Entry]
Name=MyAppName
Exec=bash /full/path/to/working/directory/startup.sh
Type=Application
Version=1.0

It start the script on startup for sure but not the app. How can i start the tkinter program on startup.

1

There are 1 answers

0
aspq On

The problem is we cant sudo on startup. We have to give

chmod 7445 /usr/bin/python3

Then we can start it on startup.

Also we can add

#!/usr/bin/python3

to our python script so it runs when we call it like

/path_to_mainfile/mainfile.py

We dont need to use sh file we can change the autostart file to

[Desktop Entry]
Name=MyAppName
Exec=/path_to_mainfile/mainfile.py
Type=Application
Version=1.0

it'll work.