U .‘cã@s|dZddlTGdd„dƒZGdd„deƒZGdd„deƒZd d „Zed krxdd lmZed dddddl m Z e eƒdS)zŽTools for displaying tool-tips. This includes: * an abstract base-class for different kinds of tooltips * a simple text-only Tooltip class é)Ú*c@sHeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dS)Ú TooltipBasez abstract base class for tooltipscCs||_d|_dS)z®Create 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)Úselfr©rú4/opt/alt/python38/lib64/python3.8/idlelib/tooltip.pyÚ__init__ szTooltipBase.__init__cCs | ¡dS)N©Úhidetip©rrrrÚ__del__szTooltipBase.__del__cCs||jr dSt|jƒ|_}| d¡z|j dd|jdd¡Wntk rRYnX| ¡|  ¡|j  ¡|j  ¡dS)zdisplay the tooltipNéz!::tk::unsupported::MacWindowStyleZstyleÚhelpZ noActivates) rÚToplevelrZwm_overrideredirectZtkZcallZ_wÚTclErrorÚposition_windowÚ showcontentsZupdate_idletasksZlift©rZtwrrrÚshowtips ÿ zTooltipBase.showtipcCs@| ¡\}}|j ¡|}|j ¡|}|j d||f¡dS)z&(re)-set the tooltip's screen positionú+%d+%dN)Ú get_positionrZ winfo_rootxZ winfo_rootyrZ wm_geometry)rÚxÚyZroot_xZroot_yrrrr/s zTooltipBase.position_windowcCsd|j ¡dfS)z(choose a screen position for the tooltipér)rZ winfo_heightr rrrr6s zTooltipBase.get_positioncCst‚dS)z$content display hook for sub-classesN)ÚNotImplementedErrorr rrrrAszTooltipBase.showcontentscCs6|j}d|_|r2z | ¡Wntk r0YnXdS©zhide the tooltipN)rZdestroyrrrrrr Fs zTooltipBase.hidetipN) Ú__name__Ú __module__Ú __qualname__Ú__doc__r r rrrrr rrrrr s  rcs^eZdZdZd‡fdd„ Z‡fdd„Zddd „Zdd d „Zd d „Zdd„Z ‡fdd„Z ‡Z S)ÚOnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displayéècsVtt|ƒ |¡||_d|_|j d|j¡|_|j d|j ¡|_ |j d|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úúú