Skip to content
Snippets Groups Projects
Commit fef8fe47 authored by Austin Dobrusky's avatar Austin Dobrusky
Browse files

Added progress bar to keep track of total questions answered. Fixed problem...

Added progress bar to keep track of total questions answered. Fixed problem with score not being kept.
parent f57db6da
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,9 @@ from random import shuffle
from kivy.app import App
from kivy.clock import Clock
from kivy.properties import BooleanProperty, ListProperty
from kivy.properties import BooleanProperty, ListProperty, NumericProperty
from kivy.modules import inspector
from kivy.core.window import Window
from kivy.properties import NumericProperty
GUI_QUESTIONS = [
......@@ -76,6 +75,7 @@ class QuizzerApp(App):
paused = BooleanProperty(False)
correct = BooleanProperty(False)
score = NumericProperty(0)
total_answered = NumericProperty(0)
def build(self):
inspector.create_inspector(Window, self)
......@@ -112,7 +112,9 @@ class QuizzerApp(App):
self.correct = answer == question[2]
if self.correct:
self.score += 1
print(f'{self.score}')
self.total_answered += 1
print(f'{self.total_answered}')
Clock.schedule_once(lambda delta: self.unpause(), PAUSE_TIME)
def unpause(self):
......
......@@ -74,6 +74,11 @@ ScreenManager:
on_press:
root.transition.direction = 'right'
root.current = 'settings'
ProgressBar:
max: 5
value: app.total_answered
size_hint: 1, None
height: sp(10)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
......@@ -81,7 +86,7 @@ ScreenManager:
Label:
text: 'Current Score:'
Label:
text: f'{app.score}'
text: str(app.score)
Label:
text: 'Do you know…'
font_size: sp(24)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment