Here is the example for the docs. It is working for me.
I am running kivymd version 1.0.0.dev0
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivymd.app import MDApp
KV = '''
<ContentNavigationDrawer>:
ScrollView:
MDList:
OneLineListItem:
text: "Screen 1"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "scr 1"
OneLineListItem:
text: "Screen 2"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "scr 2"
Screen:
MDToolbar:
id: toolbar
pos_hint: {"top": 1}
elevation: 10
title: "MDNavigationDrawer"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDNavigationLayout:
x: toolbar.height
ScreenManager:
id: screen_manager
Screen:
name: "scr 1"
MDLabel:
text: "Screen 1"
halign: "center"
Screen:
name: "scr 2"
MDLabel:
text: "Screen 2"
halign: "center"
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
screen_manager: screen_manager
nav_drawer: nav_drawer
'''
class ContentNavigationDrawer(BoxLayout):
screen_manager = ObjectProperty()
nav_drawer = ObjectProperty()
class TestNavigationDrawer(MDApp):
def build(self):
return Builder.load_string(KV)
TestNavigationDrawer().run()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/73E5C735-0D5C-43BF-A5B6-C985EA5F2D0F%40gmail.com.
/kivy/factory.py", line 146, in __getattr__
raise FactoryException('Unknown class <%s>' % name)
kivy.factory.FactoryException: Unknown class <MDNavigationLayout>
Have you installed kivymd?
See: https://kivymd.readthedocs.io/en/latest/getting-started/#getting-started
Install kivymd into the same venv you installed kivy.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8bfed42f-75b4-4d01-9482-85d1917a21f9n%40googlegroups.com.
Package Version
------------------------- ---------
altgraph 0.17
certifi 2020.12.5
chardet 4.0.0
Cython 0.29.23
docutils 0.17.1
idna 2.10
importlib-metadata 4.0.1
Kivy 2.0.0
Kivy-Garden 0.1.4
kivymd 0.104.1
macholib 1.14
Pillow 8.2.0
pip 21.1.2
Pygments 2.9.0
pyinstaller 4.3
pyinstaller-hooks-contrib 2021.1
requests 2.25.1
setuptools 39.0.1
typing-extensions 3.10.0.0
urllib3 1.26.4
zipp 3.4.1
Install kivymd from the master.
pip install https://github.com/kivymd/KivyMD/archive/master.zip
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/1595471636.3594971.1625610584305%40mail.yahoo.com.