Select Git revision
Forked from
SOFT Core / SOFT 161 and 162 / Quizzer
4 commits behind the upstream repository.
Brady James Garvin authored
quizzer.kv 4.88 KiB
ScreenManager:
Screen:
name: 'settings'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Choose a topic:'
font_size: sp(24)
BoxLayout:
orientation: 'horizontal'
Widget:
CheckBox:
id: gui
group: 'categories'
active: True
size_hint: (None, None)
size: (sp(32), gui_label.height)
on_active: app.reshuffle()
Label:
id: gui_label
text: 'Graphical User Interfaces'
size_hint: (None, 1.0)
size: self.texture_size
Widget:
BoxLayout:
orientation: 'horizontal'
Widget:
CheckBox:
id: color
group: 'categories'
active: False
size_hint: (None, None)
size: (sp(32), color_label.height)
on_active: app.reshuffle()
Label:
id: color_label
text: 'RGBA Quadruples'
size_hint: (None, 1.0)
size: self.texture_size
Widget:
BoxLayout:
orientation: 'horizontal'
Widget:
CheckBox:
id: tree
group: 'categories'
active: False
size_hint: (None, None)
size: (sp(32), tree_label.height)
on_active: app.reshuffle()
Label:
id: tree_label
text: 'Containment Hierarchies'
size_hint: (None, 1.0)
size: self.texture_size
Widget:
BoxLayout:
Widget:
Button:
text: 'Begin!'
size_hint: (None, None)
size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
on_press:
root.transition.direction = 'left'
root.current = 'quiz'
Widget:
Widget:
size_hint: (1.0, 0.5)
Screen:
name: 'quiz'
BoxLayout:
orientation: 'vertical'
Button:
text: 'Change Topic'
size_hint: (1, 0.25)
disabled: app.paused
on_press:
root.transition.direction = 'right'
root.current = 'settings'
Label:
text: 'Do you know…'
font_size: sp(24)
size_hint: (1, None)
size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
Label:
text: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[0] if not app.paused else ('Correct!' if app.correct else 'Incorrect!')
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))
GridLayout:
rows: 2
Button:
text: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[1][0]
disabled: app.paused
on_press: app.answer(self.text)
Button:
text: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[1][1]
disabled: app.paused
on_press: app.answer(self.text)
Button:
text: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[1][2]
disabled: app.paused
on_press: app.answer(self.text)
Button:
text: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[1][3]
disabled: app.paused
on_press: app.answer(self.text)
# All screens are white.
<Screen>:
canvas.before:
Color:
rgba: (1.0, 1.0, 1.0, 1.0)
Rectangle:
pos: self.pos
size: self.size
# All labels are blue.
<Label>:
color: (0.0, 0.0, 0.75, 1.0)
# All checkboxes are blue.
<CheckBox>:
canvas:
Color:
rgba: (0.0, 0.0, 0.75, 1.0)
Rectangle:
source: f'atlas://data/images/defaulttheme/checkbox{"_radio" if self.group else ""}{"_disabled" if self.disabled else ""}{"_on" if self.active else "_off"}'
size: sp(32), sp(32)
pos: int(self.center_x - sp(16)), int(self.center_y - sp(16))
# All buttons have white text.
<Button>:
color: (1.0, 1.0, 1.0, 1.0)