|
|
@ -5,12 +5,6 @@ from test_interaction import Jeux, vider_dans |
|
|
|
from Pile import Pile_chaine as Pile |
|
|
|
from File import File_chaine as File |
|
|
|
|
|
|
|
pique = "๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ" |
|
|
|
coeur = "๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ" |
|
|
|
carreau = "๐๐๐๐๐
๐๐๐๐๐๐๐๐๐" |
|
|
|
trefle = "๐๐๐๐๐๐๐๐๐๐๐๐๐๐" |
|
|
|
cartes = pique + coeur + carreau + trefle |
|
|
|
|
|
|
|
class Interface(tk.Frame): |
|
|
|
"""interface du jeu""" |
|
|
|
def __init__(self, master): |
|
|
@ -38,7 +32,7 @@ class Interface(tk.Frame): |
|
|
|
self.C = tk.Canvas(self.menu, bg="black",height=500, width=728, highlightthickness=0) |
|
|
|
self.C.grid(row=0) |
|
|
|
for i in range(50): |
|
|
|
self.C.create_text(randint(0,728),randint(0,500),fill="white",font="Times 20",text=choice(cartes)) |
|
|
|
self.C.create_text(randint(0,728),randint(0,500),fill="white",font="Times 20",text=choice("๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐")) |
|
|
|
|
|
|
|
titre = tk.Label(self.menu, text="Bataille",bg="black", fg="white",font=("eufm10", 42),anchor ="n") |
|
|
|
titre.grid(sticky="N", row=0, pady=(100, 0)) |
|
|
@ -56,7 +50,7 @@ class Interface(tk.Frame): |
|
|
|
"""affiche un fond aleatoire different""" |
|
|
|
self.C.delete("all") |
|
|
|
for i in range(50): |
|
|
|
self.C.create_text(randint(0,728),randint(0,500),fill="white",font="Times 20",text=choice(cartes)) |
|
|
|
self.C.create_text(randint(0,728),randint(0,500),fill="white",font="Times 20",text=choice("๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐")) |
|
|
|
|
|
|
|
def jouer(self): |
|
|
|
"""interface de jeu""" |
|
|
@ -65,7 +59,7 @@ class Interface(tk.Frame): |
|
|
|
self.jeu = tk.Frame() |
|
|
|
self.jeu.grid() |
|
|
|
|
|
|
|
jeu = Jeux(16) |
|
|
|
jeu = Jeux(6) |
|
|
|
(self.paquet_joueur, self.paquet_ordi) = jeu.distribue() |
|
|
|
self.mise_joueur = Pile() |
|
|
|
self.mise_ordi = Pile() |
|
|
@ -76,7 +70,7 @@ class Interface(tk.Frame): |
|
|
|
self.etat = tk.Label(self.jeu, text="",bg="white", fg="black",font=("arial", 20)) |
|
|
|
self.etat.grid(sticky="",row=0,column=0) |
|
|
|
|
|
|
|
self.canvas_joueur = tk.Canvas(self.frame_principale, bg="black",height=463, width=30, highlightthickness=0) |
|
|
|
self.canvas_joueur = tk.Canvas(self.frame_principale, bg="green",height=463, width=30, highlightthickness=0) |
|
|
|
self.canvas_joueur.grid(row=1,column=0) |
|
|
|
|
|
|
|
|
|
|
@ -111,7 +105,7 @@ class Interface(tk.Frame): |
|
|
|
self.carte_restantes2.grid(row=3, padx=(10, 10)) |
|
|
|
self.ordi.grid(row=1,column=3) |
|
|
|
|
|
|
|
self.canvas_ordi = tk.Canvas(self.frame_principale, bg="black",height=463, width=30, highlightthickness=0) |
|
|
|
self.canvas_ordi = tk.Canvas(self.frame_principale, bg="red",height=463, width=30, highlightthickness=0) |
|
|
|
self.canvas_ordi.grid(row=1,column=4) |
|
|
|
|
|
|
|
def affiche_top_carte(self): |
|
|
@ -127,16 +121,17 @@ class Interface(tk.Frame): |
|
|
|
|
|
|
|
def update_canvas(self,canvas, paquet): |
|
|
|
"""met ร jour les cartes affichรฉes du paquet""" |
|
|
|
#juste cartes `blank`seraient meilleures, non ? |
|
|
|
canvas.delete("all") |
|
|
|
tmp = File() |
|
|
|
i=0 |
|
|
|
while not paquet.est_vide(): |
|
|
|
tmp_valeur = paquet.defiler() |
|
|
|
tmp.enfiler(tmp_valeur) |
|
|
|
canvas.create_text(15,30*i-10,fill="white",font="Times 20",text=tmp_valeur) |
|
|
|
i+=1 |
|
|
|
while not tmp.est_vide(): |
|
|
|
paquet.enfiler(tmp.defiler()) |
|
|
|
|
|
|
|
for i in range(paquet.taille() - 1): |
|
|
|
lettre = canvas.create_text(13,433-10*i,fill="black",font="Times 30",text="๐ ") |
|
|
|
r=canvas.create_rectangle(canvas.bbox(lettre),fill="white") |
|
|
|
canvas.tag_lower(r,lettre) |
|
|
|
lettre = canvas.create_text(13,433-10*(paquet.taille()-1),fill="black",font="Times 30",text=paquet.tete()) |
|
|
|
r=canvas.create_rectangle(canvas.bbox(lettre),fill="white") |
|
|
|
canvas.tag_lower(r,lettre) |
|
|
|
|
|
|
|
|
|
|
|
def carte_suivante(self): |
|
|
|
"""mรฉthode principale : rรฉalise une manche""" |
|
|
|