right now i try to learn a little bit of python and kivy.
i have a small problem of how to get the value of a CheckBox (True or False) in another Class. Within the class its not a problem: Python Code:
class hauptmenue(Screen, Widget):
pruefung = ObjectProperty(None)
grundlagen = ObjectProperty(None)
def checkbox_clicked_1(self, instance, value):
if self.pruefung.active == True:
self.grundlagen.active = True
if value is True:
[...]
This works just fine. I the kv. Code I did that:
GridLayout:
cols:4
size_hint_y: 0.1
NeuLabel:
text: "Grundlagen"
NeuCheckBox:
id: grundlagen
on_active: root.checkbox_clicked_1(self, self.active)
now for the Problem: how to get hat value (True/false) in the other class?
class Auswertung_Ende(Screen):
def on_enter(self):
if hauptmenue.pruefung.active == True:
print("Hello")
The error ist: AttributeError: 'kivy.properties.ObjectProperty' object has no attribute 'active'
Why does it work in the same class but not in another? I just want to get the value (True/False) of the CheckBox from another class (here:Screen). That's all... I am sorry if this question is on a very low level. I am still learning :)
Many thanks!
Aucun commentaire:
Enregistrer un commentaire