class LoginScreen(Screen):
def goto_Mainscr(self):
self.current="Mainscr"
class MainScreen(Screen):
pass
class ScanScreen(Screen):
pass
class InventoryScreen(Screen):
pass
class ItemsScreen(Screen):
pass
class LogsScreen(Screen):
pass
class AlertsScreen(Screen):
pass
class HelpScreen(Screen):
pass
class MainManager(FloatLayout):
def __init__(self, **kwargs):
super(MainManager, self).__init__(**kwargs)
class Invtest3App(App):
def build(self):
return MainManager()
if __name__ == '__main__':
Invtest3App().run()
<LoginScreen>:
name: "Loginscr"
id: loginscr
Button:
name: "loginButton"
text: "Login"
background_color: 0,0,0,0
pos_hint: {'x': 1.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.goto_Mainscr()
<MainScreen>:
name: "Mainscr"
FloatLayout:
pos_hint: {'top': 1}
size_hint: 1, 0.1
Button:
name: "scanButton"
text: "Scan"
pos_hint: {'x': 0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Scan"
Button:
name: "inventoryButton"
text: "Inventory"
pos_hint: {'x': 1.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Inventory"
Button:
name: "itemsButton"
text: "Items"
pos_hint: {'x': 2.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Items"
Button:
name: "logsButton"
text: "Logs"
pos_hint: {'x': 3.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Logs"
Button:
name: "alertsButton"
text: "Alerts"
pos_hint: {'x': 4.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Alerts"
Button:
name: "helpButton"
text: "Help"
pos_hint: {'x': 5.0/6.0, 'y': 0}
size_hint: 1.0/6.0, 1
on_press: root.ids.sm.current = "Help"
FloatLayout:
ScreenManager:
id: sm
pos_hint: {'top': 0.9}
size_hint: 1, 0.9
ScanScreen:
InventoryScreen:
ItemsScreen:
LogsScreen:
AlertsScreen:
HelpScreen:
Hi there,
I am working on an application and was wondering if it is possible to have a ScreenManager within a ScreenManager. The reason for this would be to have a login page using the full screen, and then screens that all use a navigation bar.
The code above tries to reflect this, could you please let me know wether this is possible and the best approach in kv AND python files together.
Many thanks.