Skip to content
Snippets Groups Projects
Commit 519ffe31 authored by Ian Broyles's avatar Ian Broyles
Browse files

Added progress bar to keep track of how many questions the user has answered

parent fbd47fc1
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ from kivy.clock import Clock
from kivy.properties import BooleanProperty, ListProperty, NumericProperty
from kivy.modules import inspector
from kivy.core.window import Window
from kivy.uix.progressbar import ProgressBar
GUI_QUESTIONS = [
......@@ -74,6 +75,7 @@ class QuizzerApp(App):
questions = ListProperty([])
paused = BooleanProperty(False)
correct = BooleanProperty(False)
questions_answered = NumericProperty(0)
def build(self):
inspector.create_inspector(Window, self)
......@@ -108,6 +110,7 @@ class QuizzerApp(App):
question = self.questions[-1] if len(self.questions) > 0 else QuizzerApp.DEFAULT_QUESTION
self.paused = True
self.correct = answer == question[2]
self.questions_answered += 1
if self.correct:
self.user_score += 1
print(self.user_score)
......
......@@ -77,6 +77,9 @@ ScreenManager:
on_press:
root.transition.direction = 'right'
root.current = 'settings'
ProgressBar:
max: 5
value: app.questions_answered
BoxLayout:
orientation: 'horizontal'
Label:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment