-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayoutmain.kv
151 lines (130 loc) · 4.07 KB
/
layoutmain.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
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
#:kivy 2.1.0
# create a base Layout
MDScreen:
MDFloatLayout:
# MDTopAppBar:
# title: "App bar"
# create a header text
MDLabel:
id: header
font_size: "20sp"
color: "yellow"
text: "Tic Tac Toe"
halign: "center"
pos_hint: {"center_y": .95 }
MDLabel:
id: copyright
font_size: "14sp"
color: "yellow"
text: "2022 © by S3R43o3"
halign: "center"
pos_hint: {"center_y": .9 }
# create the gamefield
MDGridLayout:
id: gameField
size_hint: .75,.5
pos_hint: {'center_x': .5, 'center_y': .6}
cols: 3
rows: 3
opacity: 1
#create the buttons for X or O
Button:
id: btn1
text:''
font_size: "45sp"
background_color: "green"
on_release: app.presser(btn1)
elevation: 6
Button:
id: btn2
text:''
font_size: "45sp"
background_color: "green"
on_release: app.presser(btn2)
elevation: 6
Button:
id: btn3
text:''
font_size: "45sp"
background_color: "green"
on_release: app.presser(btn3)
elevation: 6
Button:
id: btn4
text:''
font_size: "45sp"
on_release: app.presser(btn4)
background_color: "green"
elevation: 6
Button:
id: btn5
text:''
font_size: "45sp"
on_release: app.presser(btn5)
background_color: "green"
elevation: 6
Button:
id: btn6
text:''
font_size: "45sp"
on_release: app.presser(btn6)
background_color: "green"
elevation: 6
Button:
id: btn7
text:''
font_size: "45sp"
on_release: app.presser(btn7)
background_color: "green"
elevation: 6
Button:
id: btn8
text:''
font_size: "45sp"
on_release: app.presser(btn8)
background_color: "green"
elevation: 6
Button:
id: btn9
text:''
font_size: "45sp"
on_release: app.presser(btn9)
background_color: "green"
elevation: 6
# create the score label
MDLabel:
id: score
font_size: "18sp"
text: "X goes first!"
halign: "center"
pos_hint: {"center_y": .25 }
MDBoxLayout:
orientation: 'horizontal'
adaptive_size: True
spacing: '3sp'
padding: ('3sp', '3sp', '3sp', '3sp')
pos_hint: {"center_x": .5}
MDRaisedButton:
id: restart
font_size: "12sp"
text: "Restart Game"
on_release: app.restart()
MDRaisedButton:
id: resetScore
font_size: "12sp"
text: "Reset Score"
#pos_hint: {'center_x': .65, 'center_y': .15}
on_release: app.reset_score()
MDRaisedButton:
id: exit
font_size: "12sp"
text: "Exit Game"
#pos_hint: {'center_x': .65, 'center_y': .15}
on_release: app.exit_game()
MDLabel:
id: game
font_size: "16sp"
color: "grey"
text: "X-Wins: 0 | O-Wins: 0"
halign: "center"
pos_hint: {"center_x": .5, "center_y": .325 }