4

The example code seems a little outdated, e.g. I had to replace 'NavigationLayout' with 'MDNavigationLayout'.

I'm using the latest kivymd downloaded from github

This is simplest example that I found, but the example code here has the same issue:

from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.window import Window



Window.size = (300, 500)

navigation_helper = """
Screen:
    MDNavigationLayout:
        ScreenManager:
            Screen:
                BoxLayout:
                    orientation: 'vertical'
                    MDToolbar:
                        title: "Navigation Drawer"
                        elevation: 10
                        left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
                    Widget:
        MDNavigationDrawer:
            id: nav_drawer
"""


class DemoApp(MDApp):

    def build(self):
        screen = Builder.load_string(navigation_helper)
        return screen


DemoApp().run()
kztd
  • 3,121
  • 1
  • 20
  • 18

2 Answers2

9

replacing

#left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]

with

left_action_items: [['menu', lambda x: nav_drawer.set_state('toggle')]]

seems to work

kztd
  • 3,121
  • 1
  • 20
  • 18
0

This is a code I just tried, I believe it will work for you.

OneLineAvatarListItem:
                    ImageLeftWidget:
                        source: "chorko.jpg"
                        radius: [self.size[1]-(self.size[1]/2)]

Try it out..

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103