Reputation: 109
I 'm not sure why I am getting an attribute error in the following code when I try to access the 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 my .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 I am getting is "AttributeError: 'EllipseMaker' object has no attribute 'score'"
Upvotes: 2
Views: 2043
Reputation: 109
The issue was that I had another .kv file in which EllipseMaker was already defined, so the program kept referencing that EllipseMaker class instead.
Upvotes: 1