TOC A. Tool Tip A. Tool Tip Tool tip is a widget to show overlayed information on the window. When mouse is moved onto the wi...
TOC
A. Tool Tip
Tool tip is a widget to show overlayed information on the window.
- When mouse is moved onto the window, tool tip will be shown.
Image 1
- If Line 20 is commented out,
Image 2
- Line 4: defines tool tip class.
- Line 5: defines constructor for tool tipe. widget is a target widget to show tip.
- Line 7: defines a variable for actual tool tip widget.
- Line 8: defines variables for x, y positions.
- Line 10: defines a method to show tool tip. text is what tool tip shows.
- Line 16: get current positions of target widget.
- Line 17, 18: calculates the position of toll tip.
- Line 19: defines actual tool tip widget. Toplevel is a window like Tk, but it is subset of Tk.
- Line 20: If the argument of wm_overrideredirect() is 1, the window frame is unvisible. Only, widgets on the Toplevel will be shown.
- Line 21: sets the x, y positions of tool tip.
- Line 23: defines Label which shows the text.
- Line 28: sets the label on the Toplevel. pack is similar to grid, but it is simple and easy to use.
- Line 30: defines a method to destory tool tip.
- Line 34: destroys tool tip.
- Line 36: defines a function to create and destory tool tip.
- Line 42, 43: binds mouse events to each methods.
COMMENTS