-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (37 loc) · 1.25 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
from tkinter import *
from cell import Cell
import settings
import utils
root = Tk()
root.configure(bg=settings.COLOR)
# Change the settings of the window
root.geometry(f'{settings.WIDTH}x{settings.HEIGHT}')
root.title("Minesweeper")
root.resizable(False, False)
top_frame = Frame(root,
bg=settings.COLOR, # Change later
width=settings.WIDTH,
height=utils.height_pct(25))
top_frame.place(x=0, y=0) # Set starting point according to pixels
left_frame = Frame(root,
bg=settings.COLOR, # Change later
width=utils.width_pct(25),
height=utils.height_pct(75)
)
left_frame.place(x=0, y=utils.height_pct(25))
center_frame = Frame(root,
bg=settings.COLOR,
width=utils.width_pct(75),
height=utils.height_pct(75)
)
center_frame.place(
x=utils.width_pct(25),
y=utils.height_pct(25))
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)
Cell.randomize_mines()
# Run the window
root.mainloop() # Open until x is clicked