Hi guys i am new to KivyMD and working on my first app. Basically i need to open a new screen on click on the contents in my navigation drawer. For instance i have a New Room button on my nav drawer and i want a new screen to be opened when i click on it.
Okay here's my code
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
from home_page_strings import toolbar
class EMC_WebmaApp(MDApp):
def build(self):
screen = Screen()
# theme settings
self.theme_cls.primary_palette = 'DeepPurple'
self.theme_cls.theme_style = 'Dark'
# end of theme declaration
# loaded strings
navigation_bar = Builder.load_string(toolbar)
# end of loaded strings
# addition of loaded strings to screen + return screen
screen.add_widget(navigation_bar)
return screen
# end of addition
EMC_WebmaApp().run()
And here's my string
toolbar = '''
Screen:
NavigationLayout:
ScreenManager:
Screen:
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'EMC_Webma'
left_action_items: [['menu', lambda x: navigation.set_state('open')]]
right_action_items: [['card-search', lambda x: print('pass')]]
elevation: 10
MDList:
TwoLineListItem:
text: 'Friend 1'
secondary_text: '[Recent text here]'
MDList:
TwoLineListItem:
text: 'Friend 2'
secondary_text: '[Recent text here]'
MDList:
TwoLineListItem:
text: 'Friend 3'
secondary_text: '[Recent text here]'
MDList:
TwoLineListItem:
text: 'Friend 4'
secondary_text: '[Recent text here]'
MDList:
TwoLineListItem:
text: 'Friend 5'
secondary_text: '[Recent text here]'
MDList:
TwoLineListItem:
text: 'Friend 6'
secondary_text: '[Recent text here]'
Widget:
MDNavigationDrawer:
id: navigation
BoxLayout:
orientation: 'vertical'
spacing: '8dp'
padding: '8dp'
Image:
source: 'einstein.jpg'
MDLabel:
text: 'Enwerem Melvin Confidence'
font_style: 'Subtitle2'
size_hint_y: None
height: self.texture_size[1]
MDLabel:
text: 'enweremmelvinconfidence@gmail.com'
font_style: 'Caption'
size_hint_y: None
height: self.texture_size[1]
ScrollView:
MDList:
OneLineIconListItem:
text: 'New Room'
IconLeftWidget:
icon: 'theater'
OneLineIconListItem:
text: 'Contacts'
IconLeftWidget:
icon: 'contacts'
OneLineIconListItem:
text: 'Calls'
IconLeftWidget:
icon: 'cellphone-android'
OneLineIconListItem:
text: 'Settings'
IconLeftWidget:
icon: 'settings'
OneLineIconListItem:
text: 'FAQ'
IconLeftWidget:
icon: 'frequently-asked-questions'
OneLineIconListItem:
text: 'Invite Friends'
IconLeftWidget:
icon: 'account-plus'
OneLineIconListItem:
text: 'Toggle Theme'
IconLeftWidget:
icon: 'theme-light-dark'
'''
Thanks for helping