[Tutor] Following the Mouse in a Graphics Area
Kent Johnson
kent37 at tds.net
Mon Feb 18 13:53:45 CET 2008
Wayne Watson wrote:
> Win XP.
> Is there a way to read out the pixel position in a graphics area, and
> display it so the user knows the x-y values? I want the user to specify
> the center of a circle he wants drawn on an image. When he specifies the
> center, then I want to use it as a reference point.
Presuming you are still using Tkinter, when the user clicks, the Event
object includes the x, y coordinates of the click relative to the
top-left of the widget that was clicked. If you want to track mouse
motion in a widget, register a <Motion> handler for the widget.
Kent
More information about the Tutor
mailing list