|
|
|
from tkinter import Tk, Label, Button
|
|
|
|
from PIL import Image, ImageTk
|
|
|
|
|
|
|
|
class Window(Tk):
|
|
|
|
|
|
|
|
def __init__(self, p1, p2):
|
|
|
|
"""Initialise la fenêtre et prends les deux joueurs en arguments"""
|
|
|
|
Tk.__init__(self)
|
|
|
|
|
|
|
|
self.title("Bataille")
|
|
|
|
self.minsize(1300, 600)
|
|
|
|
self.geometry("1300x600")
|
|
|
|
self.config(background="green")
|
|
|
|
|
|
|
|
self.build_window()
|
|
|
|
self.p1 = p1
|
|
|
|
self.p2 = p2
|
|
|
|
self.c1 = None
|
|
|
|
self.c2 = None
|
|
|
|
|
|
|
|
def build_window(self):
|
|
|
|
self.title = Label(text="Bataille", font=("Courrier", 32))
|
|
|
|
self.title.grid(row=1, column=1)
|
|
|
|
self.button = Button(self, text="Jouer") #, command=)
|
|
|
|
|
|
|
|
def show_cards(self):
|
|
|
|
if self.c1 is not None:
|
|
|
|
self.c1.destroy()
|
|
|
|
if self.c2 is not None:
|
|
|
|
self.c2.destroy()
|
|
|
|
self.c1 = Label(text=self.p1.derniere_carte, font=("Courrier", 48))
|
|
|
|
self.c2 = Label(text=self.p2.derniere_carte, font=("Courrier", 48))
|
|
|
|
self.c1.grid(row=2, column=0)
|
|
|
|
self.c2.grid(row=2, column=2)
|
|
|
|
|
|
|
|
def card_to_image(card):
|
|
|
|
r = range(56-card.valeur*4, 52-card.valeur*4 , -1)
|
|
|
|
for i in r:
|
|
|
|
print(i)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
card_to_image(Carte(2, 4))
|
|
|
|
#app = Window(None, None)
|
|
|
|
#app.show_cards()
|
|
|
|
#app.mainloop()
|