-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
70 lines (60 loc) · 1.49 KB
/
main.py
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
from tkinter import *
from cell import Cell
import settings
import utils
root = Tk()
#override the settings of the window
root.configure(bg="black")
root.geometry(f'{settings.WIDTH}x{settings.HEIGHT}')
root.title("Minesweeper Game")
root.resizable(False, False)
top_frame = Frame(
root,
bg='black', #change to black
width=settings.WIDTH,
height=utils.height_prct(25)
)
top_frame.place(x=0, y=0)
game_title = Label(
top_frame,
bg="black",
fg="white",
text="Minesweeper Game",
font=("", 48)
)
game_title.place(
x=utils.width_prct(20),
y=utils.height_prct(5)
)
left_frame = Frame(
root,
bg="black", #change to black
width=utils.width_prct(25),
height=utils.height_prct(75)
)
left_frame.place(x=0, y=utils.height_prct(25))
center_frame = Frame(
root,
bg="black", #change to black
width=utils.width_prct(75),
height=utils.height_prct(75)
)
center_frame.place(
x=utils.width_prct(25),
y=utils.height_prct(25)
)
#an instance of class "Cell" is called to create the object
for x in range(settings.GRID_SIZE):
for y in range(settings.GRID_SIZE):
c = Cell(x, y)
c.create_btn_object(center_frame)
c.cell_btn_object.grid(
column=x,
row=y
)
#Call the lable form the Cell class
Cell.crete_cell_count_label(left_frame)
Cell.cell_count_label_object.place(x=0, y=0)
Cell.randomize_mines()
# Run the window
root.mainloop()