I have a code here. I understand i can not draw lines without the global definition of lastX and lastY. But still confused by its use. when should we use global definition?
from Tkinter import * root = Tk() c = Canvas(root, bg='#0e2e0e', height=500, width=1000) frame = c lastX="" lastY="" def click(event): global lastX, lastY if lastX != "": c.create_line(lastX,lastY,event.x,event.y,fill="white") lastX = event.x lastY = event.y c.bind('<1>',click) c.pack() root.mainloop() -- http://mail.python.org/mailman/listinfo/python-list