ScreenManager#
#
Added in version 1.0.0.
ScreenManager class equivalent.
If you want to use Hero animations you need to use
MDScreenManager not
ScreenManager class.
Transition#
MDScreenManager class supports the following
transitions:
MDFadeSlideTransitionMDSlideTransitionMDSwapTransition
You need to use the MDScreenManager class
when you want to use hero animations on your screens. If you don’t need hero
animation use the ScreenManager class.
ScreenManager class equivalent. Simplifies
working with some widget properties. For example:
ScreenManager#
ScreenManager:
canvas:
Color:
rgba: app.theme_cls.primaryColor
Rectangle:
pos: self.pos
size: self.size
from kivy.uix.screenmanager import ScreenManager
from kivy.graphics import Color, Rectangle
from kivy.app import App
class MyApp(App):
def build(self):
layout = ScreenManager()
with layout.canvas:
Color(*self.theme_cls.primary_color)
self.rect = Rectangle(pos=layout.pos, size=layout.size)
return layout
MyApp().run()
MDScreenManager#
MDScreenManager:
md_bg_color: app.theme_cls.primaryColor
from kivymd.uix.sreenmanager import MDScreenManager
from kivymd.app import MDApp
class MyApp(App):
def build(self):
return MDScreenManager(
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
height: self.minimum_width
adaptive_size#
adaptive_size: True
Equivalent
size_hint: None, None
size: self.minimum_size
API - kivymd.uix.screenmanager#
- class kivymd.uix.screenmanager.MDScreenManager(*args, **kwargs)#
Screen manager. This is the main class that will control your
MDScreenstack and memory.For more information, see in the
DeclarativeBehaviorandThemableBehaviorandBackgroundColorBehaviorandScreenManagerandMDAdaptiveWidgetclasses documentation.- current_hero#
The name of the current tag for the
MDHeroFromandMDHeroToobjects that will be animated when animating the transition between screens.Deprecated since version 1.1.0: Use
current_heroesattribute instead.See the Hero module documentation for more information about creating and using Hero animations.
current_herois anStringPropertyand defaults to None.
- current_heroes#
A list of names (tags) of heroes that need to be animated when moving to the next screen.
Added in version 1.1.0.
current_heroesis anListPropertyand defaults to [].
- get_hero_from_widget() list#
Get a list of
MDHeroFromobjects according to the tag names specified in thecurrent_heroeslist.
- on_current_hero(instance, value: str) None#
Fired when the value of the
current_heroattribute changes.
- add_widget(widget, *args, **kwargs)#
Changed in version 2.1.0: Renamed argument screen to widget.