o =?h@sdZddlTGdddZGdddeZGdddeZd d Zed kr>dd lmZed dddddl 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@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)selfrr6/opt/alt/python310/lib64/python3.10/idlelib/tooltip.py__init__ s zTooltipBase.__init__cCs |dSNhidetiprrrr__del__s zTooltipBase.__del__cCsz|jrdSt|j|_}|dz |jdd|jddWn ty(Ynw|| |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_positioncCst)z$content display hook for sub-classes)NotImplementedErrorr rrrrAszTooltipBase.showcontentscCs8|j}d|_|rz|WdStyYdSwdSzhide the tooltipN)rZdestroyrrrrrr Fs zTooltipBase.hidetipN) __name__ __module__ __qualname____doc__r rrrrrr 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