Version

Quick search

Stack Layout

_images/stacklayout.gif

New in version 1.0.5.

The StackLayout arranges children vertically or horizontally, as many as the layout can fit. The size of the individual children widgets do not have to be uniform.

For example, to display widgets that get progressively larger in width:

root = StackLayout()
for i in range(25):
    btn = Button(text=str(i), width=40 + i * 5, size_hint=(None, 0.15))
    root.add_widget(btn)
_images/stacklayout_sizing.png
class kivy.uix.stacklayout.StackLayout(**kwargs)

Bases: kivy.uix.layout.Layout

Stack layout class. See module documentation for more information.

do_layout(*largs)

This function is called when a layout is called by a trigger. If you are writing a new Layout subclass, don’t call this function directly but use _trigger_layout() instead.

The function is by default called before the next frame, therefore the layout isn’t updated immediately. Anything depending on the positions of e.g. children should be scheduled for the next frame.

New in version 1.0.8.