From 30dc41e965c7b55ff51b6b5af0225472b7336cf4 Mon Sep 17 00:00:00 2001 From: "barraux.a" Date: Wed, 14 Dec 2022 14:46:07 +0100 Subject: [PATCH] changes --- main.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 668dd4f..21e69e4 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,6 @@ from File import File_chaine import tkinter as tk -from urllib.request import urlopen -import PIL +from PIL import Image, ImageTk import sqlite3 @@ -26,8 +25,8 @@ class Carte: class Jeux: - def __init__(self, nb): - paquet = [] + def __init__(self, nb) -> None: + self.paquet = [] self.nombre_carte = nb if self.nombre_carte != 32 and self.nombre_carte != 52: raise ValueError("Saissisez 32 ou 54 cartes") @@ -41,7 +40,7 @@ class Jeux: c.execute('SELECT * FROM Carte') data = c.fetchall() for i, carte in enumerate(data): - paquet.append(Carte(data[i][0], data[i][1], data[i][3])) + self.paquet.append(Carte(data[i][0], data[i][1], data[i][3])) def distribute(self, joueur) -> File_chaine: @@ -85,10 +84,22 @@ class Jeux: class Gui: def __init__(self) -> None: self.win = tk.Tk() - # image = tk.PhotoImage(b64_data) - # self.can = tk.Canvas(self.win, width=320, height=320) - # self.can.create_image(200, 200, image=image) - # self.can.pack() + self.images = [] + image = Image.open('photo/5.png') + test = ImageTk.PhotoImage((image)) + self.images.append(tk.Label(image=test)) + self.images[0].pack() + + # self.display_card(jeu.paquet[0]) + self.win.mainloop() -Gui() -Jeux(32) \ No newline at end of file + + def display_card(self, carte :Carte) -> None: + image = Image.open('photo/5.png') + test = ImageTk.PhotoImage((image)) + self.images.append(tk.Label(image=test)) + self.images[0].pack() + + +jeu = Jeux(32) +gui = Gui() \ No newline at end of file