Skip to content

Commit

Permalink
Update Morpion.py
Browse files Browse the repository at this point in the history
  • Loading branch information
guguss-31 authored Aug 20, 2024
1 parent aef9629 commit db424b4
Showing 1 changed file with 96 additions and 94 deletions.
190 changes: 96 additions & 94 deletions Morpion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ def verifier():
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
elif grille[0]=="O" and grille[1]=="O" and grille[2]=="O" :
b1.configure(fg_color="green",hover_color="green")
b2.configure(fg_color="green",hover_color="green")
b3.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b2.configure(fg_color="green",hover_color="green")
b3.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
if grille[3] == "X" and grille[4] == "X" and grille[5] == "X" :
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
elif grille[3] == "O" and grille[4] == "O" and grille[5] == "O" :
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[6] == "X" and grille[7] == "X" and grille[8] == "X" :
b7.configure(fg_color="green",hover_color="green")
Expand All @@ -78,11 +78,11 @@ def verifier():
reinitialiser()

elif grille[0] == "O" and grille[3] == "O" and grille[6] == "O" :
b1.configure(fg_color="green",hover_color="green")
b4.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b4.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[1] == "X" and grille[4] == "X" and grille[7] == "X" :
b2.configure(fg_color="green",hover_color="green")
Expand All @@ -92,11 +92,11 @@ def verifier():
reinitialiser()

elif grille[1] == "O" and grille[4] == "O" and grille[7] == "O" :
b2.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b2.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[2] == "X" and grille[5] == "X" and grille[8] == "X" :
b3.configure(fg_color="green",hover_color="green")
Expand All @@ -106,11 +106,11 @@ def verifier():
reinitialiser()

elif grille[2] == "O" and grille[5] == "O" and grille[8] == "O" :
b3.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b3.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[0] == "X" and grille[4] == "X" and grille[8] == "X" :
b1.configure(fg_color="green",hover_color="green")
Expand All @@ -120,11 +120,11 @@ def verifier():
reinitialiser()

elif grille[0] == "O" and grille[4] == "O" and grille[8] == "O" :
b1.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[2] == "X" and grille[4] == "X" and grille[6] == "X" :
b3.configure(fg_color="green",hover_color="green")
Expand All @@ -134,11 +134,11 @@ def verifier():
reinitialiser()

elif grille[2] == "O" and grille[4] == "O" and grille[6] == "O" :
b3.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b3.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
else:
if grille[0]=="X" and grille[1]=="X" and grille[2]=="X" :
b1.configure(fg_color="green",hover_color="green")
Expand All @@ -147,23 +147,23 @@ def verifier():
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
elif grille[0]=="O" and grille[1]=="O" and grille[2]=="O" :
b1.configure(fg_color="green",hover_color="green")
b2.configure(fg_color="green",hover_color="green")
b3.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b2.configure(fg_color="green",hover_color="green")
b3.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
if grille[3] == "X" and grille[4] == "X" and grille[5] == "X" :
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
elif grille[3] == "O" and grille[4] == "O" and grille[5] == "O" :
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b4.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[6] == "X" and grille[7] == "X" and grille[8] == "X" :
b7.configure(fg_color="green",hover_color="green")
Expand All @@ -172,11 +172,11 @@ def verifier():
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse X à gagné !",icon="check", option_1="OK")
reinitialiser()
elif grille[6] == "O" and grille[7] == "O" and grille[8] == "O" :
b7.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b7.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[0] == "X" and grille[3] == "X" and grille[6] == "X" :
b1.configure(fg_color="green",hover_color="green")
Expand All @@ -186,11 +186,11 @@ def verifier():
reinitialiser()

elif grille[0] == "O" and grille[3] == "O" and grille[6] == "O" :
b1.configure(fg_color="green",hover_color="green")
b4.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b4.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[1] == "X" and grille[4] == "X" and grille[7] == "X" :
b2.configure(fg_color="green",hover_color="green")
Expand All @@ -200,11 +200,11 @@ def verifier():
reinitialiser()

elif grille[1] == "O" and grille[4] == "O" and grille[7] == "O" :
b2.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b2.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b8.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[2] == "X" and grille[5] == "X" and grille[8] == "X" :
b3.configure(fg_color="green",hover_color="green")
Expand All @@ -214,11 +214,11 @@ def verifier():
reinitialiser()

