I'm trying to complete an exercise that asks me to draw lines in Tkinter but I don't know how I make the same canvas.create_line()
receive the coordinates from different functions. I'm kinda stuck here; where and how do I put the create_line
?
from Tkinter import *
canvas = Canvas(bg="white", width=600, height=400)
canvas.pack()
def click(c):
cx=c.x
cy=c.y
def drag(a):
dx=a.x
dy=a.y
def release(l):
rx=l.x
ry=l.y
canvas.bind('<ButtonPress-1>', click)
canvas.bind('<ButtonRelease-1>', release)
canvas.bind("<B1-Motion>", drag)
mainloop()