3  fV@s~dZddlTGdddeZGdddeZGdddeZd d Zed krzdd lm Z e d 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/python36/lib64/python3.6/idlelib/tooltip.py__init__ szTooltipBase.__init__cCs |jdS)N)hidetip)rrrr__del__szTooltipBase.__del__c Cs||jr dSt|j|_}|jdy|jjdd|jddWntk rRYnX|j|j |jj |jj dS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStyleZstylehelpZ noActivates) rToplevelrZwm_overrideredirectZtkZcallZ_wTclErrorposition_window showcontentsZupdate_idletasksZlift)rtwrrrshowtips   zTooltipBase.showtipcCs@|j\}}|jj|}|jj|}|jjd||fdS)z&(re)-set the tooltip's screen positionz+%d+%dN) get_positionrZ winfo_rootxZ winfo_rootyrZ wm_geometry)rxyZroot_xZroot_yrrrr/s zTooltipBase.position_windowcCsd|jjdfS)z(choose a screen position for the tooltipr )rZ winfo_height)rrrrr6s zTooltipBase.get_positioncCstdS)z$content display hook for sub-classesN)NotImplementedError)rrrrrAszTooltipBase.showcontentsc Cs6|j}d|_|r2y |jWntk r0YnXdS)zhide the tooltipN)rZdestroyr)rrrrrr 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|j|||_d|_|jjd|j|_|jjd|j |_ |jjd|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. Nzzz