elif grille[2] == "O" and grille[5] == "O" and grille[8] == "O" :
b3.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b3.configure(fg_color="green",hover_color="green")
b6.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[0] == "X" and grille[4] == "X" and grille[8] == "X" :
b1.configure(fg_color="green",hover_color="green")
Expand All @@ -228,11 +228,11 @@ def verifier():
reinitialiser()

elif grille[0] == "O" and grille[4] == "O" and grille[8] == "O" :
b1.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b1.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b9.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if grille[2] == "X" and grille[4] == "X" and grille[6] == "X" :
b3.configure(fg_color="green",hover_color="green")
Expand All @@ -242,11 +242,13 @@ def verifier():
reinitialiser()

elif grille[2] == "O" and grille[4] == "O" and grille[6] == "O" :
b3.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()
b3.configure(fg_color="green",hover_color="green")
b5.configure(fg_color="green",hover_color="green")
b7.configure(fg_color="green",hover_color="green")
CTkMessagebox(title="Winer !",message="Le/la Joueur/joueuse O à gagné !",icon="check", option_1="OK")
reinitialiser()

if 1 not in grille and 2 not in grille and 3 not in grille and 4 not in grille and 5 not in grille and 6 not in grille and 7 not in grille and 8 not in grille and 9 not in grille and "X" in grille and "O" in grille :
CTkMessagebox(title="Winer !",message="Pas de gagnant-e , match nul !",icon="check", option_1="OK")
reinitialiser()

Expand All @@ -267,39 +269,39 @@ def c9(bouton,tableau,chiffre):
frame2=ct.CTkFrame(morpion,fg_color="transparent")
frame2.grid(pady=10,padx=10,column=0,row=0)

b1=ct.CTkButton(frame1,text=grille[0],width=100,height=100,fg_color="white",hover_color="white")
b1=ct.CTkButton(frame1,text=grille[0],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b1.grid(row=0,column=0)
b1.bind("<Button-1>",lambda event:c9(b1,0,1))

b2=ct.CTkButton(frame1,text=grille[1],width=100,height=100,fg_color="white",hover_color="white")
b2=ct.CTkButton(frame1,text=grille[1],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b2.grid(row=0,column=1)
b2.bind("<Button-1>",lambda event:c9(b2,1,2))

b3=ct.CTkButton(frame1,text=grille[2],width=100,height=100,fg_color="white",hover_color="white")
b3=ct.CTkButton(frame1,text=grille[2],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b3.grid(row=0,column=2)
b3.bind("<Button-1>",lambda event:c9(b3,2,3))

b4=ct.CTkButton(frame1,text=grille[3],width=100,height=100,fg_color="white",hover_color="white")
b4=ct.CTkButton(frame1,text=grille[3],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b4.grid(row=1,column=0)
b4.bind("<Button-1>",lambda event:c9(b4,3,4))

b5=ct.CTkButton(frame1,text=grille[4],width=100,height=100,fg_color="white",hover_color="white")
b5=ct.CTkButton(frame1,text=grille[4],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b5.grid(row=1,column=1)
b5.bind("<Button-1>",lambda event:c9(b5,4,5))

b6=ct.CTkButton(frame1,text=grille[5],width=100,height=100,fg_color="white",hover_color="white")
b6=ct.CTkButton(frame1,text=grille[5],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b6.grid(row=1,column=2)
b6.bind("<Button-1>",lambda event:c9(b6,5,6))

b7=ct.CTkButton(frame1,text=grille[6],width=100,height=100,fg_color="white",hover_color="white")
b7=ct.CTkButton(frame1,text=grille[6],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b7.grid(row=2,column=0)
b7.bind("<Button-1>",lambda event:c9(b7,6,7))

b8=ct.CTkButton(frame1,text=grille[7],width=100,height=100,fg_color="white",hover_color="white")
b8=ct.CTkButton(frame1,text=grille[7],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b8.grid(row=2,column=1)
b8.bind("<Button-1>",lambda event:c9(b8,7,8))

b9=ct.CTkButton(frame1,text=grille[8],width=100,height=100,fg_color="white",hover_color="white")
b9=ct.CTkButton(frame1,text=grille[8],width=100,height=100,fg_color="white",hover_color="white",border_color="#000000",border_width=2,corner_radius=21)
b9.grid(row=2,column=2)
b9.bind("<Button-1>",lambda event:c9(b9,8,9))

Expand Down

0 comments on commit db424b4

Please sign in to comment.