[Tkinter-discuss] How can mouse read canvas's object's info?
alix.zhang at gmail.com
Mon Apr 14 17:21:08 CEST 2008
Suppose there are several points on my canvas, each corresponds to a data of
the form [point index, point's x coordanate, point's y coordinate], all
these points are
created by the following sentence,
for point in self.data:
#self.data is a point list and has the form [point1, point2, ...]
self.drawing.create_oval(point-2, point-2, point+2,
#self.drawing is a Canvas
self.drawing.tag_bind('Toselect', '<Any-Enter>', self.mouseEnter)
and the following is the self.mouseEnter function:
#self.CoordinateShow is a Label to show the point's information
I want to show the related information of the point when my mouse moves upon
The KEY problem is: How can the mouse read out that point's OWN information,
such as the point's index, x and y coordinate, and even the point's color.
You see, the mouse's function here accually works on its own x and y
coordinates(event.x and event.y), not the point's value.
(now the self.mouseEnter function don't manipulate color, but my future work
will have to handle this...)
Thanks Very Much!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tkinter-discuss