[Tkinter-discuss] get root.winfo_pointerxy()

Douglas S. Blank dblank at cs.brynmawr.edu
Thu Sep 1 16:37:31 CEST 2011


On 09/01/2011 10:21 AM, ÊØÖê´ýÍÃ wrote:
> def  myprint():
>      print  root.winfo_pointerxy()
>
> canvas.bind("<Button-1>",myprint)

When you bind a function to the canvas, it is expecting a function that 
takes an argument (which is probably the object to which the binding  is 
bound).

So, you could just allow myprint to take an argument, and ignore it:

def  myprint(arg):
      print  root.winfo_pointerxy()

-dsb

-- 
Douglas S. Blank, Associate Professor and Chair
Department of Computer Science, Bryn Mawr College
http://cs.brynmawr.edu/~dblank  (610)526-6501


More information about the Tkinter-discuss mailing list