kivymd 的工具栏还没有 left_action_items
toolbar from kivymd haven't left_action_items
如何在工具栏中从 kivymd left_action_items 或 right_action_items 上确定纯 python。
我试着写 :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()
写入错误:
KeyError = 'left_action'
您可以尝试在实例化 Toolbar
小部件后添加 left_action_items
属性。
toolbar = Toolbar(title = "Welcome")
toolbar.left_action_items = [["facebook", lambda x: print('Hello World')]]
您可以在 icon_definitions.py 找到一些来自 kivymd 的图标。
如何在工具栏中从 kivymd left_action_items 或 right_action_items 上确定纯 python。
我试着写 :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()
写入错误: KeyError = 'left_action'
您可以尝试在实例化 Toolbar
小部件后添加 left_action_items
属性。
toolbar = Toolbar(title = "Welcome")
toolbar.left_action_items = [["facebook", lambda x: print('Hello World')]]
您可以在 icon_definitions.py 找到一些来自 kivymd 的图标。