答案 0 :(得分:1)
您应该在app类中声明theme_cls
个实例,如下所示:
from kivymd.theming improt ThemeManager
from kivy.app import App
class MyApp(App):
theme_cls = ThemeManager()
def build(self):
return MyWidget()
app = MyApp()
app.run()
请检查:https://gitlab.com/kivymd/KivyMD/blob/master/demos/kitchen_sink/main.py#L919
所有 kivymd 小部件都继承自 ThemableBehavior 类 - https://gitlab.com/kivymd/KivyMD/blob/master/kivymd/theming.py#L340