Re: How to get a Tk widget's coordinate? How to judge mouse is on a widget or not?
- From: "suchenwi" <richard.suchenwirth-bauersachs@xxxxxxxxxxx>
- Date: 14 Jul 2006 00:33:28 -0700
mengrufeng@xxxxxxxxx schrieb:
How to get a Tk widget's coordinate? How to judge mouse is on a widget
or not?
For coordinates, use [winfo geometry $widget] which returns
(width)x(height)+(deltax)+(deltay)
The delta coordinates are relative to its parent window.
For toplevels, [wm geometry $widget] gives the location relative to the
screen in the same format.
When the mouse pointer enters or leaves a widget, <Enter> resp. <Leave>
events are generated. Just bind to them if you want to be notified.
Little example:
pack [button .b -text hello -relief flat]
bind .b <Enter> {.b config -relief raised}
bind .b <Leave> {.b config -relief flat}
.
- Follow-Ups:
- Re: How to get a Tk widget's coordinate? How to judge mouse is on a widget or not?
- From: Donald Arseneau
- Re: How to get a Tk widget's coordinate? How to judge mouse is on a widget or not?
- References:
- Prev by Date: tk_table in Unix Environment
- Next by Date: aqua needs help to trigger events
- Previous by thread: How to get a Tk widget's coordinate? How to judge mouse is on a widget or not?
- Next by thread: Re: How to get a Tk widget's coordinate? How to judge mouse is on a widget or not?
- Index(es):