Kivy python raspberry pi 3 : This framework is used for the user interface with the raspberry pi and it is a better solution in touch screen.
The main tool is to interact with applications as kivy is an open-source python library.
The use of kivy is in developing the mobile application software with neutral user interface (NUI).
%sudo echo ‘deb http://vontaene.de/raspbian-uodates/main’>
/etc/apt/sources.list.d/gstreamer.list
Debain package as,
%sudo pip install cython
Get kivy source:-
The kivy will support for raspberry pi and touch screen hardware under active development to run code,
Clone the kivy repo,
%cd~
%git clone https://github.com/kivy/kivy
%cd kivy
We install kivy manually or download and boot kivy pie on raspberry pi,
Sudo apt update
Sudo apt install libsdl2-dev libsdl2-imagee-dev libsdl2-mixer-dev linsdl2-ttf-dev\pkg-config libgl1-mesa-dev libgles2-mesa-dev\
Python-setuptools libstreamer1.0-dev git-core\
Gstreamer 1.0-plugins-{bad, base, good, ugly}\
Python-setup tools libstreamer 1.0-dev git-core\
Gstreamer1.0-plugins-{bad, base, good, ugly}
Gstreamer1.0-{omx, alsa} python-dev libmtdev-dev\
Xclip xsel libjpeg-dev
python –m pip install—upgrade—user—user pip setuptools
python –m pip install—upgrade—user—user cython==0.29.10 pillow
Manual installation on raspbian:-
Def http://vontaence.de/raspbin-uodates/main
Gpg—recv-keys 0C667A3E
Gpg—recv-keys 0C667A3E
Sudo apt-get update
Sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev\
Pkg-configlibgl1-mesa-dev libgles2-mesa-dev\
Python-setuptools libgstreamer1.0-dev git-core\
Gstreamer1.0-plugins-{bad, base, good, ugly}
Gstreamer1.0-{omx, alsa} python-dev
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
sudo pip install git+https://github.com/kivy/kivy.git
git clone https://github.com/kivy/kivy
cd kivy
make
echo”export PYTHONPATH=$(pwd):\$PYTHONPATH”>>~/.profile
source~/.profile
install dependencies as,
sudo pacman-Syu
sudo pacman-S sdl2 sdl2_gfx sdl2_image sdl2_net sdl2_ttsdl2_mixer python-setuptools
The kivypie is compact and lightweight raspbian distribution which comes with kivy installed,
Cd kivy/examples/demo/showcase
Python main.py
Change default screen,
If you use raspberry pi touch display and need to configure kivy to use it as input source you do it by edit ~/.kivy/config.ini.
Mouse=mouse
Mtdev_ %( name) s=probesysfs, provider=mtdev
Hid_ %( name) s=probesysfs, provider=hidinput
Steps:-
Update the software.
Then Reboot:pi@raspberrypi~$ sudo reboot
Then back to command line and check touch input work by trying it in X11:
pi@raspberrypi~$startx.
Then if touch works the exit the X11 and goes back to a command line.
There are two options for installation as,
We add the repository http://vontaene.de/raspbian-updates/ to the list.
$>sudp nano/etc/apt/sources. list
Then add line as,
Deb http://vontaene.de/raspbian-updates/.main
Then we save file,
%sudo apt-get update
%sudo apt-get install pkg-config libgll-mesa-dev libgles2-mesa-dev\python-pygamepython-setuptools libgstreamer 1.0-dev git-core\gstreamer 1.0-plugins-{bad, base, good, ugly} gstreamer1.0-{omx, alsa}
We install pip from sources as pip is the python package index.
The package is a similar way of apt-get.
The cythonhttp://cython.org/is c extension which is used by some components of kivy.
Sudo pip install cython
Then compile it locally as,
Git clone https://github.com/kivy/kivy
Cd kivy
The kivy sources are in the user home directory, as to install kivy in user folder but create many issues while developing applications,
Python setup.py build
Sudo python setup.py install