Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quizzer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
skhourshed2
Quizzer
Commits
c31990ea
Commit
c31990ea
authored
9 months ago
by
skhourshed2
Browse files
Options
Downloads
Patches
Plain Diff
Reset score and progress bar after answering 5 questions
parent
1e4d8ae4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+5
-1
5 additions, 1 deletion
main.py
quizzer.kv
+2
-0
2 additions, 0 deletions
quizzer.kv
with
7 additions
and
1 deletion
main.py
+
5
−
1
View file @
c31990ea
...
...
@@ -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.popup
import
Popup
GUI_QUESTIONS
=
[
...
...
@@ -108,13 +109,16 @@ class QuizzerApp(App):
self
.
reshuffle
()
def
answer
(
self
,
answer
):
self
.
questions_answered
+=
1
question
=
self
.
questions
[
-
1
]
if
len
(
self
.
questions
)
>
0
else
QuizzerApp
.
DEFAULT_QUESTION
self
.
paused
=
True
self
.
correct
=
answer
==
question
[
2
]
if
self
.
correct
:
self
.
score
+=
10
Clock
.
schedule_once
(
lambda
delta
:
self
.
unpause
(),
PAUSE_TIME
)
self
.
questions_answered
+=
1
if
self
.
questions_answered
==
5
:
self
.
score
=
0
self
.
questions_answered
=
0
def
unpause
(
self
):
self
.
paused
=
False
...
...
This diff is collapsed.
Click to expand it.
quizzer.kv
+
2
−
0
View file @
c31990ea
...
...
@@ -89,6 +89,8 @@ 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))
Label:
text: f'You answered {app.questions_answered} questions'
ProgressBar:
value: app.questions_answered
max: 5
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment