Kivy - Getting Started



Kivy is an open-source Python library. It allows you to build multi-touch applications with a natural user interface (NUI). With Kivy, you can develop cross-platform applications. The same code, written once, can be deployed on different various operating system platforms such as Windows, macOS, Linux, Android, and iOS.

Popular GUI Frameworks in Python

Kivy is one of the many GUI frameworks available in the Python ecosystem. Some of the popular Python libraries for building desktop GUI applications are −

  • Tkinter − Tkinter package is bundled with Python's standard library. It is the standard Python interface to the Tcl/Tk GUI toolkit.

  • PyQt5 − This library is a Python port for the Qt GUI toolkit. Our extensive tutorial on PyQt5 can be accessed here.

  • WxPython − WxPython library allows Python programmer to have access to WxWidgets, an open-source GUI toolkit, originally written in C++. To learn more about WxPython, click here.

  • Kivy − Kivy is a Python library that helps you to build cross-platform GUI applications for Windows, Linux, iOS as well as Android. Kivy supports touch-enabled input. All the widgets in Kivy GUI framework have the capability to handle multi-touch gestures.

Kivy is equipped with powerful graphics and multimedia features. A Kivy app can support audio, video, animations, 2D as well as 3D graphics.

Key Features of Python Kivy

Here are some key features of Python Kivy −

  • Kivy supports touch-enabled input. All the widgets in Kivy GUI framework have capability to handle multi-touch gestures.

  • Kivy's comprehensive GUI widgets and robust layout management makes designing attractive interfaces easily possible.

  • Kivy is equipped with powerful graphics and multimedia features. This makes it possible to incorporate, 2D as well as 3D graphics, animations, audio and video componenets in the application.

  • Various types of input devices are supported by Kivy. It includes touch, mouse and gestures.

  • Kivy API can access mobile device hardware components such as camera, GPS, etc.

  • Kivy uses OpenGL ES 2 graphics library, and is based on Vertex Buffer Object and shaders.

  • Kivy relies upon Cython for its core implementation, and SDL2 (Simple DirectMedia Layer) for low-level multimedia and input handling.

To deploy the Kivy application on desktops with Windows, Linux or iOS operating systems, the distributable is built with PyInstaller. To build an APK for Android, you need to use Android Studio and Buildozer utility.

The Kivy Language

Kivy uses a special declarative language called Kivy Language (sometimes also called Kv language) to build user interface layouts for Kivy applications. It serves the purpose of separating the design aspect of an app from its programming logic. The design is written in a text file with ".kv" extension. Kivy framework automatically loads the ".kv" file and builds the UI based on the specifications given in it.

The initial version of Kivy library was released in 2011. Currently, Kivy version 2.2 is available, which has been released in May 2023.

Advertisements