Skip to content

Stack Layout

morphui.uix.stacklayout

MorphStackLayout(*widgets, **kwargs)

Bases: MorphDeclarativeBehavior, MorphColorThemeBehavior, MorphSurfaceLayerBehavior, MorphAutoSizingBehavior, StackLayout

A StackLayout that supports declarative child widgets via :class:~morphui.uix.behaviors.MorphDeclarativeBehavior.

This class combines the functionality of Kivy's StackLayout with several MorphUI behaviors to enhance its capabilities: - MorphDeclarativeBehavior: Enables declarative property binding. - MorphColorThemeBehavior: Integrates color theming capabilities. - MorphSurfaceLayerBehavior: Provides surface styling options.

Examples:

from morphui.app import MorphApp
from morphui.uix.stacklayout import MorphStackLayout
from morphui.uix.label import MorphLabel
class MyApp(MorphApp):
    def build(self):
        return MorphStackLayout(
            MorphLabel(
                text="Label 1",
                theme_style='primary'),
            MorphLabel(
                text="Label 2",
                theme_style='secondary'),
            theme_style='surface',
            padding=50,
            spacing=15,)
MyApp().run()

refresh_content()

Refreshes the content of the StackLayout and all its children.