Search code examples
pythonpython-3.xkivykivy-languagekivymd

NavigationLayout Kivy err0r


I decided to update kivy. Previously, there was no such error, now:

raise FactoryException('Unknown class <%s>' % name)
 kivy.factory.FactoryException: Unknown class <NavigationLayout>

Code:

from kivy.lang import Builder
from kivymd.app import MDApp
from kivy.core.window import Window
Window.size = (600,550)
KV = '''
Screen:
    NavigationLayout:
        MDNavigationDrawer:
            id: draver
            BoxLayout:
                orientation: 'vertical'
                ScrollView:
                    MDList:
                        BoxLayout:
                            id: box 
                        OneLineIconListItem:
                            on_press: app.star()
                            text: 'Избранное'
                            IconLeftWidget:
                                icon: 'star'
                        OneLineIconListItem:
                            text: 'Настройки'
                            IconLeftWidget:
                                icon: 'settings'    
'''
class Test(MDApp):
    def build(self):
        return Builder.load_string(KV)
    
Test().run()

Please helppp

this is written because the site does not allow you to ask a question this is written because the site does not allow you to ask a question this is written because the site does not allow you to ask a question this is written because the site does not allow you to ask a question


Solution

  • Ran the exact program you posted. No error. Although no Navigation bar too, that's just the code is incomplete. Use official KivyMD website for the correct format.

    https://kivymd.readthedocs.io/en/latest/components/navigation-drawer/

    Try creating a new Virtual env and run it there.