Browse Source

ajout des cartes et de la bdd

master
BARRAUX Arthur 2 years ago
parent
commit
11b9f60766
  1. BIN
      bdd.db
  2. 25
      main.py
  3. BIN
      photo/10.png
  4. BIN
      photo/100.png
  5. BIN
      photo/11.png
  6. BIN
      photo/12.png
  7. BIN
      photo/13.png
  8. BIN
      photo/14.png
  9. BIN
      photo/15.png
  10. BIN
      photo/16.png
  11. BIN
      photo/17.png
  12. BIN
      photo/18.png
  13. BIN
      photo/19.png
  14. BIN
      photo/20.png
  15. BIN
      photo/200.png
  16. BIN
      photo/21.png
  17. BIN
      photo/22.png
  18. BIN
      photo/23.png
  19. BIN
      photo/24.png
  20. BIN
      photo/25.png
  21. BIN
      photo/26.png
  22. BIN
      photo/27.png
  23. BIN
      photo/28.png
  24. BIN
      photo/29.png
  25. BIN
      photo/30.png
  26. BIN
      photo/300.png
  27. BIN
      photo/31.png
  28. BIN
      photo/32.png
  29. BIN
      photo/33.png
  30. BIN
      photo/34.png
  31. BIN
      photo/35.png
  32. BIN
      photo/36.png
  33. BIN
      photo/37.png
  34. BIN
      photo/38.png
  35. BIN
      photo/39.png
  36. BIN
      photo/40.png
  37. BIN
      photo/400.png
  38. BIN
      photo/41.png
  39. BIN
      photo/42.png
  40. BIN
      photo/43.png
  41. BIN
      photo/44.png
  42. BIN
      photo/45.png
  43. BIN
      photo/46.png
  44. BIN
      photo/47.png
  45. BIN
      photo/48.png
  46. BIN
      photo/49.png
  47. BIN
      photo/5.png
  48. BIN
      photo/50.png
  49. BIN
      photo/51.png
  50. BIN
      photo/52.png
  51. BIN
      photo/6.png
  52. BIN
      photo/7.png
  53. BIN
      photo/8.png
  54. BIN
      photo/9.png
  55. 8
      script.sh
  56. 15
      setup_table.py

BIN
bdd.db

Binary file not shown.

25
main.py

@ -1,3 +1,8 @@
import tkinter as tk
from urllib.request import urlopen
import PIL
class Carte: class Carte:
def __init__(self,valeur, couleur): def __init__(self,valeur, couleur):
self.valeur = valeur self.valeur = valeur
@ -11,4 +16,22 @@ class Carte:
return -1 return -1
elif self.valeur == self.other : elif self.valeur == self.other :
return 0 return 0
return None 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()

BIN
photo/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
photo/100.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
photo/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
photo/12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/13.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
photo/14.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/15.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/17.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

BIN
photo/18.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

BIN
photo/19.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

BIN
photo/20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

BIN
photo/200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

BIN
photo/21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

BIN
photo/22.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

BIN
photo/23.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
photo/24.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

BIN
photo/25.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

BIN
photo/26.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

BIN
photo/27.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

BIN
photo/28.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

BIN
photo/29.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

BIN
photo/30.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

BIN
photo/300.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

BIN
photo/31.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

BIN
photo/32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

BIN
photo/33.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

BIN
photo/34.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

BIN
photo/35.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
photo/36.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

BIN
photo/37.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

BIN
photo/38.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

BIN
photo/39.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

BIN
photo/40.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
photo/400.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

BIN
photo/41.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
photo/42.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
photo/43.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

BIN
photo/44.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

BIN
photo/45.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

BIN
photo/46.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

BIN
photo/47.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

BIN
photo/48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
photo/49.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

BIN
photo/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/50.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

BIN
photo/51.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
photo/52.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

BIN
photo/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
photo/8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
photo/9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

8
script.sh

@ -0,0 +1,8 @@
#!/bin/bash
# script pour récupérer les images de carte qur internet
for i in $( seq 52 )
do
curl "http://www.iro.umontreal.ca/~reid/ift1146/E06/classic-cards/$i.png" -o "photo/$i.png"
done

15
setup_table.py

@ -0,0 +1,15 @@
import sqlite3
import subprocess
# programme pour créer toute la table de donnée. Ne pas analyser en détails c'est moche et mal fait
# liste des chemins des cartes
cards = subprocess.run(['ls', '-v', 'photo'], text=True, stdout=subprocess.PIPE).stdout.split('\n')
conn = sqlite3.connect('bdd.db')
c = conn.cursor()
compteur = 0
for i in range(13, 0, -1):
for couleur in ["trèfle", "pique", "coeur", "carreau"]:
c.execute("INSERT INTO Cartes VALUES(?,?,?,?) ", (couleur, i, (i>=7 or i==1), "photo/"+cards[compteur]))
conn.commit()
compteur += 1
Loading…
Cancel
Save