You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import tkinter as tk
|
|
|
|
from urllib.request import urlopen
|
|
|
|
import PIL
|
|
|
|
|
|
|
|
|
|
|
|
class Carte:
|
|
|
|
def __init__(self,valeur, couleur):
|
|
|
|
self.valeur = valeur
|
|
|
|
self.couleur = couleur
|
|
|
|
|
|
|
|
def compare(self, other):
|
|
|
|
self.other = other.valeur
|
|
|
|
if self.valeur > self.other :
|
|
|
|
return 1
|
|
|
|
elif self.valeur < self.other :
|
|
|
|
return -1
|
|
|
|
elif self.valeur == self.other :
|
|
|
|
return 0
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
class Gui:
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.win = tk.Tk()
|
|
|
|
src = 'http://www.iro.umontreal.ca/~reid/ift1146/E06/classic-cards/1.png'
|
|
|
|
url = urlopen(src)
|
|
|
|
raw_data = url.read()
|
|
|
|
print(raw_data)
|
|
|
|
url.close()
|
|
|
|
b64_data = encodestring(raw_data)
|
|
|
|
print(b64_data)
|
|
|
|
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.win.mainloop()
|
|
|
|
Gui()
|