+
     Bi                         R t ^ RIHtHtHtHt ^ RIHt RtRt	Rt
Rt^dtRt ! R R]4      tR t]R	8X  d"   ^ R
IHt ]! R^RR7       ^ RIHt ]! ]4       R# R# )zvA call-tip window class for Tkinter/IDLE.

After tooltip.py, which uses ideas gleaned from PySol.
Used by calltip.py.
)LabelLEFTSOLIDTclError)TooltipBasez<<calltipwindow-hide>>z<<calltipwindow-checkhide>>calltipwindowregion_rightc                      a a ] tR t^t oRtV 3R ltR tV 3R ltV 3R ltR t	RR lt
R tV 3R	 ltR
 tR tRtVtV ;t# )CalltipWindowz+A call-tip widget for tkinter text widgets.c                   < \         SV `  V4       R;V n        V n        R;V n        ;V n        V n        R;V n        V n        RV n	        R# )zmCreate a call-tip; shown by showtip().

text_widget: a Text widget with code for which call-tips are desired
N)
super__init__labeltext	parenlineparencollastlinehideidcheckhideidcheckhide_after_id)selftext_widget	__class__s   &&(/usr/lib/python3.14/idlelib/calltip_w.pyr   CalltipWindow.__init__   sL     	%!%%
TY9===)--d&"&    c                   \        V P                  P                  R4      P                  R4      ^ ,          4      pWP                  8X  d   V P                  V P
                  3pMV^ 3pV P                  P                  RV,          4      pV'       g/   \        V P                  P                  R4      4      p^ V^ &   ^ V^&   V^ ,          ^,           V^,          V^,          ,           3# )z$Choose the position of the call-tip.insert.z%d.%d)intanchor_widgetindexsplitr   r   bboxlist)r   curlineanchor_indexboxs   &   r   get_positionCalltipWindow.get_position#   s    d((..x8>>sCAFGnn$ NNDMM:L#Q<L  %%g&<=t))..x89CCFCF1vz3q6CF?**r   c                   < \        V P                  P                  R4      P                  R4      ^ ,          4      pWP                  8X  d   R# Wn        V P                  P                  R4       \        SV `  4        R# )z Reposition the window if needed.r   r   N)r   r   r    r!   r   seer   position_window)r   r$   r   s   & r   r+   CalltipWindow.position_window2   s_    d((..x8>>sCAFGmm#x(!r   c                f  < Wn         V P                  '       g   V P                   '       g   R# V P                  P                  \        V4       \        \        V P                  P                  V4      P                  R4      4      w  V n	        V n
        \        SV `1  4        V P                  4        R# )a7  Show the call-tip, bind events which will close it and reposition it.

text: the text to display in the call-tip
parenleft: index of the opening parenthesis in the text widget
parenright: index of the closing parenthesis in the text widget,
            or the end of the line if there is no closing parenthesis
Nr   )r   	tipwindowr   mark_set
MARK_RIGHTmapr   r    r!   r   r   r   showtip_bind_events)r   r   	parenleft
parenrightr   s   &&&&r   r2   CalltipWindow.showtip;   s     	>>>##J
;(+##)))4::3?)A% 	r   c                    \        V P                  V P                  \        RR\        ^V P
                  R,          R7      V n        V P                  P                  4        R# )zCreate the call-tip widget.z#ffffd0blackfont)r   justify
background
foregroundreliefborderwidthr9   N)r   r.   r   r   r   r   r   pack)r   s   &r   showcontentsCalltipWindow.showcontentsP   sD    4>>		4&/G"'Q $ 2 26 :<
 	

r   c                X   V P                   '       g   R# \        \        V P                  P	                  R4      P                  R4      4      w  r#W P                  8  gH   W P                  8X  d   W0P                  8:  g(   V P                  P                  RR\        4      '       d   V P                  4        R# V P                  4        V P                  e&   V P                  P                  V P                  4       V P                  P                  \        V P                   4      V n        R# )z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.Nr   r   >break)r.   r1   r   r   r    r!   r   r   comparer0   hidetipr+   r   after_cancelafterCHECKHIDE_TIMEcheckhide_event)r   eventr$   curcols   &&  r   rJ   CalltipWindow.checkhide_eventX   s    ~~~  c4#5#5#;#;H#E#K#KC#PQ^^#~~%&MM*A%%hZ@@LLN 	"".++D,C,CD$$^T5I5IJ 	r   c                N    V P                   '       g   R# V P                  4        R# )z%Handle HIDE_EVENT by calling hidetip.NrD   )r.   rF   )r   rK   s   &&r   
hide_eventCalltipWindow.hide_events   s    ~~~r   c                  < V P                   '       g   R#  V P                  P                  4        RV n        R;V n        ;V n        V n         V P                  P                  \        4        V P                  4        \        SV `5  4        R#   \         d     Lji ; i  \         d     L?i ; i  \        \        3 d     LEi ; i)zHide the call-tip.N)r.   r   destroyr   r   r   r   r   
mark_unsetr0   _unbind_events
ValueErrorr   rF   )r   r   s   &r   rF   CalltipWindow.hidetip{   s    ~~~	JJ  
9===	))*5	!
 	!  		  		
 *% 		s5   B B .B0 BBB-,B-0CCc                   V P                   P                  \        V P                  4      V n        \
         F#  pV P                   P                  \        V4       K%  	  V P                   P                  \        V P                  4       V P                   P                  \        V P                  4      V n        \         F#  pV P                   P                  \        V4       K%  	  R# )zBind event handlers.N)r   bindCHECKHIDE_EVENTrJ   r   CHECKHIDE_SEQUENCES	event_addrH   rI   
