-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.kv
More file actions
177 lines (174 loc) · 3.86 KB
/
calc.kv
File metadata and controls
177 lines (174 loc) · 3.86 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#:import hex kivy.utils.get_color_from_hex
<RV>:
viewclass: 'Label'
RecycleBoxLayout:
default_size: None, dp(56)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
<Calculator>:
canvas.before:
Color:
rgba: hex('#CCDCDB')
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
orientation: 'vertical'
size_hint_x: .55
Label:
id: warning
canvas.before:
Color:
rgba: hex('#9FBFBE')
Rectangle:
size: self.size
pos: self.pos
size_hint_y: .1
color: 0,0,0,1
font_size: 20
BoxLayout:
size_hint_y: .15
Button:
id: last_operation_label
background_normal: ''
background_color: hex('#CCDCDB')
size_hint_x: .85
font_size: 25
text_size: self.size
halign: 'right'
color: 0,0,0,1
on_release: root.answer(self.text)
Label:
id: operator_label
color: 0,0,0,1
size_hint_x: .15
font_size: 25
text_size: self.size
halign: 'left'
FloatInput:
id: expresion_input
multiline: False
focus: True
font_size: 25
size_hint_y: .25
on_text_validate: root.equal()
GridLayout:
cols: 4
rows: 6
Button:
id: percent
text: '%'
on_release: root.percent()
Button:
id: clear_entry
text: 'CE'
on_release: root.erase(False)
Button:
id: clear
text: 'C'
on_release: root.erase(True)
Button:
id: delete
text: 'Del'
on_release: root.erase(False, False)
Button:
id: mult_inverse
text: '1/x'
on_release: root.multiplicative_inverse()
Button:
id: power_of_two
text: 'x^2'
on_release: root.power_of_two()
Button:
id: squared
text: 'x^(1/2)'
on_release: root.squared()
Button:
id: divide
text: '/'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: seven
text: '7'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: eight
text: '8'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: nine
text: '9'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: multiply
text: '*'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: four
text: '4'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: five
text: '5'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: six
text: '6'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: minus
text: '-'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: one
text: '1'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: two
text: '2'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: three
text: '3'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: add
text: '+'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: positive_negative
text: '+/-'
on_release: root.positive_negative()
Button:
id: zero
text: '0'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: decimal
text: '.'
on_release: root.ids.expresion_input.insert_text(self.text)
Button:
id: equal
text: '='
on_release: root.equal()
BoxLayout:
size_hint_x: .45
orientation: 'vertical'
canvas.before:
Color:
rgba: hex('#B5C6C5')
Rectangle:
size: self.size
pos: self.pos
Label:
size_hint_y: .1
text: 'History'
color: 0,0,0,1
RV:
id: rvs
Button:
text: 'Delete History'
size_hint_y: .1
on_release: root.delete_history()