@@ -0,0 +1,1533 @@
+# wm, 1.12.2006%0A%0Afrom Tkinter import *%0A%0Adef motion(event):%0A%09try:%0A%09%09index = canvas.index('line', %22@%25f,%25f%22 %25 (event.x, event.y))%0A%09%09x, y  = canvas.coords('line')%5Bindex:index+2%5D%0A%09%09r     = 3%0A%09%09canvas.coords('point', x-r, y-r, x+r, y+r)%0A%09except ValueError:%0A%09%09# line is %22empty%22%0A%09%09pass%0A%0Adef insert_pt(event):%0A%09index = canvas.index('line', %22@%25f,%25f%22 %25 (event.x, event.y))%0A%09canvas.insert('line', index, (event.x, event.y))%0A%0Adef append_pt(event):%0A%09canvas.insert('line', 'end', (event.x, event.y))%0A%0Adef replace_pt(event):%0A%09index = canvas.index('line', %22@%25f,%25f%22 %25 (event.x, event.y))%0A%09canvas.insert('line', index, (event.x, event.y))%0A%09canvas.dchars('line', index+2)%0A%09canvas.event_generate('%3CMotion%3E', x=event.x, y=event.y)%0A%0Adef delete_pt(event):%0A%09index = canvas.index('line', %22@%25f,%25f%22 %25 (event.x, event.y))%0A%09canvas.dchars('line', index)%0A%09canvas.event_generate('%3CMotion%3E', x=event.x, y=event.y)%0A%0Adef deleol_pt(event):%0A%09index = canvas.index('line', %22@%25f,%25f%22 %25 (event.x, event.y))%0A%09canvas.dchars('line', index, 'end')%0A%09canvas.event_generate('%3CMotion%3E', x=event.x, y=event.y)%0A%0Aroot   = Tk()%0Acanvas = Canvas(root, bg='white')%0A%0Acanvas.create_line(100, 100, 120, 100, fill='blue', tag='line')%0Acanvas.create_oval(-10, -10, -5, -5, tag='point', fill='white')%0A%0Acanvas.bind('%3CMotion%3E',%09%09%09motion)%0Acanvas.bind('%3CButton-1%3E',%09%09insert_pt)%0Acanvas.bind('%3CControl-Button-1%3E',%09append_pt)%0Acanvas.bind('%3CShift-Button-1%3E',%09%09replace_pt)%0Acanvas.bind('%3CButton-3%3E',%09%09delete_pt)%0Acanvas.bind('%3CControl-Button-3%3E',%09deleol_pt)%0A%0Acanvas.pack(fill=BOTH, expand=1)%0A%0Aroot.mainloop()%0A

edit individual vertices of lines end polylines