frame = c needs to be put before the click function or the lines can not be drawn.
On 11/6/05, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: > On Sun, 6 Nov 2005, Shi Mu wrote: > > > based on the following rewritten code, why the lines still can not be > > drawn? (there is no error report and the canvas appears). > > It works for me. > > > > from Tkinter import * > > > > root = Tk() > > > > c = Canvas(root, bg='#0e2e0e', height=500, width=1000) > > > > 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 > > > > frame = c > > c.bind('<Button-1>',click) > > > > c.pack() > > > > root.mainloop() > > -- > Chris F.A. Johnson <http://cfaj.freeshell.org> > ================================================================== > Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress > <http://www.torfree.net/~chris/books/cfaj/ssr.html> > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor