KIVY
Credit: https:// kivy.org
OUR EXPERT
Matt Holder is an IT professional of 15 years, Linux user for over 20 years, user of plenty of home automation gear and selfprofessed geek.
OUR EXPERT
Matt Holder is an IT professional of 15 years, Linux user for over 20 years, user of plenty of home automation gear and selfprofessed geek.
In this article, we are exploring Kivy, learning about its GUI language and how this links back to Python code and developing an application that can run on multiple platforms. Kivy is supported on Windows, Mac OS, Linux, Android and iOS.
By the end of this article, we will have developed an app that runs on desktop Linux as well as Android. We will also have introduced the necessary concepts to create a simple stopwatch application, rendered our simple user interface, written the logic to update the text and perform the counting function, as well as compiling an APK that can be installed on Android devices.
The complete code can be downloaded from https://github.com/mattmole/LXF310-Kivy-Stopwatch. So, without further ado, let’s begin.
The first thing to introduce is Kivy’s design language and how this links back to the Python code. As in other GUI frameworks, GUI elements can be defined within a supporting file, which means that the Python code itself can be less cluttered, due to the GUI elements being defined elsewhere. Kivy does seem to have more of a crossover with the code as variables from the Python code can be referenced within the KV design file. For example, you could reference a variable in the Python code, which is used to calculate the size of the window, based on the screen resolution and the platform that the code is running on. Conversely, it is also possible to link Python variables to items in the design file, so they can be updated accordingly.