Skip to content
Snippets Groups Projects
Commit c6598891 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Updated code for new Python 3 support in Kivy and improved code style.

parent eb03dd34
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ScreenManager: ...@@ -5,7 +5,7 @@ ScreenManager:
orientation: 'vertical' orientation: 'vertical'
Label: Label:
text: 'Choose a topic:' text: 'Choose a topic:'
font_size: '24sp' font_size: sp(24)
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
Widget: Widget:
...@@ -19,7 +19,7 @@ ScreenManager: ...@@ -19,7 +19,7 @@ ScreenManager:
Label: Label:
id: gui_label id: gui_label
text: 'Graphical User Interfaces' text: 'Graphical User Interfaces'
size_hint: (None, 1) size_hint: (None, 1.0)
size: self.texture_size size: self.texture_size
Widget: Widget:
BoxLayout: BoxLayout:
...@@ -35,7 +35,7 @@ ScreenManager: ...@@ -35,7 +35,7 @@ ScreenManager:
Label: Label:
id: color_label id: color_label
text: 'RGBA Quadruples' text: 'RGBA Quadruples'
size_hint: (None, 1) size_hint: (None, 1.0)
size: self.texture_size size: self.texture_size
Widget: Widget:
BoxLayout: BoxLayout:
...@@ -51,7 +51,7 @@ ScreenManager: ...@@ -51,7 +51,7 @@ ScreenManager:
Label: Label:
id: tree_label id: tree_label
text: 'Containment Hierarchies' text: 'Containment Hierarchies'
size_hint: (None, 1) size_hint: (None, 1.0)
size: self.texture_size size: self.texture_size
Widget: Widget:
BoxLayout: BoxLayout:
...@@ -65,7 +65,7 @@ ScreenManager: ...@@ -65,7 +65,7 @@ ScreenManager:
root.current = 'quiz' root.current = 'quiz'
Widget: Widget:
Widget: Widget:
size_hint: (1, 0.5) size_hint: (1.0, 0.5)
Screen: Screen:
name: 'quiz' name: 'quiz'
BoxLayout: BoxLayout:
...@@ -79,12 +79,12 @@ ScreenManager: ...@@ -79,12 +79,12 @@ ScreenManager:
root.current = 'settings' root.current = 'settings'
Label: Label:
text: 'Do you know…' text: 'Do you know…'
font_size: '24sp' font_size: sp(24)
size_hint: (1, None) size_hint: (1, None)
size: (self.texture_size[0] + 64, self.texture_size[1] + 64) size: (self.texture_size[0] + 64, self.texture_size[1] + 64)
Label: 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: (app.questions[-1] if len(app.questions) > 0 else app.DEFAULT_QUESTION)[0] if not app.paused else ('Correct!' if app.correct else 'Incorrect!')
color: (0, 0, 0.75, 1) if not app.paused else ((0, 1, 0, 1) if app.correct else (0.5, 0, 0, 1)) 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: GridLayout:
rows: 2 rows: 2
Button: Button:
...@@ -108,25 +108,25 @@ ScreenManager: ...@@ -108,25 +108,25 @@ ScreenManager:
<Screen>: <Screen>:
canvas.before: canvas.before:
Color: Color:
rgba: (1, 1, 1, 1) rgba: (1.0, 1.0, 1.0, 1.0)
Rectangle: Rectangle:
pos: self.pos pos: self.pos
size: self.size size: self.size
# All labels are blue. # All labels are blue.
<Label>: <Label>:
color: (0, 0, 0.75, 1) color: (0.0, 0.0, 0.75, 1.0)
# All checkboxes are blue. # All checkboxes are blue.
<CheckBox>: <CheckBox>:
canvas: canvas:
Color: Color:
rgba: (0, 0, 0.75, 1) rgba: (0.0, 0.0, 0.75, 1.0)
Rectangle: Rectangle:
source: 'atlas://data/images/defaulttheme/checkbox{radio}{disabled}{on}'.format(radio=('_radio' if self.group else ''), disabled=('_disabled' if self.disabled else ''), on=('_on' if self.active else '_off')) 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) size: sp(32), sp(32)
pos: int(self.center_x - sp(16)), int(self.center_y - sp(16)) pos: int(self.center_x - sp(16)), int(self.center_y - sp(16))
# All buttons have white text. # All buttons have white text.
<Button>: <Button>:
color: (1, 1, 1, 1) color: (1.0, 1.0, 1.0, 1.0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment