-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdifficulty_selector.py
26 lines (20 loc) · 957 Bytes
/
difficulty_selector.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
import tkinter as tk
from helper_dict import Level
from tkmacosx import Button
class DifficultySelector(tk.Frame):
def __init__(self, parent, controller):
super().__init__(parent)
self.controller = controller
self.create_widgets()
def create_widgets(self):
label = tk.Label(self, text="Choose Difficulty Level")
label.pack(pady=20)
beginner_button = Button(self, text="Beginner", command=lambda: self.select_level(Level.BEGINNER))
beginner_button.pack(pady=5)
moderate_button = Button(self, text="Moderate", command=lambda: self.select_level(Level.MODERATE))
moderate_button.pack(pady=5)
difficult_button = Button(self, text="Difficult", command=lambda: self.select_level(Level.DIFFICULT))
difficult_button.pack(pady=5)
def select_level(self, level):
self.controller.initialize_game(level)
self.controller.show_frame('MinesweeperGame')