python - Attribute Error Kivy -
i 'm not sure why getting attribute error in following code when try access instance's attribute score:
class ellipsemaker(widget): score = 10 class modules(gridlayout): moduleone = objectproperty(none) def on_touch_down(self,touch): print self.moduleone.score
in .kv doc:
<modules>: cols:1 moduleone: ellipseone ellipsemaker: id: ellipseone size: (root.width/4,root.height/4) pos: self.parent.center <ellipsemaker>: canvas: ellipse: pos:self.pos size:self.size
the error getting "attributeerror: 'ellipsemaker' object has no attribute 'score'"
the issue had .kv file in ellipsemaker defined, program kept referencing ellipsemaker class instead.
Comments
Post a Comment