I have written an application with Kivy that I want to run on my raspberry pi. I have a model 2 pi, a 3.5 inch PiTFT. I am connected via HDMI to an external screen. I followed the instructions for installing kivy on the pi, and I am trying to run the examples.

Firstly, with the console on the piTFT when I run kivy/examples/demo/kivycatalog main.py the application is automatically output to my external HDMI screen. However, the image seems to be very bad compared to when I run the exact same application on my mac. Why might this happen?

Secondly I am unable to get the application to display on my piTFT.

I tried KIVY_BCM_DISPMANX_ID=3 python main.py as I believe that my piTFT has an id of 3 (although I cannot remember how to check this).

Has anyone successfully run any of the kivy demos on their piTFT?

My pi runs on Debian


I just got it working under the Adafruit Raspbian Jessie image (although I am still fiddling with an inverted x/y touchscreen issue).

The secret seems to be:

1) do the detailed install outlined here:


When you edit the file ~/.kivy/config.ini per those instrucitons, also edit the [DISPLAY] section to set the display size to 320x240

2) you also have to run** fbcp while you are running kivy

see https://github.com/tasanakorn/rpi-fbcp

To install that you will probably need to install cmake:

sudo apt-get install cmake

Once I did those steps the examples ran.

** E.g., in one SSH terminal window I run

$ path_to_where_compiled_fbcp/fbcp

then in another SSH terminal window I run

$ python examples/demo/pictures/main.py

If you run into problems where the RESISTIVE touch screen coordinates seem reversed, try this in your ~/.kivy/config.ini file (which also needs to be copied to /root/ using sudo cp)

mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput,param=rotation=270,param=invert_y=1

Note: if you are using the CAPACITIVE touch screen, the code is a bit different to use mtdev due to some sort of bug with the hidinput system for PiTFT:

mouse = mouse
%(name)s = probesysfs,provider=hidinput
pitft = mtdev,/dev/input/touchscreen,max_position_x=240,max_position_y=320,invert_y=0,invert_x=1,rotation=270
  • When you say the "[DISPLAY] section" do you mean [graphics] ? I don't see any references to a display section. I'm trying the following: [graphics] width = 320 height = 240 fullscreen = 1 but all I get is the usual high resolution. Sep 7 '16 at 6:05

Adding some updated info. I am trying this in July 2019, and I was able to get the screen displaying and responding to touch inputs by following the 'easy install' instructions from Adafruit

The remaining part I was missing to get Kivy touch inputs to line up with the screen orientation I was able to figure out from the previous answer.

mouse = mouse
hid_%(name)s = probesysfs,provider=hidinput,param=rotation=90,param=invert_y=1

I needed to use 'rotation=90' which matches what I entered in the AdaFruit easy-setup wizard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.