click event

Shi Mu samrobertsmith at gmail.com
Mon Nov 7 03:29:40 CET 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