B � f��@s~dZddlTGdd�de�ZGdd�de�ZGdd�de�Zd d �Zed krzdd lm Z e d ddd�ddl 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/python37/lib64/python3.7/idlelib/tooltip.py�__init__ szTooltipBase.__init__cCs |��dS)N)�hidetip)rrrr�__del__szTooltipBase.__del__cCs||jr dSt|j�|_}|�d�y|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)r�twrrr�showtips   zTooltipBase.showtipcCs@|��\}}|j��|}|j��|}|j�d||f�dS)z&(re)-set the tooltip's screen positionz+%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_height)rrrrr6s zTooltipBase.get_positioncCst�dS)z$content display hook for sub-classesN)�NotImplementedError)rrrrrAszTooltipBase.showcontentscCs6|j}d|_|r2y |��Wntk r0YnXdS)zhide the tooltipN)rZdestroyr)rrrrrr 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. Nzzz