Skip to content
Snippets Groups Projects
Commit 78555284 authored by Minal Khatri's avatar Minal Khatri
Browse files

Track the number of questions

parent ba1d3fc3
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,7 @@ class QuizzerApp(App):
paused = BooleanProperty(False)
correct = BooleanProperty(False)
score = NumericProperty(0)
attempts = NumericProperty(0)
def build(self):
inspector.create_inspector(Window, self)
......@@ -111,6 +112,7 @@ class QuizzerApp(App):
self.correct = answer == question[2]
if self.correct:
self.score += 1
self.attempts +=1
Clock.schedule_once(lambda delta: self.unpause(), PAUSE_TIME)
def unpause(self):
......
......@@ -84,7 +84,11 @@ ScreenManager:
font_size: sp(24)
size_hint: (1, None)
size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
ProgressBar:
max: 5
value: app.attempts
size_hint: (1, None)
height: sp(8)
Label:
text: 'Do you know…'
font_size: sp(24)
......@@ -95,6 +99,7 @@ ScreenManager:
text_size: (self.width, None)
halign: 'center'
color: (0.0, 0.0, 0.75, 1.0) if not app.paused else ((0.0, 1.0, 0.0, 1.0) if app.correct else (0.5, 0.0, 0.0, 1.0))
GridLayout:
rows: 2
Button:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment