-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.kv
110 lines (97 loc) · 2.36 KB
/
calculator.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<Style1@Button>:
font_size: 100
background_color: rgba('#254A95')
color: rgba('#ffffff')
<Style2@Button>:
font_size: 100
background_color: [1, 0, 0, 1]
color: [1, 1, 1, 1]
<Style3@Button>:
font_size: 100
background_color: [0, 0, 0, 0]
color: [1, 1, 1, 1]
<Style4@Button>:
font_size: 100
background_color: rgba('#FF53AA')
color: [1, 1, 1, 1]
<CalcGridLayout>:
id: calculator
display: entry
rows: 10
padding: 10
spacing: 10
BoxLayout:
TextInput:
id: entry
font_size: 100
multiline: False
BoxLayout:
spacing: 10
Style4:
text: "C"
on_press: entry.text = ""
Style4:
text: "DEL"
on_press: calculator.delete(entry.text)
Style4:
text: "%"
on_press: entry.text += self.text
Style3:
text: "Exit"
on_press: calculator.stop()
BoxLayout:
spacing: 10
Style1:
text: "7"
on_press: entry.text += self.text
Style1:
text: "8"
on_press: entry.text += self.text
Style1:
text: "9"
on_press: entry.text += self.text
Style2:
text: "/"
on_press: entry.text += self.text
BoxLayout:
spacing: 10
Style1:
text: "4"
on_press: entry.text += self.text
Style1:
text: "5"
on_press: entry.text += self.text
Style1:
text: "6"
on_press: entry.text += self.text
Style2:
text: "*"
on_press: entry.text += self.text
BoxLayout:
spacing: 10
Style1:
text: "1"
on_press: entry.text += self.text
Style1:
text: "2"
on_press: entry.text += self.text
Style1:
text: "3"
on_press: entry.text += self.text
Style2:
text: "-"
on_press: entry.text += self.text
BoxLayout:
spacing: 10
Style1:
text: '0'
on_press: entry.text += self.text
Style1:
text: '.'
on_press: entry.text += self.text
Style3:
text: '='
on_press: calculator.calculate(entry.text)
Style2:
text: '+'
on_press: entry.text += self.text