I'm working on a kivy application and I'd like to save checkbox state in json and display it when it runs. Unfortunately, when the starting value is True, and i click on a checkbox to turn it to False it does not change its appereance to unchecked despite displaying it correctly in a console with a print statement. When the starting value is False it works just fine.
python code:
class settings(Screen):
with open('settings.json') as f:
data = json.load(f)
skipbool=data['skiplogin']
def skiplogin_click(self, instance, value):
if value is True:
print("yes")
else:
print("no")
pass
kv code:
<settings>:
name: "screen_settings"
GridLayout:
cols: 2
rows: 1
Label:
text: 'skip'
CheckBox:
active: root.skipbool
on_active: root.skiplogin_click(self, self.active)
Aucun commentaire:
Enregistrer un commentaire