Getting Started with Kivy in Python

In this Python and Kivy article we want to learn about Getting Started with Kivy in Python, so Kivy is free and open source Python library for developing multi touch applications with  natural user interface. Kivy allows you to develop apps that runs on Windows, macOS, Linux, Android and iOS with single codebase. in this article we walk you through the process of getting started with Kivy in Python.



Getting Started with Kivy in Python

First of all we need to install Kivy and you can use pip for Python Kivy installation



Now let’s create our basic gui application with Python and Kivy




So now let’s describe the code line by line, These lines import App class from the module and the Button class from the kivy.uix.button module. App class is the base class for creating Kivy applications, and Button class is builtin Kivy widget that displays a button.



This line defines a class called TestApp that extends from the App class.



This method is called when the application starts and returns root widget of the application. in this case we have created a Button widget and returns it as the root widget.



This line creates an instance of the TestApp class and calls its run method to start the application.




If you run the code you will see big Python Kivy Button in the GUI Window.

Getting Started with Kivy in Python
Getting Started with Kivy in Python



So in this article we have covered the basics of getting started with Kivy in Python. we have explained how to install Kivy and how to create basic Kivy application. Kivy provides different builtin widgets and layout managers that can be used to create complex multitouch applications. with Kivy, you can build applications that run on multiple platforms with single codebase.



Learn More on Kivy


Leave a Comment