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
thomaskmatthew
Quizzer
Compare revisions
main to main
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
thomaskmatthew/quizzer
Select target project
No results found
main
Select Git revision
Branches
main
1 result
Swap
Target
soft-core/soft-161-and-162/quizzer
Select target project
khatri.cs16/quizzer
cperez12/quizzer
thomaskmatthew/quizzer
rthomas19/quizzer
wnixon3/quizzer
soft-core/soft-161-and-162/quizzer
abdullah.hamad/quizzer
mgayed2/quizzer
malawadly2/quizzer
sabdelmoaty2/quizzer
emahmoud3/quizzer
tfrisinger2/quizzer
dbanks4/quizzer
skhourshed2/quizzer
kharrell4/quizzer
ghenderson10/quizzer
bmois2/quizzer
mshariff2/quizzer
jwollam3/quizzer
19 results
main
Select Git revision
Branches
main
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (8)
changed the group proporties of the checkbox
· b56b9a58
thomaskmatthew
authored
3 years ago
b56b9a58
Added score
· d245bb5a
thomaskmatthew
authored
3 years ago
d245bb5a
add a print statement everytime it is correct
· 786f9f60
thomaskmatthew
authored
3 years ago
786f9f60
print statment now keeps in track of the total score
· fdc45e19
thomaskmatthew
authored
3 years ago
fdc45e19
closes app after five questions are answer
· 2b2b7c14
thomaskmatthew
authored
3 years ago
2b2b7c14
App resets after five questions have been answered
· 4d7faa9e
thomaskmatthew
authored
3 years ago
4d7faa9e
fixed style errors and have progress bar update after ever question
· 4a1269df
thomaskmatthew
authored
3 years ago
4a1269df
The app updates score when a question is right
· 4d2a2971
thomaskmatthew
authored
3 years ago
4d2a2971
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+16
-1
16 additions, 1 deletion
main.py
quizzer.kv
+19
-3
19 additions, 3 deletions
quizzer.kv
with
35 additions
and
4 deletions
main.py
View file @
4d2a2971
...
...
@@ -2,7 +2,7 @@ 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
...
...
@@ -66,14 +66,18 @@ PAUSE_TIME = 0.75 # seconds
class
QuizzerApp
(
App
):
DEFAULT_QUESTION
=
(
'
What is your favorite color?
'
,
(
'
Blue
'
,
'
Blue
'
,
'
Blue
'
,
'
Blue
'
),
'
Blue
'
)
NUMBER_OF_QUESTION
=
5
include_gui_topic
=
BooleanProperty
(
True
)
include_color_topic
=
BooleanProperty
(
False
)
include_tree_topic
=
BooleanProperty
(
False
)
questions
=
ListProperty
([])
paused
=
BooleanProperty
(
False
)
correct
=
BooleanProperty
(
False
)
score
=
NumericProperty
(
0
)
progress
=
NumericProperty
(
0
)
def
build
(
self
):
inspector
.
create_inspector
(
Window
,
self
)
...
...
@@ -105,9 +109,17 @@ class QuizzerApp(App):
self
.
reshuffle
()
def
answer
(
self
,
answer
):
question
=
self
.
questions
[
-
1
]
if
len
(
self
.
questions
)
>
0
else
QuizzerApp
.
DEFAULT_QUESTION
self
.
paused
=
True
self
.
correct
=
answer
==
question
[
2
]
self
.
progress
+=
1
if
self
.
correct
:
self
.
score
+=
1
print
(
f
'
You got it correct, number of right are:
{
self
.
score
}
out of
{
QuizzerApp
.
NUMBER_OF_QUESTION
}
'
)
else
:
print
(
f
'
total number of questions:
{
self
.
score
}
out of
{
QuizzerApp
.
NUMBER_OF_QUESTION
}
'
)
Clock
.
schedule_once
(
lambda
delta
:
self
.
unpause
(),
PAUSE_TIME
)
def
unpause
(
self
):
...
...
@@ -116,6 +128,9 @@ class QuizzerApp(App):
self
.
questions
.
pop
()
if
len
(
self
.
questions
)
==
0
:
self
.
reshuffle
()
if
self
.
progress
==
QuizzerApp
.
NUMBER_OF_QUESTION
:
self
.
progress
=
0
self
.
score
=
0
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
quizzer.kv
View file @
4d2a2971
...
...
@@ -11,7 +11,6 @@ ScreenManager:
Widget:
CheckBox:
id: gui
group: 'categories'
active: app.include_gui_topic
size_hint: (None, None)
size: (sp(32), gui_label.height)
...
...
@@ -27,7 +26,7 @@ ScreenManager:
Widget:
CheckBox:
id: color
group: 'categories'
active: app.include_color_topic
size_hint: (None, None)
size: (sp(32), color_label.height)
...
...
@@ -43,7 +42,7 @@ ScreenManager:
Widget:
CheckBox:
id: tree
group: 'categories'
active: app.include_tree_topic
size_hint: (None, None)
size: (sp(32), tree_label.height)
...
...
@@ -68,8 +67,11 @@ ScreenManager:
size_hint: (1.0, 0.5)
Screen:
name: 'quiz'
BoxLayout:
orientation: 'vertical'
Button:
text: 'Change Topic'
size_hint: (1, 0.25)
...
...
@@ -77,6 +79,19 @@ ScreenManager:
on_press:
root.transition.direction = 'right'
root.current = 'settings'
ProgressBar:
value: app.progress
min: 0
max: app.NUMBER_OF_QUESTION
pos_hint: {'x': 0.1}
size_hint_x: 0.8
Label:
text: f'Score: {app.score}/5'
text_size: self.size
halign: 'right'
valign: 'middle'
Label:
text: 'Do you know…'
font_size: sp(24)
...
...
@@ -116,6 +131,7 @@ ScreenManager:
size: self.size
# All labels are blue.
<Label>:
color: (0.0, 0.0, 0.75, 1.0)
...
...
This diff is collapsed.
Click to expand it.