Introduction to Kivy ; A Cross-platform Python Framework
Kivy is a graphical user interface opensource Python library that allows you to develop multi-platform applications on Windows, MacOS, Android, iOS, Linux, and Raspberry Pi. The best thing about kivy is, it performs better than HTML5 cross platform alternatives.
Installation
- Note- Python3 should be installed in your system.
- Installation in Windows:
- Update the pip and wheel before installing kivy by entering this command in cmd-
python -m pip install --upgrade pip wheel setuptools
- 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
- Install kivy
python -m pip install kivy
- Update the pip and wheel before installing kivy by entering this command in cmd-
- Installation in Linux:
- Add the PPA by entering this command in terminal-
sudo add-apt-repository ppa:kivy-team/kivy
- Update your package list using your package manager-
sudo apt-get update
- Install Kivy
sudo apt-get install python3-kivy
- Add the PPA by entering this command in terminal-
Create an application
There are three steps of creating a application with kivy-
- Inherit Kivy’s App class which represents the window for our widgets
- Create build() method, which will show the content of the widgets.
- And at last calling of run() method.
Example application:
This is python3 code to make a simple application which shows desired text in the system’s screen-
import kivy kivy.require('1.10.0') from kivy.app import App from kivy.uix.button import Label # Inherit Kivy's App class which represents the window # for our widgets # 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 with Hello Kivy return Label(text ="Hello Geeks") helloKivy = HelloKivy() helloKivy.run() |
To run this code open cmd(terminal in linux) and go through the directory in which the code is saved and type this command-
python file_name.py

Recommended Posts:
- Python | Sessions framework using django
- Python | Bubble in kivy
- Python | Animation in Kivy
- Python | Canvas in kivy
- Python | StackLayout in Kivy
- Python| AnchorLayout in Kivy
- Python | Scatter in kivy
- Python | Kivy .kv File
- GridLayouts in Kivy | Python
- Python | Accordion in kivy
- Python | PageLayout in Kivy
- Python | Button Action in Kivy
- Python | StackLayout in Kivy using .kv file
- Python | Carousel Widget In Kivy
- Python | Tabbed panel in kivy
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



