Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
Now in this article, we will learn about the use of
BoxLayout widget in kivy and how to add some features like color, size etc to it.
BoxLayout arranges widgets in either in a vertical fashion that is one on top of another or in a horizontal fashion that is one after another. When you will not provide any size-hint then the child widgets divides the size of its parent widget equally or accordingly.
Basic Approach to follow while creating button :
1) import kivy
2) import kivyApp
3) import BoxLayout
4) set minimum version(optional)
5) Add widgets
6) Extend the class
7) Return layout
8) Run an instance of the class
Below is the code to use BoxLayout:
Some modification like add colour, fix size in Box layout widget:
Note: Every time you run the code it provides you the different color outputs as in the pictures.
- Python | Carousel Widget In Kivy
- Python | Popup widget in Kivy
- Python | Switch widget in Kivy
- Python | Spinner widget in kivy
- Python | Slider widget in Kivy
- Python | Add image widget in Kivy
- Python | Checkbox widget in Kivy
- Python | Popup widget in Kivy using .kv file
- Python | Carousel Widget In Kivy using .kv file
- Python | Switch widget in Kivy using .kv file
- Python | Spinner widget in Kivy using .kv file
- Progressbar widget in Tkinter | Python
- Python | PanedWindow Widget in Tkinter
- Python | Slider widget using .kv file
- Python | Menu widget in Tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : ManasChhabra2