-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick_sum_gui.kv
78 lines (70 loc) · 2.08 KB
/
quick_sum_gui.kv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This is a Widget class rule
# it allows us to change the attributes all all Widgets!
# in this case, we make the background of all Widgets white
# and the text black
<Widget>:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
color: 0, 0, 0.7, 1
# this is a similar class rule, but for Buttons specifically
# background_down is the image used when the button is pressed
# notice that this is using canvas.after instead of canvas.before
# so the canvas changes are applies after the button attributes
<Button>:
# font_name: 'BuxtonSketch.ttf'
font_size: 56
background_normal: ''
background_down: 'atlas://data/images/defaulttheme/button'
canvas.after:
Color:
rgba: 0, 0, 0, 1
Line:
rectangle: self.x + 1, self.y + 1, self.width - 1, self.height - 1
BoxLayout:
orientation: 'vertical'
Label:
text: str(app.current_total)
size_hint_y: 0.15
font_size: 72
text_size: self.size
halign: 'right'
GridLayout:
id: digits
rows: 3
cols: 3
size_hint_y: 0.75
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
Button:
on_press: app._increment_total(self)
GridLayout:
rows: 1
cols: 2
size_hint_y: 0.1
Button:
size_hint_x: 0.66
text: 'other'
on_press: app._toggle_digits()
Button:
size_hint_x: 0.33
text: 'C'
on_press: app._clear_total()
# note: we set the encoding for this source code file to UTF-8