|
@ -1,7 +1,6 @@ |
|
|
from File import File_chaine |
|
|
from File import File_chaine |
|
|
import tkinter as tk |
|
|
import tkinter as tk |
|
|
from urllib.request import urlopen |
|
|
from PIL import Image, ImageTk |
|
|
import PIL |
|
|
|
|
|
import sqlite3 |
|
|
import sqlite3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -26,8 +25,8 @@ class Carte: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Jeux: |
|
|
class Jeux: |
|
|
def __init__(self, nb): |
|
|
def __init__(self, nb) -> None: |
|
|
paquet = [] |
|
|
self.paquet = [] |
|
|
self.nombre_carte = nb |
|
|
self.nombre_carte = nb |
|
|
if self.nombre_carte != 32 and self.nombre_carte != 52: |
|
|
if self.nombre_carte != 32 and self.nombre_carte != 52: |
|
|
raise ValueError("Saissisez 32 ou 54 cartes") |
|
|
raise ValueError("Saissisez 32 ou 54 cartes") |
|
@ -41,7 +40,7 @@ class Jeux: |
|
|
c.execute('SELECT * FROM Carte') |
|
|
c.execute('SELECT * FROM Carte') |
|
|
data = c.fetchall() |
|
|
data = c.fetchall() |
|
|
for i, carte in enumerate(data): |
|
|
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: |
|
|
def distribute(self, joueur) -> File_chaine: |
|
@ -85,10 +84,22 @@ class Jeux: |
|
|
class Gui: |
|
|
class Gui: |
|
|
def __init__(self) -> None: |
|
|
def __init__(self) -> None: |
|
|
self.win = tk.Tk() |
|
|
self.win = tk.Tk() |
|
|
# image = tk.PhotoImage(b64_data) |
|
|
self.images = [] |
|
|
# self.can = tk.Canvas(self.win, width=320, height=320) |
|
|
image = Image.open('photo/5.png') |
|
|
# self.can.create_image(200, 200, image=image) |
|
|
test = ImageTk.PhotoImage((image)) |
|
|
# self.can.pack() |
|
|
self.images.append(tk.Label(image=test)) |
|
|
|
|
|
self.images[0].pack() |
|
|
|
|
|
|
|
|
|
|
|
# self.display_card(jeu.paquet[0]) |
|
|
|
|
|
|
|
|
self.win.mainloop() |
|
|
self.win.mainloop() |
|
|
Gui() |
|
|
|
|
|
Jeux(32) |
|
|
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() |