
Kivy Cookbook
By :

Sometimes, it is quite tedious to establish each and every position for all the widgets in our app. There is a special kind of widget, the layouts widget, that makes things easy for us. In this recipe, we will review how to work with the size and position hints that allows us to organize widgets inside this new kind of widget.
A quick check of the recipe Designing with the Kv language in Chapter 1, Kivy and the Kv language could be important to go deeper in this recipe.
To complete the task, perform the following steps:
In the KV file, define two buttons and assign the size_hint
and pos_hint
properties as follows:
<MyW1>: Button: id: label1 size_hint: .2, .2 pos_hint: {'center_x':.5, 'center_y': .5} text: 'B1' Button: id: label2 size_hint: .1, .1 pos_hint: {'center_x':.1, 'center_y': .1} text: 'B2'
In the Python file, import the FloatLayout
.
Define the class for the...
Change the font size
Change margin width
Change background colour