【发布时间】:2021-10-26 06:23:19
【问题描述】:
我收到一个错误:
属性错误:当我尝试使用它们各自的 ID 切换到另一个屏幕时,“kivy.properties.ObjectProperty”对象没有属性“manager1”。
这是我的代码:
Python 文件:
- 在
First_Screen()类中
My2App.first.manager1.current = "start" #"start" is the name of First_Screen()
- 这是我的
My2App课程
class My2App(MDApp):
manager1 = ObjectProperty(None)
first = ObjectProperty(None)
second = ObjectProperty(None)
def build(self):
self.bd = Builder.load_file("My.kv")
return self.bd
kv 文件:
ScreenManager:
manager1:manager1
id:manager1
First_Screen:
first:first
id:first
Show_Title:
second:second
id:second
<First_Screen>:
name:'start'
# rest of the content.....
我不明白缺少什么。
感谢您提前帮助我。
【问题讨论】: