diff --git a/Projetbataille0.py b/Projetbataille0.py index 61994c7..a6e9fe0 100644 --- a/Projetbataille0.py +++ b/Projetbataille0.py @@ -1,11 +1,16 @@ import tkinter as tk +import time +from random import shuffle from File import File_chaine as File +#______________________________________ class Carte: def __init__(self, valeur, couleur): self.valeur = valeur self.couleur = couleur + #________ + def compare(self, other): if self.valeur > other.valeur: return 1 @@ -13,7 +18,41 @@ class Carte: return -1 return 0 +#__________ +class Jeux: + def __init__(self): + self.paquet = [] + couleurs = ["Coeurs", "Carreaux", "Trèfles", "Piques"] + if nb_cartes == 32: + valeurs = ["1", "7", "8", "9", "10", "Valet", "Dame", "Roi", "As"] + elif nb_cartes == 52: + valeurs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Valet", "Dame", "Roi", "As"] + else: + print("Nombre de cartes invalide") + time.sleep(0.5) + raise ValueError + + + for couleur in couleurs: + for valeur in valeurs: + paquet = [Carte(valeur, couleur)] + shuffle(paquet) + + for carte in paquet: + print(carte) + + + + #________ + + def distribute(self): + f1 = File_lst() + f2 = File_lst() + f1 = len(self.paquet)//2 + f2 = reversed.len(self.paquet)//2 + + return f1, f2 -class jeux(paquet, ): - def __init__(self, nb_cartes, coleur): - pass \ No newline at end of file +#______________________________________ +nb_cartes = 32 #52 +Jeux() diff --git a/interface.py b/interface.py index f5c2f49..60f1094 100644 --- a/interface.py +++ b/interface.py @@ -12,25 +12,26 @@ class Interface(tk.Frame): self.grid(row=0) #revoir le design self.menu = tk.Frame() - self.menu.grid(row=0) title = tk.Label(self.menu, text="Bataille",font=("eufm10", 42)) title.grid(row=0) #image ne fonctionne pas - #canvas = tk.Canvas(self, width = 300, height = 300) - #canvas.grid(row=0) - #img = tk.PhotoImage(file="title_img.png") - #canvas.create_image(20,20, anchor='nw', image=img) + canvas= tk.Canvas(self.menu, width= 300, height=300) + image = tk.PhotoImage(file='title_img.gif') + canvas.create_image(50, 10, image=image) + canvas.grid(row=2) + jouer_btn = tk.Button(self.menu, text ="Jouer", command=self.jouer) jouer_btn.grid(row=1,pady=(30, 0)) + self.menu.grid(row=0) def jouer(self): """interface du jeu""" self.clearFrame(self.menu) - msg=messagebox.showinfo("JEU", "Jeu.") + messagebox.showinfo("JEU", "Jeu.") def clearFrame(self, frame):