
“àW  ã               @   sc   d  d l  Td  d l m Z Gd d „  d ƒ Z d d „  Z e d k r_ d  d l m Z e e ƒ d	 S)
é    )Ú*)ÚmacosxSupportc               @   sÐ   e  Z d  Z d Z d d „  Z d d „  Z d d „  Z d d	 „  Z d
 d „  Z d d „  Z	 d d „  Z
 d Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d  „  Z d S)!ÚScrolledListz(None)c             K   sk  | |  _  t | ƒ |  _ } |  j j d d d d ƒ t | d d ƒ|  _ } |  j j d d d d	 ƒ t | d
 d d d ƒ|  _ } | r™ | j | ƒ | j d d d d ƒ | j	 | d <| j
 | d <| j d |  j ƒ | j d |  j ƒ t j ƒ  r$| j d |  j ƒ | j d |  j ƒ n | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ |  j ƒ  d  S)NÚfillZbothÚexpandé   ÚnameÚvbarZsideÚrightÚyZexportselectionr   Z
backgroundZwhiteZcommandZyscrollcommandz<ButtonRelease-1>z<Double-ButtonRelease-1>z<ButtonPress-2>z<Control-Button-1>z<ButtonPress-3>z<Key-Up>z
<Key-Down>)ÚmasterZFrameÚframeÚpackZ	Scrollbarr	   ZListboxÚlistboxZ	configureZyviewÚsetÚbindÚclick_eventÚdouble_click_eventr   ZisAquaTkÚpopup_eventÚup_eventÚ
down_eventÚclear)Úselfr   Úoptionsr   r	   r   © r   úA/afs/.cs/s/python-3.5.2/amd64_ubu14/lib/python3.5/ScrolledList.pyÚ__init__   s*    	zScrolledList.__init__c             C   s   |  j  j ƒ  d  S)N)r   Zdestroy)r   r   r   r   Úclose$   s    zScrolledList.closec             C   s6   |  j  j d d ƒ d |  _ |  j  j d |  j ƒ d  S)Nr   Úendr   )r   ÚdeleteÚemptyÚinsertÚdefault)r   r   r   r   r   '   s    	zScrolledList.clearc             C   sB   |  j  r% |  j j d d ƒ d |  _  |  j j d t | ƒ ƒ d  S)Nr   r   )r    r   r   r!   Ústr)r   Úitemr   r   r   Úappend,   s    		zScrolledList.appendc             C   s   |  j  j | ƒ S)N)r   Úget)r   Úindexr   r   r   r&   2   s    zScrolledList.getc             C   sP   |  j  j d | j | j f ƒ |  j  j d ƒ } |  j | ƒ |  j | ƒ d S)Nz@%d,%dÚactiveÚbreak)r   ÚactivateÚxr   r'   ÚselectÚ	on_select)r   Úeventr'   r   r   r   r   5   s
     zScrolledList.click_eventc             C   s0   |  j  j d ƒ } |  j | ƒ |  j | ƒ d S)Nr(   r)   )r   r'   r,   Ú	on_double)r   r.   r'   r   r   r   r   <   s    zScrolledList.double_click_eventNc             C   su   |  j  s |  j ƒ  |  j  } |  j j d | j | j f ƒ |  j j d ƒ } |  j | ƒ | j | j	 | j
 ƒ d  S)Nz@%d,%dr(   )ÚmenuÚ	make_menur   r*   r+   r   r'   r,   Ztk_popupZx_rootZy_root)r   r.   r0   r'   r   r   r   r   D   s    	
	 zScrolledList.popup_eventc             C   s,   t  |  j d d ƒ} | |  _ |  j ƒ  d  S)NZtearoffr   )ZMenur   r0   Ú	fill_menu)r   r0   r   r   r   r1   M   s    	zScrolledList.make_menuc             C   s~   |  j  j d ƒ } |  j  j | ƒ r1 | d } n |  j  j ƒ  d } | d k  r` |  j  j ƒ  n |  j | ƒ |  j | ƒ d S)Nr(   r   r   r)   )r   r'   Úselection_includesÚsizeÚbellr,   r-   )r   r.   r'   r   r   r   r   R   s    zScrolledList.up_eventc             C   sz   |  j  j d ƒ } |  j  j | ƒ r1 | d } n d } | |  j  j ƒ  k r\ |  j  j ƒ  n |  j | ƒ |  j | ƒ d S)Nr(   r   r   r)   )r   r'   r3   r4   r5   r,   r-   )r   r.   r'   r   r   r   r   _   s    zScrolledList.down_eventc             C   sT   |  j  j ƒ  |  j  j | ƒ |  j  j d d ƒ |  j  j | ƒ |  j  j | ƒ d  S)Nr   r   )r   Z	focus_setr*   Zselection_clearZselection_setZsee)r   r'   r   r   r   r,   l   s
    zScrolledList.selectc             C   s   d  S)Nr   )r   r   r   r   r2   u   s    zScrolledList.fill_menuc             C   s   d  S)Nr   )r   r'   r   r   r   r-   x   s    zScrolledList.on_selectc             C   s   d  S)Nr   )r   r'   r   r   r   r/   {   s    zScrolledList.on_double)Ú__name__Ú
__module__Ú__qualname__r"   r   r   r   r%   r&   r   r   r0   r   r1   r   r   r,   r2   r-   r/   r   r   r   r   r      s"   		r   c       	      C   s¼   t  ƒ  } | j d ƒ t t t t j d |  j ƒ  ƒ ƒ ƒ \ } } } } | j d | | d f ƒ Gd d „  d t ƒ } | | ƒ } x% t	 d ƒ D] } | j
 d | ƒ q“ W| j ƒ  d  S)	NzTest ScrolledListz[x+]z+%d+%dé–   c               @   s4   e  Z d  Z d d „  Z d d „  Z d d „  Z d S)z&_scrolled_list.<locals>.MyScrolledListc             S   s   |  j  j d d ƒ d  S)NZlabelzright click)r0   Zadd_command)r   r   r   r   r2   …   s    z0_scrolled_list.<locals>.MyScrolledList.fill_menuc             S   s   t  d |  j | ƒ ƒ d  S)Nr,   )Úprintr&   )r   r'   r   r   r   r-   †   s    z0_scrolled_list.<locals>.MyScrolledList.on_selectc             S   s   t  d |  j | ƒ ƒ d  S)NZdouble)r:   r&   )r   r'   r   r   r   r/   ‡   s    z0_scrolled_list.<locals>.MyScrolledList.on_doubleN)r6   r7   r8   r2   r-   r/   r   r   r   r   ÚMyScrolledList„   s   r;   é   z	Item %02d)ZTkÚtitleÚlistÚmapÚintÚreÚsplitZgeometryr   Úranger%   Zmainloop)	ÚparentÚrootÚwidthZheightr+   r   r;   Zscrolled_listÚir   r   r   Ú_scrolled_list   s    	3rH   Ú__main__)ÚrunN)ÚtkinterZidlelibr   r   rH   r6   Zidlelib.idle_test.htestrJ   r   r   r   r   Ú<module>   s   
{