Your IP : 3.144.237.52


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/CallTipWindow.cpython-35.opt-1.pyc



��Yf��@s�dZddlmZmZmZmZmZdZdZdZ	dZ
d	Zd
ZGdd�d�Z
d
d�Zedkr�ddlmZee�dS)z�A CallTip window class for Tkinter/IDLE.

After ToolTip.py, which uses ideas gleaned from PySol
Used by the CallTips IDLE extension.
�)�Toplevel�Label�LEFT�SOLID�TclErrorz<<calltipwindow-hide>>�<Key-Escape>�
<FocusOut>z<<calltipwindow-checkhide>>�<KeyRelease>�<ButtonRelease>�dZcalltipwindowregion_rightc@sgeZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�CallTipcCsO||_d|_|_d|_|_d|_d|_|_d|_dS)N)	�widget�	tipwindow�label�	parenline�parencol�lastline�hideid�checkhideid�checkhide_after_id)�selfr
�r�:/opt/alt/python35/lib64/python3.5/idlelib/CallTipWindow.py�__init__s		zCallTip.__init__cCs%t|jjd�jd�d�}||jkr8dS||_|jjd�||jkr�|jjd|j|jf�}n|jjd|�}|s�t	|jjd��}d|d<d|d<|d|jj
�d}|d|d	|jj�}|jj
d
||f�dS)z;Check if needs to reposition the window, and if so - do it.�insert�.rNz%d.%dz%d.0���z+%d+%d)�intr
�index�splitrZseerZbboxr�list�winfo_rootx�winfo_rootyrZwm_geometry)r�curlineZbox�x�yrrr�position_windows %	

zCallTip.position_windowcCs�||_|js|jr dS|jjt|�tt|jj|�jd��\|_	|_
t|j�|_}|j�|j
d�y#|jjdd|jdd�Wntk
r�YnXt|d|jd	td
ddtd
dd|jd�|_|jj�|j�|jjt|j�|_x!tD]}|jjt|�q>W|jjt|j�|jjt |j!�|_"x!t#D]}|jjt |�q�WdS)zMShow the calltip, bind events which will close it and reposition it.
        Nrrz!::tk::unsupported::MacWindowStyleZstyle�helpZnoActivates�textZjustifyZ
backgroundz#ffffe0ZreliefZborderwidthZfont)$r*rr
Zmark_set�
MARK_RIGHT�maprr r!rrrr(Zwm_overrideredirectZtkZcallZ_wrrrrr�packZlift�bind�CHECKHIDE_VIRTUAL_EVENT_NAME�checkhide_eventr�CHECKHIDE_SEQUENCES�	event_add�after�CHECKHIDE_TIME�HIDE_VIRTUAL_EVENT_NAME�
hide_eventr�HIDE_SEQUENCES)rr*Z	parenleftZ
parenrightZtw�seqrrr�showtip/s8	-






zCallTip.showtipNcCs�|js
dStt|jjd�jd��\}}||jks|||jkrd||jks||jjddt	�r�|j
�nG|j�|jdk	r�|jj
|j�|jjt|j�|_dS)Nrr�>)rr,rr
r r!rrZcomparer+�hidetipr(rZafter_cancelr3r4r0)r�eventr%Zcurcolrrrr0Ws	*

zCallTip.checkhide_eventcCs|js
dS|j�dS)N)rr;)rr<rrrr6is	zCallTip.hide_eventcCs�|js
dSx!tD]}|jjt|�qW|jjt|j�d|_x!tD]}|jjt|�qWW|jjt|j	�d|_	|j
j�d|_
|jj�d|_|jjt
�d|_|_|_dS)N)rr1r
Zevent_deleter/Zunbindrr7r5rrZdestroyZ
mark_unsetr+rrr)rr8rrrr;os 	
	
	
	
	zCallTip.hidetipcCs
t|j�S)N)�boolr)rrrr�	is_active�szCallTip.is_active)
�__name__�
__module__�__qualname__rr(r9r0r6r;r>rrrrrs(rc	s&ddlm}m}m}m}||�}|jd�|jd|j�d|j�df�||�}|j	d|d|d	d
�|j
dd�|j�t|���fd
d�}�fdd�}|j
dd�|j
dd�|jd|�|jd|�|j�dS)Nr)r�Textr�BOTHz
Test calltipsz
200x100+%d+%d���ZsideZfill�expandrrzstring.splitcs�jddd�dS)Nz(s=Hello world)r�end)r9)r<)�calltiprr�calltip_show�sz%_calltip_window.<locals>.calltip_showcs�j�dS)N)r;)r<)rHrr�calltip_hide�sz%_calltip_window.<locals>.calltip_hidez<<calltip-show>>�(z<<calltip-hide>>�))�tkinterrrBrrC�titleZgeometryr#r$r-r�updaterr2r.Z	focus_set)	�parentrrBrrC�topr*rIrJr)rHr�_calltip_window�s""

rR�__main__)�runN)rr)r	r
)�__doc__rMrrrrrr5r7r/r1r4r+rrRr?Zidlelib.idle_test.htestrTrrrr�<module>s(x

?>