\dGdZddlTGddZGddeZGddeZd Zed kr'dd lmZed d dddl m Z e edSdS)zTools for displaying tool-tips. This includes: * an abstract base-class for different kinds of tooltips * a simple text-only Tooltip class )*c<eZdZdZdZdZdZdZdZdZ dZ d S) TooltipBasez abstract base class for tooltipsc"||_d|_dS)zCreate a tooltip. anchor_widget: the widget next to which the tooltip will be shown Note that a widget will only be shown when showtip() is called. N) anchor_widget tipwindow)selfrs ..\python\lib\idlelib\tooltip.py__init__zTooltipBase.__init__ s+c.|dSNhidetipr s r __del__zTooltipBase.__del__s r c|jrdSt|jx|_}|d |jdd|jddn#t$rYnwxYw|| |j |j dS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStylestylehelp noActivates) rToplevelrwm_overrideredirecttkcall_wTclErrorposition_window showcontentsupdate_idletasksliftr tws r showtipzTooltipBase.showtips >  F&t'9::: q!!!  EJJ:GRU} . . . .    D    ''))) s#A A,+A,c|\}}|j|z}|j|z}|jd||fzdS)z&(re)-set the tooltip's screen position+%d+%dN) get_positionr winfo_rootx winfo_rootyr wm_geometry)r xyroot_xroot_ys r rzTooltipBase.position_window/so  ""1#//11A5#//11A5 ""8vv.>#>?????r c>d|jdzfS)z(choose a screen position for the tooltipr)r winfo_heightrs r r'zTooltipBase.get_position6s#4%2244q888r ct)z$content display hook for sub-classes)NotImplementedErrorrs r rzTooltipBase.showcontentsAs "!r cv|j}d|_|r( |dS#t$rYdSwxYwdSzhide the tooltipN)rdestroyrr"s r rzTooltipBase.hidetipFs\^          s ( 66N) __name__ __module__ __qualname____doc__r rr$rr'rrr r rr s***@@@ 9 9 9"""     r rcTeZdZdZd fd ZfdZd dZd dZdZd Z fd Z xZ S) OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displaycDt|||_d|_|jd|j|_|jd|j|_ |jd|j|_ dS)aqCreate a tooltip with a mouse hover delay. anchor_widget: the widget next to which the tooltip will be shown hover_delay: time to delay before showing the tooltip, in milliseconds Note that a widget will only be shown when showtip() is called, e.g. after hovering over the anchor widget with the mouse for enough time. N