1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
def print_grid():
for x in range(25, width_w - 25, 15):
for y in range(25, height_w - 25, 15):
canvas.create_rectangle(x, y, x + 15, y + 15,
width=2, outline='grey',
fill='white',
tag='square')
Frame1 = Frame(root, borderwidth=3, relief=GROOVE)
Frame1.pack(side='top', padx=10, pady=10)
Label(Frame1, text="Option de la grille").pack(padx=10,pady=10)
Button(Frame1, text="Afficher", fg='navy', command=print_grid).pack(side=LEFT, padx=10, pady=10)
Button(Frame1, text="Effacer", fg='navy', command=print_grid).pack(side=RIGHT, padx=10, pady=10)
# Association clic/action
canvas.bind("<Button-1>", action_clic_souris)
root.mainloop() |
Partager