click event

Shi Mu samrobertsmith at gmail.com
Sun Nov 6 21:29:40 EST 2005


I have the following workable code and every time i click on the
canvas, the coordinates are reported.
i wonder how i can draw the lines when i click the canvas using these
coordinates?

from Tkinter import *

root = Tk()

c = Canvas(root, bg='#0e2e0e', height=500, width=1000)

def click(event):
   print event.x, event.y
frame = c
c.bind('<Button-1>',click)

c.pack()

root.mainloop()



More information about the Python-list mailing list