I believe that your RaspberryPi is already configured in (
/etc/inittab) to start 5th runlevel. This way it knows that it should run graphical login manager just after booting. So you should find a line like this in your
/etc/inittab (providing that you are using SLIM as a manager):
x:5:respawn:/usr/bin/slim >/dev/null 2>&1
Now what this line tells the system is that after starting in 5th runlevel, it should run
/usr/bin/slim command. What you can do is to change this line in order to run your own program/script that will start X server and your Python script instead. This way, if someone kills your app, the script will end, it will be restarted and there will be no login prompt.
If, on the other hand, you want this login prompt to be visible, you can run slim in your script just after your program ends.
So, you could put something like this in your
slim line first):
Then you should create
/usr/bin/start_my_script.sh with something like (substituting
/path/to/your/program.py with a real path):
xinit /path/to/your/program.py -- $DISPLAY
# if you want login prompt after exiting your script, uncomment this:
#/usr/bin/slim >/dev/null 2>&1
And make your script is executable by running:
sudo chmod +x /usr/bin/start_my_script.sh
I haven't tested this but I believe it should do the job.