On 02/09/11 12:18, wrote:
>
> in my program,myprint is:
>
> def myprint(arg):
> x=arg.x
> y=arg.y
> canvas.create_text(x,y,text='i am here')
>
Take advantage of Tk canvas tags.
def myprint(arg):
x = arg.x
y = arg.y
canvas.delete('text') # delete any can
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
On Thu, Sep 01, 2011 at 10:37:31AM -0400, Douglas S. Blank wrote:
.
.
.
> On 09/01/2011 10:21 AM, wrote:
> >def myprint():
> > print root.winfo_pointerxy()
> >
> >canvas.bind("",myprint)
>
> When you bind a func
On 09/01/2011 10:21 AM, wrote:
def myprint():
print root.winfo_pointerxy()
canvas.bind("",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 all
[code]
from Tkinter import *
root = Tk()
root.title('Simple Plot - Version 1')
canvas = Canvas(root, width=450, height=300, bg = 'white')
canvas.pack()
Button(root, text='Quit', command=root.quit).pack()
canvas.create_line(100,250,400,250, width=2)
canvas.create_line(100,250,100,50, w