Kivy Pie

Kivy on
Raspberry PI

Kivy is a Python framework for multitouch apps.
Developers can boot Kivy Pie to start working straight in!

Q: Why KivyPie, and why pipaOS?
A: To make the installation steps simple to Kivy developers. KivyPie integrates all software needed and boots directly on the Raspberry PI, no extra configuration is needed. pipaOS is a minimalist Raspbian OS version. KivyPie 0.6 comes with a small X desktop that you can start manually at any time with startx.

Adding more features and fixing bugs to Kivy Pie should make the development experience more agile. You are very welcome to help, submit suggestions, and report problems at the discussion group.
Q: Which input devices does KivyPie support?
A: All Raspbian supported devices should work well. The RaspberryPI touch display works out of the box. PiTouch has been reported to work well. If you test more input devices please join the discussion group to let others know.
Q: I booted Kivy Pie. What now?
A: You will be presented with a login prompt
Login: sysop
Password: posys
Q: Is there any documentation for newbies?
A: Oh yeah! Kivy user’s documentation in PDF is in the home directory of the sysop user, and you can also get the latest official version here
Q: Can I ssh into kivy-pie?
A: Yes, any of the following should do:
  • Plug your PI to the network over the Ethernet connection
  • Set your access point to KivyPie with essid/pass to pipaos / pipa123pass, reboot
  • Or, connect to your access point with sudo pipaos-setwifi essid passphrase, reboot.
Q: Which editors are available?
A: Emacs, Vim and Nano are available, you can also install your preferred IDE using the standard debian apt tool.
Q: How can I use my SD card to its full capacity?
A: On KivyPie 0.6 and higher, type sudo pipaos-config --expand-rootfs. Then execute sudo reboot. On previous versions, type sudo expand_rootfs.sh and reboot.
Q: How do I upgrade to the latest system software and RaspberryPI Firmware?
A: KivyPie is bundled inside PipaOS, which is based on Raspbian. You can use sudo update / upgrade to keep your system up to date, and you can also call sudo rpi-update to upgrade to the latest RaspberryPI firmware. There is an overall recipe here.
Q: How do I upgrade to the latest Kivy framework?
A: sudo apt-get update; sudo apt-get install python2-kivypie python3-kivypie python-kivypie-examples
Note that kivy points to Python3, whereas python runs Python2.
The packages are submitted to the pipaos repository each time I build a new release image.
Q: Can I connect to a Kivy-pie desktop remotely?
A: Yes, follow this tutorial
Q: How do I rebuild kivy?
A: The sources are not packed anymore inside kivypie, instead do the following:
$ sudo umount /tmp
$ git clone https://github.com/kivy/kivy.git
$ cd kivy
$ pip install --upgrade .

Replace pip for pip3 to build for Python3.
Unmounting /tmp is necessary as it defaults to a small-sized ramdisk, pip would choke otherwise.
Q: How do I set the default Python for Kivy apps?
There are 3 ways to run kivy apps:
$ kivy myapp.py
$ python myapp.py
$ python2 / 3 myapp.py

You simply need to replace your preferred python/kivy wrapper, for example:

$ sudo ln -sf $(which python2) $(which kivy)
$ readlink $(which kivy)
/usr/bin/python2
Q: Does Adafruit's PiTFT touchscreen work on KivyPie?
A: The PiTFT display needs a specially crafted linux kernel. You should get it running by following the steps in the DIY Installer script section. I recommend you do a backup of the /boot directory in case you need to rollback.
Q: Can I take a screenshot of my Kivy apps while they run?
A: Yes, type raspi2png on the command line, a file called snapshot.png will appear. Thanks to Andrew Duncan.
Q: Is there a new version coming up?
I work on KivyPie on my spare time for fun, so yes new versions will continue to arise, but I have no deadlines :-)

Join the discussion group to suggest new features, help others by testing, or get involved by sending Pull Requests.
Q: Why is Python GPIO not working?
It seems this library had a few issues on the the RaspberryPI. As of KivyPie version 0.6 it comes with python-rpi.gpio, raspi-gpio and wiringpi official Python packages.
Q: Can I have an HDMI display and the RaspberryPI touch screen at the same time?
A: Yes. Enable the flag display_default_lcd=0 on the file /boot/config.txt, set your user's environment variable KIVY_BCM_DISPMANX_ID="4" to run Kivy apps on the touch screen. The way around does also work, set KIVY_BCM_DISPMANX_ID=5 instead.
Q: Everything on my screen is upside down!
A: Add this in your /boot/config.txt: lcd_rotate=2, then reboot.
Q: Is there a X11 graphical desktop?
A: Yes there is, login with sysop from the console and type startx. You should get a Fluxbox desktop on your display.
Q: Can Kivy apps run as the superuser?
A: This issue has been fixed on KivyPie v0.6. It is possible to run kivy apps via sudo, or through systemd profile scripts. The Kivy framework configuration file is different and is located at /root/.kivy/config.ini.
Q: What is the password of the superuser?
A: thor.
Q: I cannot see anything on my display after booting up.
A: Have a look at the file /boot/config.txt. The default settings should work on most displays but some might not work, or show black margins on the sides (overscan). There is a good step-through process to match your display.
Q: How can I start a kivy app immediately after boot?
A: Easiest way is to add /usr/bin/kivy /path/to/my/app.py & to your /etc/rc.local file.
Keep in mind that kivypie boots really fast, you might not get the app networked until a bit after. Also, you won't be able to switch to a different tty when a kivy app is running, either ssh into it, or provide a hotkey escape option to your app.
Q: Can I specify the dispmanx layer for my Kivy apps?
A: Kivy on RaspberryPI relies on SDL2 to get access to DispmanX, and there is a patch to specify the layer number using a Hint or an environment variable.
Q: How can I quantify resources used by my kivy apps?
A: Install the rpi-monitor debian package, and run rpi-monitor &. It will visualize on top of your kivy apps in real time, so you can detect GPU memory constraints, or other resources you choose to peek at.
Q: Is it possible to run Kivy apps remotely?
A: Yes, execute sudo dispman_vncserver. Open a RealVNC Viewer from a remote device and connect to Kivypie IP address, port 5900. It is not 100% reliable, and it seems you cannot send keyboard/mouse input from the VNC client to the app, but it's fairly usable. Thanks to Peter Hanzel.
Q: My Python2 based apps do not run on KivyPie 0.9b!
A: I mistakenly built Python3 alone on this release, sorry about that! You can quickly fix it like so:

$ apt-get update
$ apt-get install python2-kivypie
$ ln -sf /usr/bin/python2 /usr/bin/kivy
Q: Can I install KivyPie runtime on Raspbian?
A: It should work, following these steps, as root:

$ echo "deb http://archive.mitako.eu/ jessie main" > /etc/apt/sources.list.d/mitako.list
$ curl -L http://archive.mitako.eu/archive-mitako.gpg.key | apt-key add -
$ apt-get update
$ apt-cache search kivypie
python-kivypie-examples - Python Kivy examples for the RaspberryPI
python2-kivypie - Python2 Kivy libraries for the RaspberryPI
python3-kivypie - Python3 Kivy libraries for the RaspberryPI

I haven't tested these packages on a real RaspberryPI running Raspbian, and they depend on core functionality only. It's very likely some features will not work.
Help in tracking down issues is greatly welcome. Please report findings at the discussion group.