HIDE_EVENTrO   r   HIDE_SEQUENCESr   seqs   & r   r3   CalltipWindow._bind_events   s    --22?373G3GI&C((#> '  1E1EF((--j.2oo?!C((S9 "r   c                ~   \          F#  pV P                  P                  \        V4       K%  	  V P                  P	                  \        V P
                  4       RV n        \         F#  pV P                  P                  \        V4       K%  	  V P                  P	                  \        V P                  4       RV n        R# )zUnbind event handlers.N)	rZ   r   event_deleterY   unbindr   r]   r\   r   r^   s   & r   rT   CalltipWindow._unbind_events   s    &C++OSA '!!/43C3CD!C++J< "!!*dkk:r   )r   r   r   r   r   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r'   r+   r2   r@   rJ   rO   rF   r3   rT   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r	   r	      s?     5'+"*62
:	 	r   r	   c                 f  a ^ RI HpHpHpHp V! V 4      pVP                  R4       \        \        V P                  4       P                  R4      R,          4      w  rgVP                  RV^,           V^,           3,          4       V! V4      pVP                  W4^R7       VP                  RR4       VP                  4        \        V4      oV3R	 lp	V3R
 lp
VP                  RR4       VP                  RR4       VP                  RV	4       VP                  RV
4       VP!                  4        R# )    )ToplevelTextr   BOTHzTest call-tips+:   NNz250x100+%d+%d)sidefillexpandr   zstring.splitc                 .   < SP                  R RR4       R# )z(s='Hello world')r   endN)r2   rK   calltips   &r   calltip_show%_calltip_window.<locals>.calltip_show   s    +Xu=r   c                 (   < SP                  4        R # re   )rF   r{   s   &r   calltip_hide%_calltip_window.<locals>.calltip_hide   s    r   z<<calltip-show>>(z<<calltip-hide>>)N)tkinterrq   rr   r   rs   titler1   r   geometryr!   r?   r   updater	   r[   rX   	focus_set)parentrq   rr   r   rs   topxyr   r}   r   r|   s   &          @r   _calltip_windowr      s    22
6
CIIsFOO%++C045DALLAGQW#5569DII41I-KK.)JJLD!G>NN%s+NN%s+II ,/II ,/NNr   __main__)mainz idlelib.idle_test.test_calltip_wF)	verbosityexit)runN)z<Key-Escape>z
<FocusOut>)z<KeyRelease>z<ButtonRelease>)rj   r   r   r   r   r   idlelib.tooltipr   r\   r]   rY   rZ   rI   r0   r	   r   rf   unittestr   idlelib.idle_test.htestr    r   r   <module>r      sr   
 1 0 '%
//9 (
VK Vr2 z	+quE+ r   