-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc.kv
88 lines (83 loc) · 2.29 KB
/
calc.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
<Sign@Button>:
font_size: 24
<Num@Button>:
size_hint: (.25, 0.25)
background_color: (157/255, 157/255, 157/255, 1)
font_size: 20
<Calculator>:
BoxLayout:
orientation: "vertical"
size: root.width, root.height
TextInput:
id: input
multiline: False
text: "0"
font_size: 50
size_hint: (1, .15)
halign: "right"
GridLayout:
rows:5
cols: 4
Button:
text:"Clear"
font_size: 18
on_press: root.erase()
Sign:
text:"%"
on_press: root.operation('%')
Button:
text:"<<"
font_size: 18
on_press: root.clear()
Sign:
text:"/"
on_press: root.operation('/')
Num:
text:"7"
on_press: root.num(7)
Num:
text:"8"
on_press: root.num(8)
Num:
text:"9"
on_press: root.num(9)
Sign:
text:"x"
on_press: root.operation('*')
Num:
text:"4"
on_press: root.num(4)
Num:
text:"5"
on_press: root.num(5)
Num:
text:"6"
on_press: root.num(6)
Sign:
text:"-"
font_size: 28
on_press: root.operation('-')
Num:
text:"3"
on_press: root.num(3)
Num:
text:"2"
on_press: root.num(2)
Num:
text:"1"
on_press: root.num(1)
Sign:
text:"+"
on_press: root.operation('+')
Num:
text:"+/-"
on_press: root.operation('-')
Num:
text:"0"
on_press: root.num(0)
Num:
text:"."
on_press: root.put_decimal()
Sign:
text:"="
on_press: root.equal()