I want to be able to get the value of "delta" in multiple json dictionaries. I'm using JsonStore from kivy if that changes anything. When I press the button that starts the check_streak function I get NameError: name 'delta' is not defined. Here is the code:
class MainApp(App):
def build(self): # build() returns an instance
self.store = JsonStore("streak.json") # file that stores the streaks:
return presentation
def check_streak(self, instance):
for item in self.store.find(delta):
if delta > time.time():
print("early")
if delta == time.time():
print("on time")
if delta < time.time():
print("late")
Here is the json dictionary in a seperate file:
{"first": {"action": "first", "action_num": "1", "seconds": 60, "score": 0, "delta": 1555714261.0438898}, "second": {"action": "second", "action_num": "2", "seconds": 120, "score": 0, "delta": 1555879741.894656}}
I want to be able to get the value of "delta" from every object put inside the file. How would I do this?