StackLayout#
#
StackLayout class equivalent. Simplifies working
with some widget properties. For example:
StackLayout#
StackLayout:
canvas:
Color:
rgba: app.theme_cls.primaryColor
Rectangle:
pos: self.pos
size: self.size
from kivy.uix.stacklayout import StackLayout
from kivy.graphics import Color, Rectangle
from kivy.app import App
class MyApp(App):
def build(self):
layout = StackLayout()
with layout.canvas:
Color(*self.theme_cls.primary_color)
self.rect = Rectangle(pos=layout.pos, size=layout.size)
return layout
MyApp().run()
MDStackLayout#
MDStackLayout:
md_bg_color: app.theme_cls.primaryColor
from kivymd.uix.stacklayout import MDStackLayout
from kivymd.app import MDApp
class MyApp(App):
def build(self):
return MDStackLayout(
md_bg_color=self.theme_cls.primaryColor
)
MyApp().run()
Available options are:#
adaptive_height#
adaptive_height: True
Equivalent
size_hint_y: None
height: self.minimum_height
adaptive_width#
adaptive_width: True
Equivalent
size_hint_x: None
width: self.minimum_width
adaptive_size#
adaptive_size: True
Equivalent
size_hint: None, None
size: self.minimum_size
API - kivymd.uix.stacklayout#
- class kivymd.uix.stacklayout.MDStackLayout(*args, **kwargs)#
Stack layout class.
For more information, see in the
DeclarativeBehaviorandThemableBehaviorandBackgroundColorBehaviorandStackLayoutandMDAdaptiveWidgetclasses documentation.