Kivy MD how to use multiple ScreenManagers

77 views
Skip to first unread message

Christoph Bauer

unread,
Mar 11, 2023, 3:41:46 AM3/11/23
to KivyMD users support
For the purpose of having multiple Screens for App startup (without BottomAppBar) and later after sucessful login having multiple Screens with BottomAppBar I tried to solve this by initializing two ScreenManagers in the *.kv File.



See below the structure of the *.kv file.
Question: How can I handle the ScreenManagers ('sm' and 'ssm') from the *.py File?
Current status:  'sm' appears and works as usual
Target status: 'ssm' should appear at start up; after sucessful login sm should appear

Thank you for any help!

MDScreen:

BoxLayout:
orientation:'vertical'
ScreenManager:
id:ssm
LoginScreen:
SignupScreen:
MDNavigationLayout:
x: toolbar.height
size_hint_y: 1
#size_hint_y: 1.0 - toolbar.height/root.height

ScreenManager:
id: sm
#LoginScreen:
#SignupScreen:
GraphScreen:
ActionScreen:
Screen:
name: "scr5"

MDLabel:
text: "Screen 5"
halign: "center"


MDNavigationDrawer:
id: nav_drawer

ContentNavigationDrawer:
screen_manager: sm
nav_drawer: nav_drawer

MDTopAppBar:
id: toolbar
type:"top"
title: ""
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]

MDIconButton:
icon:"images/final_me.png"
pos_hint: {'center_x': .8,'center_y': .05}
icon_size: "60sp"

Reply all
Reply to author
Forward
0 new messages