Use these instructions to run a fullscreen Python app on your Raspberry Pi with an Adafruit TFT display.


Download the latest Jessie-Lite based image for your TFT display. In my case, I used the 2016-10-18 image for the Adafruit PiTFT 2.8" Touchscreen Display for Raspberry Pi.

Note that there are different images for each type of display.

Unzip the image and use dd to write it to your SD card. Replace /dev/sdz with the appropriate name for your SD card.

dd if=2016-10-18-pitft-28r.img of=/dev/sdz

Mount the boot partition of your SD card.

sudo mount /dev/sdz1 /mnt/boot

Create a file named ssh on that boot partition.

touch /mnt/boot/ssh

This will automatically enable SSH on the first boot.

Umount the SD card.

umount /dev/sdd*

Boot your Pi with that SD card. You should see the TFT displaying boot messages.

You can login directly to the Pi as the pi user to run the following commands, or connect as pi over SSH.

The rest of the commands should be run on the Pi.

Update the package list.

apt-get update

Install required packages.

apt-get install --no-install-recommends \
    sudo \
    xorg \
    openbox \
    lightdm \
    python3 \
    python3-tk \
    xserver-xorg-legacy \

Edit the lightdm config script at /etc/lightdm/lightdm.conf to enable autologin.

That file needs to only contain this content for autologin to work.


Reboot to verify autologin works. You should now be logged in as pi automatically. You should see a blank screen with a mouse pointer.

As long as autologin appears to work properly, we can set up our fullscreen app.

Create the openbox config directory for the pi user if it does not exist.

mkdir -p $HOME/.config/openbox

Create a script at $HOME/.config/openbox/autostart for the pi user. This script will be run at login.

# redirect all output to a log file
# -u so that output is flushed immediately to the log
python3 -u $HOME/ 2>&1 > $HOME/app.log &

The & at the end is required for every command in the autostart script.

Create a file $HOME/ for our python application code.

import tkinter as tk

class FullScreenApp(object):

    def __init__(self, master, **kwargs):
        master.geometry(self.dimensions.format(width, height))

        b = tk.Button(self.master, text="Press me!", command=lambda: self.pressed()), rely=0.5, anchor=tk.CENTER)

    def pressed(self):





You should be able to use the touchscreen to interact with your fullscreen python app.


If you touch the screen and find the pointer jumping around to odd places, you should look at Adafruit's guides for performing calibrations.

You may also find my article on TFT input transformation to be helpful.


I'm torn on using Adafruit's images rather than the official Pi image. Adafruit's images are not in sync with the latest from the Raspberry Pi Foundation, and use a lot of custom code. However, you need that custom code for the TFT to work properly, and I've found the images are much simpler to deal with than manually installing the Adafruit kernel and software.