为什么 kivy.Builder.load_file() 无法加载屏幕?

Why does kivy.Builder.load_file() fail to load screens?

我正在试验用于应用程序开发的屏幕管理器。我尝试使用builder的load file功能,但是在screen manager中添加screen失败

我的代码是这样的

# filename: manager.py
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen

class Home(Screen):
    pass

class Settings(Screen):
    pass

class Manager(ScreenManager):
    pass
 
class MngrApp(App):
    def build(self):
        return Builder.load_file("manager.kv")

if __name__ == '__main__':
    MngrApp().run()
# filename: manager.kv
Manager:
    Home:
    Settings:

<Home>:
    BoxLayout:
        Button:
            text: 'Goto settings'
            on_press: root.current = 'settings'
        Button:
            text: 'Quit'

<Settings>:
    BoxLayout:
        Button:
            text: 'My settings button'
        Button:
            text: 'Back to menu'
            on_press: root.current = 'home'

我的输出是

 kivy.uix.screenmanager.ScreenManagerException: ScreenManager accepts only Screen widget.

我想知道我是否需要重新格式化某些东西?也许只是重新开始?我不能

问题是已经有一个 kivy Settings class。只需将 class 的名称从 Settings 更改为其他名称即可。