|
@ -1,4 +1,4 @@ |
|
|
from tkinter import Tk, Label, Button |
|
|
from tkinter import Tk, Label, Button, PhotoImage, Canvas, NW |
|
|
from PIL import Image, ImageTk |
|
|
from PIL import Image, ImageTk |
|
|
|
|
|
|
|
|
class Window(Tk): |
|
|
class Window(Tk): |
|
@ -28,15 +28,23 @@ class Window(Tk): |
|
|
self.c1.destroy() |
|
|
self.c1.destroy() |
|
|
if self.c2 is not None: |
|
|
if self.c2 is not None: |
|
|
self.c2.destroy() |
|
|
self.c2.destroy() |
|
|
self.c1 = Label(text=self.p1.derniere_carte, font=("Courrier", 48)) |
|
|
#self.c1 = Label(text=self.p1.derniere_carte, font=("Courrier", 48)) |
|
|
self.c2 = Label(text=self.p2.derniere_carte, font=("Courrier", 48)) |
|
|
#self.c2 = Label(text=self.p2.derniere_carte, font=("Courrier", 48)) |
|
|
|
|
|
img1 = ImageTk.PhotoImage(card_to_image(self.p1.derniere_carte)) |
|
|
|
|
|
self.c1 = Label(self, image=img1) |
|
|
|
|
|
self.c1.photo = img1 |
|
|
|
|
|
|
|
|
|
|
|
img2 = ImageTk.PhotoImage(card_to_image(self.p2.derniere_carte)) |
|
|
|
|
|
self.c2 = Label(image=img2) |
|
|
|
|
|
self.c2.photo = img2 |
|
|
self.c1.grid(row=2, column=0) |
|
|
self.c1.grid(row=2, column=0) |
|
|
self.c2.grid(row=2, column=2) |
|
|
self.c2.grid(row=2, column=2) |
|
|
|
|
|
|
|
|
def card_to_image(card): |
|
|
def card_to_image(card): |
|
|
r = range(56-card.valeur*4, 52-card.valeur*4 , -1) |
|
|
card_names = list(range(56-card.valeur*4, 52-card.valeur*4 , -1)) |
|
|
for i in r: |
|
|
image = Image.open("./img/"+str(card_names[card.couleur])+".png") |
|
|
print(i) |
|
|
print(str(card_names[card.couleur])+".png") |
|
|
|
|
|
return image |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
if __name__ == "__main__": |
|
|
card_to_image(Carte(2, 4)) |
|
|
card_to_image(Carte(2, 4)) |
|
|