How determine in toolbar from kivymd left_action_items or right_action_items on pure python.
i try write :left_action_items: [['icon.png', lambda x: pass]]
from kivymd.theming import ThemeManager
from kivy.uix.boxlayout import BoxLayout
from kivy.app import App
from kivymd.toolbar import Toolbar
class StartScreen(BoxLayout):
def __init__(self, **args):
super().__init__(**args)
self.orientation = 'vertical'
toolbar = Toolbar(title = 'Welcome', left_action_items = [['red.png', lambda x: print('hello')]])
self.add_widget(toolbar)
class Program(App):
theme_cls = ThemeManager()
title = "Application"
def build(self):
return StartScreen()
Program().run()
write error: KeyError = 'left_action'
You can try to add the left_action_items
property after instantiating the Toolbar
widget.
toolbar = Toolbar(title = "Welcome")
toolbar.left_action_items = [["facebook", lambda x: print('Hello World')]]
You can find some icons from kivymd at icon_definitions.py.