Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- initialiser le cannevas
- lignes horizontales pointillés
- verticales
- abscisse, ordonnée
- dessiner la forme
- dessiner une croix sur chaque point
- dessiner les traits
- """
- from tkinter import *
- points = [[2,2],[6,2],[4,6]]
- traits = [[0,1],[1,2],[2,0]]
- def coo(x, y):
- x1 = tcx*x
- y1 = longueur-tcy*y
- return x1, y1
- def init_canevas():
- ecart = 0
- while ecart != 50:
- cannevas.create_line(coo(ecart, 0),coo(ecart,20), fill='white',width=1, dash=(1,1))
- cannevas.create_line(coo(0,ecart),coo(20,ecart), fill='white',width=1, dash=(1, 1))
- ecart +=1
- cannevas.create_line(,largeur/2, fill='blue',width=1, )
- cannevas.create_line(coo(0,ecart),coo(20,ecart), fill='blue',width=1, )
- taille_cell = 80
- largeur = 400
- hauteur = 6*taille_cell
- longueur = 400
- tcx = largeur / 20
- tcy = largeur /20
- fenetre = Tk()
- cannevas = Canvas(fenetre, width=largeur, height=hauteur, bg="grey")
- cannevas.grid(row=0, column=0, columnspan=3)
- fenetre.title("tk")
- init_canevas()
- fenetre.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement