Skip to content
Snippets Groups Projects
Commit a9490ed0 authored by abdullah.hamad's avatar abdullah.hamad
Browse files

Created constant for the number of quiz questions. In unpause method, added...

Created constant for the number of quiz questions. In unpause method, added statement to reset score and progress after the number of questions.
parent 7782762f
No related branches found
No related tags found
No related merge requests found
from random import shuffle from random import shuffle
from kivy.app import App from kivy.app import App
from kivy.clock import Clock from kivy.clock import Clock
from kivy.properties import BooleanProperty, ListProperty from kivy.properties import BooleanProperty, ListProperty
from kivy.modules import inspector from kivy.modules import inspector
from kivy.core.window import Window from kivy.core.window import Window
from kivy.properties import NumericProperty from kivy.properties import NumericProperty
from time import sleep
GUI_QUESTIONS = [ GUI_QUESTIONS = [
...@@ -63,6 +63,7 @@ TREE_QUESTIONS = [ ...@@ -63,6 +63,7 @@ TREE_QUESTIONS = [
PAUSE_TIME = 0.75 # seconds PAUSE_TIME = 0.75 # seconds
QUESTIONS_QUIZ = 5 # Number of quiz questions
class QuizzerApp(App): class QuizzerApp(App):
...@@ -101,7 +102,11 @@ class QuizzerApp(App): ...@@ -101,7 +102,11 @@ class QuizzerApp(App):
self.number_questions += 1 self.number_questions += 1
Clock.schedule_once(lambda delta: self.unpause(), PAUSE_TIME) Clock.schedule_once(lambda delta: self.unpause(), PAUSE_TIME)
def unpause(self): def unpause(self):
if self.number_questions > QUESTIONS_QUIZ - 1:
self.number_questions = 0
self.score = 0
self.paused = False self.paused = False
if len(self.questions) > 0: if len(self.questions) > 0:
self.questions.pop() self.questions.pop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment