Quick search

Table Of Contents

Stack Layout

_images/stacklayout.gif

バージョン 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)[ソース]

ベースクラス: kivy.uix.layout.Layout

Stack layout class. See module documentation for more information.

minimum_height

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

バージョン 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.

バージョン 1.0.8 で追加.

minimum_size is a ReferenceListProperty of (minimum_width, minimum_height) properties.

minimum_width

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

バージョン 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’.

バージョン 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).

注釈

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

padding

Padding between the layout box and it’s children: [padding_left, padding_top, padding_right, padding_bottom].

padding also accepts a two argument form [padding_horizontal, padding_vertical] and a single argument form [padding].

バージョン 1.7.0 で変更: Replaced the NumericProperty with a VariableListProperty.

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

spacing

Spacing between children: [spacing_horizontal, spacing_vertical].

spacing also accepts a single argument form [spacing].

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