# Stack Layout¶

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))

class kivy.uix.stacklayout.StackLayout(**kwargs)[source]

do_layout(*largs)[source]

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.

minimum_height

Minimum height needed to contain all children. It is automatically set by the layout.

New in version 1.0.8.

minimum_height is a kivy.properties.NumericProperty and defaults to 0.

minimum_size

Minimum size needed to contain all children. It is automatically set by the layout.

New in version 1.0.8.

minimum_width

Minimum width needed to contain all children. It is automatically set by the layout.

New in version 1.0.8.

minimum_width is a kivy.properties.NumericProperty and defaults to 0.

orientation

Orientation of the layout.

orientation is an OptionProperty and defaults to ‘lr-tb’.

Valid orientations are ‘lr-tb’, ‘tb-lr’, ‘rl-tb’, ‘tb-rl’, ‘lr-bt’, ‘bt-lr’, ‘rl-bt’ and ‘bt-rl’.

Changed in version 1.5.0: orientation now correctly handles all valid combinations of ‘lr’,’rl’,’tb’,’bt’. Before this version only ‘lr-tb’ and ‘tb-lr’ were supported, and ‘tb-lr’ was misnamed and placed widgets from bottom to top and from right to left (reversed compared to what was expected).

Note

‘lr’ means Left to Right. ‘rl’ means Right to Left. ‘tb’ means Top to Bottom. ‘bt’ means Bottom to Top.

padding

padding is a VariableListProperty and defaults to [0, 0, 0, 0].
spacing
spacing is a VariableListProperty and defaults to [0, 0].