In this article we look at Kivy and create our first example using Python
Kivy is a free and open source Python framework for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, macOS, and Windows.
Installation in Windows:
Step 1: Update the pip and wheel before installing kivy by entering this command in cmd-
python -m pip install –upgrade pip wheel setuptools
Step 2: Install the dependencies-
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
python -m pip install kivy.deps.angle
Step 3: Install kivy.
python -m pip install kivy
I used Thonny, click on Tools -> manage Packages -> search for Kivy and install, its all done for you easy
There are three basic steps of creating an application using kivy:
Inherit Kivy’s App class which represents the window for the widgets
Create a build() method, which will show the content of the widgets.
And at last calling of the run() method.
import kivy kivy.require('1.10.0') from kivy.app import App from kivy.uix.button import Label # HelloKivy inherits all the fields and methods from Kivy class HelloKivy(App): # This returns the content we want in the window def build(self): # Return a label widget return Label(text ="Maxpython") helloKivy = HelloKivy() helloKivy.run()
When you run this you will see something like this