Re: [Tutor] click and line

2005-11-07 Thread Shi Mu
Danny, You are right. Thanks for your great patience and kindness. Shi On 11/7/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > it works now. > > Hi Shi Mu, > > Can you describe how you fixed it? The only diff between the two programs > that I see is that you repositioned the setting of the frame

Re: [Tutor] click and line

2005-11-07 Thread Danny Yoo
> it works now. Hi Shi Mu, Can you describe how you fixed it? The only diff between the two programs that I see is that you repositioned the setting of the frame variable. # mumak:~ dyoo$ diff t1.txt t2.txt 6c6 < --- > frame = c 16c16 < frame = c --- > ##

Re: [Tutor] click and line

2005-11-06 Thread Chris F.A. Johnson
On Sun, 6 Nov 2005, Shi Mu wrote: > frame = c needs to be put before the click function or the lines can > not be drawn. Not at all. I have everything after the click function and it works. This is my version (includes a small addition): def click(event): global lastX, lastY

Re: [Tutor] click and line

2005-11-06 Thread Shi Mu
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

Re: [Tutor] click and line

2005-11-06 Thread Chris F.A. Johnson
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) > > last

Re: [Tutor] click and line

2005-11-06 Thread Shi Mu
it works now. 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('

Re: [Tutor] click and line

2005-11-06 Thread Shi Mu
based on the following rewritten code, why the lines still can not be drawn? (there is no error report and the canvas appears). from Tkinter import * root = Tk() c = Canvas(root, bg='#0e2e0e', height=500, width=1000) lastX="" lastY="" def click(event): global lastX, lastY if lastX != "":

Re: [Tutor] click and line

2005-11-06 Thread Danny Yoo
Hi Shi Mu, Let's look at click(): ## def click(event): print event.x, event.y m1=event.x n1=event.y ## By default, variable names in functions are local. Do you know about local vs global variables? The assignments to m1 and n1 won't

[Tutor] click and line

2005-11-06 Thread Shi Mu
I tried to write the follwoing code to draw lines on the anvas based on the clicked points but retur the message: >>> Traceback (most recent call last): File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__