Organizing with layouts

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.

Getting ready

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.

How to do it…

To complete the task, perform the following steps:

  1. 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': ...

Get Kivy Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.