ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/tooltip.cpython-36.pyc

3

*j�aV�@s~dZddlTGdd�de�ZGdd�de�ZGdd�de�Zd	d
�Zedkrzddlm	Z	e	d
ddd�ddl
mZee�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/python36/lib64/python3.6/idlelib/tooltip.py�__init__
szTooltipBase.__init__cCs|j�dS)N)�hidetip)rrrr�__del__szTooltipBase.__del__cCs||jr
dSt|j�|_}|jd�y|jjdd|jdd�Wntk
rRYnX|j�|j	�|jj
�|jj�dS)zdisplay the tooltipN�z!::tk::unsupported::MacWindowStyleZstyle�helpZnoActivates)r�ToplevelrZwm_overrideredirectZtkZcallZ_w�TclError�position_window�showcontentsZupdate_idletasksZlift)r�twrrr�showtips

zTooltipBase.showtipcCs@|j�\}}|jj�|}|jj�|}|jjd||f�dS)z&(re)-set the tooltip's screen positionz+%d+%dN)�get_positionrZwinfo_rootxZwinfo_rootyrZwm_geometry)r�x�yZroot_xZroot_yrrrr/szTooltipBase.position_windowcCsd|jj�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|j�Wntk
r0YnXdS)zhide the tooltipN)rZdestroyr)rrrrrr
FszTooltipBase.hidetipN)�__name__�
__module__�__qualname__�__doc__r	rrrrrr
rrrrr
s
rcs^eZdZdZd�fdd�	Z�fdd�Zddd	�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)�OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover display��csVtt|�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.
        Nz<Enter>z<Leave>z<Button>)�superrr	�hover_delay�	_after_idrZbind�_show_event�_id1�_hide_event�_id2�_id3)rrr )�	__class__rrr	Us
zOnHoverTooltipBase.__init__cs\y4|jjd|j�|jjd|j�|jjd|j�Wntk
rHYnXtt|�j�dS)Nz<Enter>z<Leave>z<Button>)	rZunbindr#r%r&rrrr)r)r'rrrgszOnHoverTooltipBase.__del__NcCs|jr|j�n|j�dS)z$event handler to display the tooltipN)r �scheduler)r�eventrrrr"ps
zOnHoverTooltipBase._show_eventcCs|j�dS)z!event handler to hide the tooltipN)r
)rr)rrrr$wszOnHoverTooltipBase._hide_eventcCs |j�|jj|j|j�|_dS)z*schedule the future display of the tooltipN)�
unscheduler�afterr rr!)rrrrr({s
zOnHoverTooltipBase.schedulecCs |j}d|_|r|jj|�dS)z(cancel the future display of the tooltipN)r!rZafter_cancel)rZafter_idrrrr*�szOnHoverTooltipBase.unschedulecs4y|j�Wntk
r YnXtt|�j�dS)zhide the tooltipN)r*rrrr
)r)r'rrr
�s
zOnHoverTooltipBase.hidetip)r)N)N)rrrrr	rr"r$r(r*r
�
__classcell__rr)r'rrRs	

rcs*eZdZdZd�fdd�	Zdd�Z�ZS)�HovertipzAA tooltip that pops up when a mouse hovers over an anchor widget.��cstt|�j||d�||_dS)avCreate a text 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.
        )r N)rr-r	�text)rrr/r )r'rrr	�s
zHovertip.__init__cCs$t|j|jtdtdd�}|j�dS)Nz#ffffe0r)r/ZjustifyZ
backgroundZreliefZborderwidth)�Labelrr/ZLEFTZSOLID�pack)r�labelrrrr�szHovertip.showcontents)r.)rrrrr	rr,rr)r'rr-�s
r-cCs�t|�}|jd�tt|j�jd�dd��\}}|jd||df�t|dd�}|j�t|dd�}|j�t	|d	d
d�t|dd�}|j�t	|d
dd�dS)NzTest tooltip�+rz+%d+%d�zPlace your mouse over buttons)r/z"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.i�)r zButton 2 -- no hover delayz!This is tooltip
text for button2.)
r�title�map�intZgeometry�splitr0r1ZButtonr-)�parent�toprrr2Zbutton1Zbutton2rrr�_tooltip�s
 r;�__main__)�mainzidlelib.idle_test.test_tooltip�F)�	verbosity�exit)�runN)rZtkinter�objectrrr-r;rZunittestr=Zidlelib.idle_test.htestrArrrr�<module>sH?

Zerion Mini Shell 1.0