Skip to content

Commit b32827e

Browse files
authored
Merge pull request #5 from abdallah1097/add-go-back-button
Add Back button on the select difficulty screen
2 parents b010d26 + 8c2c852 commit b32827e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

minesweeper/game/Game.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __home_screen(self):
5050
def __on_new_game(self):
5151
self.frame.destroy()
5252
self.frame = tk.Frame(self.window)
53-
Screens.sel_difficulty_scr(self.frame, self.__start_game)
53+
Screens.sel_difficulty_scr(self.frame, self.__start_game, self.__home_screen)
5454

5555
def __on_continue(self):
5656
self.__start_game(is_continue=True)

minesweeper/game/Screens.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def button(text, command):
2626
master.pack(fill=tk.NONE, expand=True)
2727

2828
@staticmethod
29-
def sel_difficulty_scr(master, on_select):
29+
def sel_difficulty_scr(master, on_select, on_back):
3030
def button(text, command):
3131
return tk.Button(master, text=text, command=command, width=20)
3232

@@ -39,4 +39,9 @@ def button(text, command):
3939
btn_h = button(DifficultyLevel.HARD.value, lambda: on_select(DifficultyLevel.HARD))
4040
btn_h.pack()
4141

42+
tk.Frame(master, height=10).pack()
43+
44+
btn_back = button("Повернутися до меню", on_back)
45+
btn_back.pack()
46+
4247
master.pack(fill=tk.NONE, expand=True)

0 commit comments

Comments
 (0)