【发布时间】:2018-08-25 13:35:52
【问题描述】:
这是导致问题的 .py 端的代码摘录:
class ScreenMath(Screen):
def __init__(self,**kwargs):
super(ScreenMath,self).__init__(**kwargs)
self.ids.anchmath.ids.grdmath.ids.score.text = str("Score:" + "3")
还有 .kv 方面:
<ScreenMath>:
AnchorLayout:
id: "anchmath"
...
GridLayout:
id: "grdmath"
...
Button:
id: "score"
当我运行代码时,出现 AttributeError :
File "kivy\properties.pyx", line 841, in kivy.properties.ObservableDict.__getattr__
AttributeError: 'super' object has no attribute '__getattr__'
如您所见,我想在屏幕启动时更改值的文本(3 稍后将成为变量),但也许有更好的方法来做到这一点。
【问题讨论】:
标签: python kivy super attributeerror kivy-language