B
„ f¥ ã @ s~ d Z ddlT G dd„ deƒZG dd„ deƒZG dd„ deƒZd d
„ Zedkrzddlm Z e d
ddd ddl
mZ eeƒ 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 @ sH e Zd ZdZdd„ Zdd„ Zdd„ Zdd „ Zd
d„ Zdd
„ Z dd„ Z
dS )ÚTooltipBasez abstract base class for tooltipsc C s || _ 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__
s zTooltipBase.__init__c C s | ¡ d S )N)Úhidetip)r r r r Ú__del__ s zTooltipBase.__del__c C s| | j r
dS t| jƒ | _ }| d¡ y|j dd|jdd¡ W n tk
rR Y nX | ¡ | ¡ | j
¡ | j ¡ dS )zdisplay the tooltipNé z!::tk::unsupported::MacWindowStyleZstyleÚhelpZnoActivates)r ÚToplevelr Zwm_overrideredirectZtkZcallZ_wÚTclErrorÚposition_windowÚshowcontentsZupdate_idletasksZlift)r Útwr r r Úshowtip s
zTooltipBase.showtipc C s@ | ¡ \}}| j ¡ | }| j ¡ | }| j d||f ¡ dS )z&(re)-set the tooltip's screen positionz+%d+%dN)Úget_positionr Zwinfo_rootxZwinfo_rootyr Zwm_geometry)r ÚxÚyZroot_xZroot_yr r r r / s zTooltipBase.position_windowc C s d| j ¡ d fS )z(choose a screen position for the tooltipé r )r Zwinfo_height)r r r r r 6 s zTooltipBase.get_positionc C s t ‚dS )z$content display hook for sub-classesN)ÚNotImplementedError)r r r r r A s zTooltipBase.showcontentsc C s6 | j }d| _ |r2y| ¡ W n tk
r0 Y nX dS )zhide the tooltipN)r Zdestroyr )r r r r r r
F s zTooltipBase.hidetipN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r r r
r r r r r
s
r c s^ e Zd ZdZd‡ fdd„ Z‡ fdd„Zddd „Zdd
d„Zdd
„ Zdd„ Z ‡ fdd„Z
‡ ZS )ÚOnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displayéè c sV t t| ƒ |¡ || _d| _| j d| j¡| _| j d| j ¡| _
| j d| j ¡| _dS )aq Create 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.
Nz