a XC?h@s|dZddlTGdddZGdddeZGdddeZd d Zed krxdd lmZed dddddl m Z e edS)zTools for displaying tool-tips. This includes: * an abstract base-class for different kinds of tooltips * a simple text-only Tooltip class )*c@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS) TooltipBasez abstract base class for tooltipscCs||_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)selfrr4/opt/alt/python39/lib64/python3.9/idlelib/tooltip.py__init__ szTooltipBase.__init__cCs |dS)Nhidetiprrrr__del__szTooltipBase.__del__cCsz|jr dSt|j|_}|dz|jdd|jddWntyPYn0|| |j |j dS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStyleZstylehelpZ noActivates) rToplevelrZwm_overrideredirectZtkZcallZ_wTclErrorposition_window showcontentsZupdate_idletasksZliftrZtwrrrshowtips   zTooltipBase.showtipcCs@|\}}|j|}|j|}|jd||fdS)z&(re)-set the tooltip's screen position+%d+%dN) get_positionrZ winfo_rootxZ winfo_rootyrZ wm_geometry)rxyZroot_xZroot_yrrrr/s zTooltipBase.position_windowcCsd|jdfS)z(choose a screen position for the tooltipr)rZ winfo_heightr rrrr6s zTooltipBase.get_positioncCstdS)z$content display hook for sub-classesN)NotImplementedErrorr rrrrAszTooltipBase.showcontentscCs4|j}d|_|r0z |Wnty.Yn0dSzhide the tooltipN)rZdestroyrrrrrr Fs  zTooltipBase.hidetipN) __name__ __module__ __qualname____doc__r r rrrrr rrrrr s  rcs^eZdZdZdfdd ZfddZddd Zdd d Zd d ZddZ fddZ Z S)OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displaycsVtt||||_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