Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. import socket,json
  2. connexion_serveur = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3. connexion_serveur.connect(('localhost',12975))
  4.  
  5. from tkinter import *
  6.  
  7. debug = "true"
  8.  
  9. couleur = "white"
  10.  
  11. que_moulin = "true"
  12.  
  13. jeton_saisie=[]
  14.  
  15. nbr_jeton = 0
  16.  
  17. nbr_noir = 0
  18.  
  19. nbr_blanc = 0
  20.  
  21. fenetre = Tk()
  22.  
  23. fenetre.title('client')
  24.  
  25. jeton = {(200,50,'A','a',1,1): "", (600,50,'D','a',1,2): "", (200,450,'A','d',2,1): "", (1000,50,'G','a',1,3): "", (200,850,'A','g',3,1): "",
  26. (600,850,'H','g',3,2): "", (1000,450,'G','h',2,3): "", (1000,850,'G','g',3,3): "", (325,175,'B','b',1,1): "", (600,175,'D','b',2,2): "",
  27. (325,450,'B','d',2,2): "", (875,175,'F','b',1,3): "", (325,725,'B','f',3,1): "", (875,450,'F','h',2,2): "", (600,725,'H','f',2,2): "",
  28. (875,725,'F','f',3,3): "", (450,300,'C','c',1,1): "", (600,300,'D','c',3,2): "", (450,450,'C','d',2,3): "", (750,300,'E','c',1,3): "",
  29. (450,600,'C','e',3,1): "", (750,450,'E','h',2,1): "", (600,600,'H','e',1,2): "", (750,600,'E','e',3,3): ""}
  30.  
  31. A=[]
  32. a=[]
  33. B=[]
  34. b=[]
  35. C=[]
  36. c=[]
  37. D=[]
  38. d=[]
  39. E=[]
  40. e=[]
  41. F=[]
  42. f=[]
  43. G=[]
  44. g=[]
  45. H=[]
  46. h=[]
  47. white=["white","white","white"]
  48. black=["black","black","black"]
  49.  
  50. jeton_blanc = {(50,25):"white", (50,150):"white", (50,275):"white", (50,400):"white",
  51. (50,525):"white", (50,650):"white", (50,775):"white", (50,900):"white"}
  52.  
  53. jeton_noir = {(1150,25):"black", (1150,150):"black", (1150,275):"black", (1150,400):"black",
  54. (1150,525):"black", (1150,650):"black", (1150,775):"black", (1150,900):"black"}
  55.  
  56. listdeslist={'A':A,'a':a,'B':B,'b':b,'C':C,'c':c,'D':D,'d':d,'E':E,'e':e,'F':F,'f':f,'G':G,'g':g,'H':H,'h':h}
  57.  
  58. def choix_jeton():
  59. objet()
  60.  
  61. def objet():
  62. donne = connexion_serveur.recv(1024)
  63. donne = json.load(donne.decode())
  64. plateau.create_oval(donne[x],donne[y],donne[x]+100,donne[y]+100,fill=donne[color])
  65.  
  66. plateau = Canvas(fenetre, width=1300, height=1025, bg='red')
  67.  
  68. plateau.create_text(575,25,text="Au tour de")
  69.  
  70. plateau.create_rectangle(630,5,670,45,fill="white")
  71.  
  72. for c in jeton:
  73. plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100)
  74.  
  75. ligne = [(150, 100, 450, 100, 400, 800), (275, 225, 450, 225, 275, 550), (400, 350, 450, 350, 150, 300),
  76. (500, 150, 500, 175, 0, 550), (825, 500, 850, 500, -550, 0)]
  77. for l in ligne:
  78. plateau.create_line(l[0]+150, l[1], l[2]+150, l[3])
  79. plateau.create_line(l[0] + l[4]+150, l[1], l[2] + l[4]+150, l[3])
  80. plateau.create_line(l[0]+150, l[1] + l[5], l[2]+150, l[3] + l[5])
  81. plateau.create_line(l[1]+150, l[0], l[3]+150, l[2])
  82. plateau.create_line(l[1] + l[5]+150, l[0], l[3] + l[5]+150, l[2])
  83. plateau.create_line(l[1]+150, l[0] + l[4], l[3]+150, l[2] + l[4])
  84. plateau.create_line(l[0] + l[4]+150, l[1] + l[5], l[2] + l[4]+150, l[3] + l[5])
  85. plateau.create_line(l[1] + l[5]+150, l[0] + l[4], l[3] + l[5]+150, l[2] + l[4])
  86.  
  87. for c in jeton_blanc:
  88. plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100, fill="white")
  89.  
  90. for c in jeton_noir:
  91. plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100, fill="black")
  92.  
  93. choix_jeton()
  94.  
  95. plateau.pack()
  96.  
  97. fenetre.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement