Tracking validity in tkinter widget

Jeff Epler jepler at unpythonic.net
Fri Oct 18 04:49:02 CEST 2002


While the button is pressed, Tk captures mouse motion events and sends them
to the widget (or, in this case, a canvas item) where the button was first
pressed.

You can bind <Enter> and <Leave> events to do "something" when the pointer
crosses the edge of a widget.  According to the manpage for the canvas,
the <Enter> and <Leave> events can be bound for a canvas item too, but the
meaning is different:
    The tag current is managed automatically by Tk; it applies to the
    current item, which is the topmost item whose drawn area covers the
    position of the mouse cursor.  If the mouse is not in the canvas
    widget or is not over an  item, then no item has the current tag.

    [...] Enter and Leave events trigger for an item when it becomes
    the current item or ceases to be the current item; note that these
    events are different than Enter and Leave events for windows.

Jeff




More information about the Python-list mailing list