-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Kivy Cookbook
By :

Now, we are going to introduce another layout widget named BoxLayout. Its name is a reference to the heap boxes where the boxes are the child widgets. To illustrate this, we will make a vertical heap of three buttons in this recipe.
You should be familiar with the widget tree abstraction, and it is important to check the recipes about the tree in this chapter.
We will need a KV file to set BoxLayout
and a Python file to add the BoxLayout
widget to our app. Follow the next steps:
In the KV file, define a BoxLayout
widget and set the size_hint
and orientation properties.
As children of the BoxLayout
:
<MyW>: BoxLayout: size_hint: 0.5,0.5 orientation: 'vertical' Button: id: label1 text: 'B1' Button: id: label2 text: 'B2' Button: id: label3 text: 'B3'
In the Python file, import FloatLayout
.
As shown here, define the class for the rule in...
Change the font size
Change margin width
Change background colour