free stats

Setup & Creating A Simple Kivy Application

Last Update : 19 Sep, 2022 Python, Programming, GUI

What is Python Kivy?

Kivy is a Python module that allows the creation of cross-platform compatible graphical user interface (GUI) applications using Python. We can run Kivy applications on iOS, Android, Windows, OS X, and GNU/Linux.

Kivy allows you to create a GUI using widgets and layouts. Also, It is similar to Python Tkinter in the way you develop applications.


Installing Kivy on Your PC

Before start developing the Kivy apps, We must download and install Kivy on Our PC. Using the pip command is the easiest way to download and install Kivy on Our PC.

So, we can test the pip command running on your system by opening CMD and typing pip.

If any error is not received, can continue with the instructions.

If the pip command does not work on your PC, need to add pip to your system path.

Test pip commands running on your system

So, There is more than one way to add pip to your system path. But, the easiest way is to modify your python installation and add pip to the system path.

If the pip command is working, You need to install Kivy by typing the following commands into your command prompt.

python -m pip install --upgrade pip wheel setuptools
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
python -m pip install pygame
python -m pip install kivy


Creating Hello World Kivy App

If your successfully installed kivy library on your computer, Let's create our first Python Kivy app.

First, You need to create a Python file with the .py extension.

After that, You need to import the necessary kivy modules.

For example -:

import kivy
from import App
from kivy.uix.label import Label

Object Oriented Programming (OOP) is the best way to create kivy app. Therefore, You also can create your first app using OOP.

Now, You need to create a class to represent our window which will inherit from the App class. And write the main block that prints "Hello World".

class FirstKivyApp(App):
    def build(self):
        return Label(text ="Hello World")

This will return a label with the text "Hello World".

To run this app You need to write the following code to at the end of the program.

if __name__ == "__main__":


The complete program is as follows.

import kivy
from import App
from kivy.uix.label import Label

# Defining a class
class FirstKivyApp(App):

    # Function that returns the root widget
    def build(self):

    	# Hello World text Label
        return Label(text ="Hello World")

if __name__ == "__main__":

    # This initializes and starts our app

You can see the following window with a "Hello World" text Label by running this program.

Creating Hello World Kivy App


This is a simple demonstration of creating and running a simple Kivy Hello World app. You can learn more about what happens to this code in the Kivy application development basics tutorial.

You found this tutorial / article valuable? Need to show your appreciation? Here are some options:

01. Spread the word! Use following buttons to share this tutorial / article link on your favorite social media sites.

02. Follow us on Twitter, GitHub ,and Facebook.