コード例 #1
0
                           draw[0][1],
                           draw[len(draw) - 1][0],
                           draw[len(draw) - 1][1],
                           fill="grey",
                           width=3)
    root.after(500, exit)


# root.bind('<3>', polygon)
def exit():
    root.destroy()
    MST.GeneticAlgorithm(15, 500, obstacle)


root = tk.Tk()
points = MST.getPoints()
canvas = tk.Canvas(root, width=1000, height=1000)
canvas.pack()
canvas.old_coords = None
for x, y in points:
    canvas.create_oval((10 * x) - 5,
                       1000 - (10 * y) - 5, (10 * x) + 5,
                       1000 - (10 * y) + 5,
                       fill="blue",
                       outline="blue",
                       width=1)

root.bind('<Button-1>', myfunction)
root.bind('<Button-3>', polygon)

root.mainloop()