Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket,json
- connexion_serveur = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- connexion_serveur.connect(('localhost',12975))
- from tkinter import *
- debug = "true"
- couleur = "white"
- que_moulin = "true"
- jeton_saisie=[]
- nbr_jeton = 0
- nbr_noir = 0
- nbr_blanc = 0
- fenetre = Tk()
- fenetre.title('client')
- 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): "",
- (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): "",
- (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): "",
- (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): "",
- (450,600,'C','e',3,1): "", (750,450,'E','h',2,1): "", (600,600,'H','e',1,2): "", (750,600,'E','e',3,3): ""}
- A=[]
- a=[]
- B=[]
- b=[]
- C=[]
- c=[]
- D=[]
- d=[]
- E=[]
- e=[]
- F=[]
- f=[]
- G=[]
- g=[]
- H=[]
- h=[]
- white=["white","white","white"]
- black=["black","black","black"]
- jeton_blanc = {(50,25):"white", (50,150):"white", (50,275):"white", (50,400):"white",
- (50,525):"white", (50,650):"white", (50,775):"white", (50,900):"white"}
- jeton_noir = {(1150,25):"black", (1150,150):"black", (1150,275):"black", (1150,400):"black",
- (1150,525):"black", (1150,650):"black", (1150,775):"black", (1150,900):"black"}
- 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}
- def choix_jeton():
- objet()
- def objet():
- donne = connexion_serveur.recv(1024)
- donne = json.load(donne.decode())
- plateau.create_oval(donne[x],donne[y],donne[x]+100,donne[y]+100,fill=donne[color])
- plateau = Canvas(fenetre, width=1300, height=1025, bg='red')
- plateau.create_text(575,25,text="Au tour de")
- plateau.create_rectangle(630,5,670,45,fill="white")
- for c in jeton:
- plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100)
- ligne = [(150, 100, 450, 100, 400, 800), (275, 225, 450, 225, 275, 550), (400, 350, 450, 350, 150, 300),
- (500, 150, 500, 175, 0, 550), (825, 500, 850, 500, -550, 0)]
- for l in ligne:
- plateau.create_line(l[0]+150, l[1], l[2]+150, l[3])
- plateau.create_line(l[0] + l[4]+150, l[1], l[2] + l[4]+150, l[3])
- plateau.create_line(l[0]+150, l[1] + l[5], l[2]+150, l[3] + l[5])
- plateau.create_line(l[1]+150, l[0], l[3]+150, l[2])
- plateau.create_line(l[1] + l[5]+150, l[0], l[3] + l[5]+150, l[2])
- plateau.create_line(l[1]+150, l[0] + l[4], l[3]+150, l[2] + l[4])
- plateau.create_line(l[0] + l[4]+150, l[1] + l[5], l[2] + l[4]+150, l[3] + l[5])
- plateau.create_line(l[1] + l[5]+150, l[0] + l[4], l[3] + l[5]+150, l[2] + l[4])
- for c in jeton_blanc:
- plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100, fill="white")
- for c in jeton_noir:
- plateau.create_oval(c[0], c[1], c[0] + 100, c[1] + 100, fill="black")
- choix_jeton()
- plateau.pack()
- fenetre.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement