On 02/09/11 11:23, ???????? wrote:
> 
> def  myprint(arg):
>     print  "arg.x"  , arg.x,"arg.y",arg.y
>     print  root.winfo_pointerxy()
> 
> what i get is:
> arg.x 102 arg.y 250
> (103, 334)
> arg.x 3 arg.y 1
> (4, 85)
> arg.x 1 arg.y 0
> (2, 84)
> arg.x 0 arg.y 0
> (1, 84)
> 
> why  arg.x , arg.y  !==  root.winfo_pointerxy()


In your example, arg.x and arg.y refer to the position within the parent
window (the canvas) relative to its top left corner.

To get the poisition relative to the top left corner of the screen, ie
equivalent to root.pointerxy(), you need arg.x_root and arg.y_root.

As an exercise, to see all the possible event attributes try dir(arg) in
your myprint function.

Regards,

John


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to