ZL&/dZddlGddZGddeZGddeZd Zed k(r dd lmZed d dddl m Z e eyy)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 y ) TooltipBasez abstract base class for tooltipsc ||_d|_y)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 6/opt/alt/python312/lib64/python3.12/idlelib/tooltip.py__init__zTooltipBase.__init__ s+c$|jyNhidetipr s r __del__zTooltipBase.__del__s  r c|jryt|jx|_}|jd |jj dd|j dd|j|j|jj|jjy#t$rY`wxYw)zdisplay the tooltipNz!::tk::unsupported::MacWindowStylestylehelp noActivates) rToplevelrwm_overrideredirecttkcall_wTclErrorposition_window showcontentsupdate_idletasksliftr tws r showtipzTooltipBase.showtips >> &t'9'9:: q!  EEJJ:GRUU} .   '')     s)B:: CCc|j\}}|jj|z}|jj|z}|jj d||fzy)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/sb  "1##//1A5##//1A5 ""8vv.>#>?r c@d|jjdzfS)z(choose a screen position for the tooltipr)r winfo_heightrs r r'zTooltipBase.get_position6s#4%%224q888r ct)z$content display hook for sub-classes)NotImplementedErrorrs r rzTooltipBase.showcontentsAs "!r cp|j}d|_|r |jyy#t$rYywxYwzhide the tooltipN)rdestroyrr"s r rzTooltipBase.hidetipFs>^^      s ) 55N) __name__ __module__ __qualname____doc__r rr$rr'rrr r rr s)**@ 9" r rcTeZdZdZd fd ZfdZd dZd dZdZdZ fdZ xZ S) OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displaycBt||||_d|_|jj d|j |_|jj d|j|_ |jj d|j|_ y)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