-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.kv
110 lines (89 loc) · 1.84 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
CalculatorDisplay:
<CustBoxLayout@BoxLayout>:
spacing: 10
<CustButton@Button>:
font_size: 32
<CalculatorDisplay>:
display: text_entry
rows: 6
padding: 10
spacing: 10
BoxLayout:
height: "40dp"
TextInput:
id: text_entry
multline: False
font_size: 32
CustBoxLayout:
CustButton:
text: "7"
size_hint_x: 1
on_press: text_entry.text += self.text
CustButton:
text: "8"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "9"
on_press: text_entry.text += self.text
size_hint_x:1
CustButton:
text: "+"
size_hint_x:1
on_press: text_entry.text += self.text
CustBoxLayout:
CustButton:
text: "4"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "5"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "6"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "-"
size_hint_x: 1
on_press: text_entry.text += self.text
CustBoxLayout:
CustButton:
text: "3"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "2"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "1"
on_press: text_entry.text += self.text
size_hint_x: 1
CustButton:
text: "/"
on_press: text_entry.text += self.text
size_hint_x:1
CustBoxLayout:
CustButton:
text: "clr"
size_hint_x:1
on_press: text_entry.text = ""
CustButton:
text: "."
on_press: text_entry.text += self.text
size_hint_x:1
CustButton:
text: "0"
on_press: text_entry.text += self.text
size_hint_x:1
CustButton:
text: "*"
on_press: text_entry.text += self.text
size_hint_x: 1
BoxLayout:
Button:
text: "="
on_press: root.calculate(text_entry.text)
font_size: 40