From a91f9dd9c1bc49d7c8ccdcb3530a2c6c60da593c Mon Sep 17 00:00:00 2001
From: okreikemeier2 <okreikemeier2@huskers.unl.edu>
Date: Fri, 19 Jul 2024 12:44:57 -0500
Subject: [PATCH] Added a progress bar that is linked to the numbers of
 questions answered. Added code that links the question number displayed with
 the number of questions answered so it increases with each question.

---
 main.py    |  2 ++
 quizzer.kv | 13 ++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/main.py b/main.py
index 6bd4bba..3836c4f 100644
--- a/main.py
+++ b/main.py
@@ -77,6 +77,7 @@ class QuizzerApp(App):
     correct = BooleanProperty(False)
 
     score = NumericProperty(0)
+    num_answered = NumericProperty(0)
 
     def build(self):
         inspector.create_inspector(Window, self)
@@ -118,6 +119,7 @@ class QuizzerApp(App):
         self.paused = False
         if self.correct == True:
             app.score+=100
+        self.num_answered += 1
         if len(self.questions) > 0:
             self.questions.pop()
         if len(self.questions) == 0:
diff --git a/quizzer.kv b/quizzer.kv
index 7187e9d..df8476c 100644
--- a/quizzer.kv
+++ b/quizzer.kv
@@ -78,13 +78,20 @@ ScreenManager:
                     root.transition.direction = 'right'
                     root.current = 'settings'
             Label:
-                text: 'Do you know…'
+                text: f'Question {app.num_answered+1}'
                 font_size: sp(24)
-                size_hint: (1, None)
+                size_hint: (1, 1)
                 size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
+            ProgressBar:
+                id: progress_bar
+                min :0
+                max: 5
+                value: app.num_answered
+                pos_hint:{'x':.1}
+                size_hint_x: .8
             Label:
                 text: f'Score: {app.score}'
-                font_size: sp(24)
+                font_size: sp(16)
                 size_hint: (1, None)
                 size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
             Label:
-- 
GitLab