Kivy is an open source software library for the rapid development of applications equipped with novel user interfaces, such as multi-touch apps. Using Kivy on your computer, you can create apps that run on:
- Desktop computers: OS X, Linux, Windows.
- IOS devices: iPad, iPhone.
- Android devices: tablets, phones.
- Any other touch-enabled professional/home brew devices supporting TUIO (Tangible User Interface Objects).
Label in Kivy
The Label widget is for rendering text. It supports ascii and unicode strings. Label is the text which we want to add on our window, give to the buttons and so on. On labels, we can apply the styling also i.e. increase text, size, color and more.
- Install kivy on your pc using cmd command “pip install kivy”
- Import kivy and its App modue as shown in the example below
- Create a class that inherits the App module
- Define a build method in the class and define the label you want to create in this method and then return the label
- Create an object for the class
- Lastly use run() command for the object
Normal Label Code
Multiline Label Code
You can easily make the text multiline using ‘\n’ at the end of each line.
Example 1 :
Example 2 :
Example 3 :
Note: For more information on kivy you can visit official docs using this link.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course