forked from kate-somi/python-memory-game
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro.py
More file actions
102 lines (95 loc) · 2.74 KB
/
intro.py
File metadata and controls
102 lines (95 loc) · 2.74 KB
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
"""
File: Final.py
----------------
"""
from tkinter import *
def choose_mode():
chosen_mode = []
intro_root = Tk()
intro_root.title("Règles")
intro_root.geometry("+300+100")
intro_root.resizable(0, 0)
intro_root.bind("<Escape>", lambda event: exit())
# TODO: Finir de traduire les règles
rules = Label(
text="""
1. Cliquer sur deux cartes pour les retourner.
2. Si les deux cartes sont identiques, elle resteront face visibles.
3. Sinon elles seront masquées.
4. Le jeu se termine lorsque toutes les cartes sont visibles.
5. Une nouvelle partie démarre automatiquement.
6. Appuyez sur ENTER pour changer de mode.
7. Appuyez sur ESCAPE pour sortie.
""",
width="60",
bg="misty rose",
)
rules.pack(side=TOP)
colored_mode = Button(
text="MODE COLORÉ",
width="29",
height="5",
bg="rosy brown",
command=lambda mode=1, route="images/CodeInPlace/pic": clicked(
mode, route, intro_root, chosen_mode
),
)
colored_mode.pack(side=LEFT)
colorblind_mode = Button(
text="MODE DALTONIEN",
width="29",
height="5",
bg="rosy brown",
command=lambda mode=2, route="images/RustyLake/pic": clicked(
mode, route, intro_root, chosen_mode
),
)
colorblind_mode.pack(side=LEFT)
intro_root.mainloop()
return chosen_mode
def clicked(first_value, second_value, root, info_list):
info_list.append(first_value)
info_list.append(second_value)
root.destroy()
def choose_level():
chosen_level = []
level_root = Tk()
level_root.title("Niveau")
level_root.geometry("+200+100")
level_root.resizable(0, 0)
level_root.bind("<Escape>", lambda event: exit())
lvl0 = Button(
text="TRÈS FACILE",
width="15",
height="5",
bg="alice blue",
command=lambda rows=2, cols=2: clicked(rows, cols, level_root, chosen_level),
)
lvl0.pack(side=LEFT)
lvl1 = Button(
text="FACILE",
width="15",
height="5",
bg="alice blue",
command=lambda rows=3, cols=4: clicked(rows, cols, level_root, chosen_level),
)
lvl1.pack(side=LEFT)
lvl2 = Button(
text="MOYEN",
width="15",
height="5",
bg="lavender blush",
command=lambda rows=4, cols=6: clicked(rows, cols, level_root, chosen_level),
)
lvl2.pack(side=LEFT)
# TODO: Ajouter un mode très difficile
# lvl3 = Button(
# text="DIFFICILE",
# width="15",
# height="5",
# bg="lavender",
# command=lambda rows=5, cols=8: clicked(rows, cols, level_root, chosen_level),
# )
# lvl3.pack(side=LEFT)
level_root.mainloop()
return chosen_level