Ë
    çÍ:j,°  ã                   óv   — d Z ddlZddlmZmZmZmZmZ  G d„ de«      Z G d„ d«      Z	d„ Z
ed	k(  r e
«        yy)
zC
Tkinter widgets for displaying multi-column listboxes and tables.
é    N)ÚFrameÚLabelÚListboxÚ	ScrollbarÚTkc            	       ó¬  — e Zd ZdZ eddd¬«      Z eddddd	¬
«      Z eddddddd¬«      Zdi fd„Zd„ Z	d„ Z
d„ Zed„ «       Zed„ «       Zed„ «       Zd„ Zd„ Zd„ Zd9d„Zi fd„Zd„ Zi fd„Zi fd„Zd:d„Zd „ Zd:d!„Zd"„ Zd#„ Zd$„ Zd;d%„Zd;d&„Zd;d'„Z d(„ Z!d)„ Z"d*„ Z#d+„ Z$d,„ Z%d-„ Z&d.„ Z'd/„ Z(d0„ Z)d1„ Z*d2„ Z+d3„ Z,d4„ Z-d5„ Z.d6„ Z/d7„ Z0d8„ Z1eZ2eZ3eZ4e,Z5e-Z6e"Z7e.Z8y)<ÚMultiListboxa§  
    A multi-column listbox, where the current selection applies to an
    entire row.  Based on the MultiListbox Tkinter widget
    recipe from the Python Cookbook (https://code.activestate.com/recipes/52266/)

    For the most part, ``MultiListbox`` methods delegate to its
    contained listboxes.  For any methods that do not have docstrings,
    see ``Tkinter.Listbox`` for a description of what that method does.
    z#888Té   )Ú
backgroundÚ	takefocusÚhighlightthicknessÚraisedzhelvetica -16 boldz#444Úwhite)ÚborderwidthÚreliefÚfontr   Ú
foregroundr   FÚnone)r   Úselectborderwidthr   ÚexportselectionÚselectbackgroundÚactivestyler   Nc                 óô  ‡ — t        |t        «      rt        t        |«      «      }d}nd}t	        |«      dk(  rt        d«      ‚t        |«      ‰ _        g ‰ _        g ‰ _	        |€dgt	        |«      z  }n"t	        |«      t	        |«      k7  rt        d«      ‚|‰ _
        t        j                  ‰ |fi ‰ j                  ¤Ž ‰ j                  dd¬«       t        ‰ j                  «      D �]Œ  \  }}‰ j!                  |||   ¬«       |rPt#        ‰ fd	|i‰ j$                  ¤Ž}	‰ j                  j'                  |	«       |	j)                  |dd
dd¬«       ||	_        t-        ‰ fi ‰ j.                  ¤Ž}
‰ j                  j'                  |
«       |
j)                  |dd
dd¬«       ||
_        |
j1                  d‰ j2                  «       |
j1                  d‰ j2                  «       |
j1                  dˆ fd„«       |
j1                  dˆ fd„«       |
j1                  dˆ fd„«       |
j1                  dˆ fd„«       |
j1                  dˆ fd„«       |
j1                  dd„ «       |
j1                  d‰ j4                  «       �Œ� ‰ j1                  d‰ j4                  «       ‰ j1                  dˆ fd„«       ‰ j1                  dˆ fd„«       ‰ j1                  dˆ fd„«       ‰ j1                  d ˆ fd!„«        ‰ j6                  |fi |¤Ž y)"aŽ  
        Construct a new multi-column listbox widget.

        :param master: The widget that should contain the new
            multi-column listbox.

        :param columns: Specifies what columns should be included in
            the new multi-column listbox.  If ``columns`` is an integer,
            then it is the number of columns to include.  If it is
            a list, then its length indicates the number of columns
            to include; and each element of the list will be used as
            a label for the corresponding column.

        :param cnf, kw: Configuration parameters for this widget.
            Use ``label_*`` to configure all labels; and ``listbox_*``
            to configure all listboxes.  E.g.:
                >>> root = Tk()  # doctest: +SKIP
                >>> MultiListbox(root, ["Subject", "Sender", "Date"], label_foreground='red').pack()  # doctest: +SKIP
        FTr   zExpected at least one columnNr
   z*Expected one column_weight for each column©ÚweightÚtextÚnews©ÚcolumnÚrowÚstickyÚpadxÚpadyú
<Button-1>z<B1-Motion>z
<Button-4>c                 ó&   •— ‰j                  d«      S )Néÿÿÿÿ©Ú_scroll©ÚeÚselfs    €úd/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/nltk/draw/table.pyú<lambda>z'MultiListbox.__init__.<locals>.<lambda>   ó   ø€ ¨D¯L©L¸Ó,<€ ó    z
<Button-5>c                 ó&   •— ‰j                  d«      S )Nr
   r'   r)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>€   r.   r/   z<MouseWheel>c                 ó:   •— ‰j                  | j                  «      S ©N)r(   Údeltar)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>�   s   ø€ ¨d¯l©l¸1¿7¹7Ó.C€ r/   z
<Button-2>c                 óP   •— ‰j                  | j                  | j                  «      S r2   )Ú	scan_markÚxÚyr)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>ƒ   s   ø€ ¨D¯N©N¸1¿3¹3ÀÇÁÓ,D€ r/   z<B2-Motion>c                 óP   •— ‰j                  | j                  | j                  «      S r2   )Úscan_dragtor6   r7   r)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>„   s   ø€ ¨T×-=Ñ-=¸a¿c¹cÀ1Ç3Á3Ó-G€ r/   z
<B1-Leave>c                  ó   — y)NÚbreak© )r*   s    r,   r-   z'MultiListbox.__init__.<locals>.<lambda>‡   s   � r/   z<Up>c                 ó(   •— ‰j                  d¬«      S )Nr&   ©r3   ©Úselectr)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>�   s   ø€  D§K¡K°b KÓ$9€ r/   z<Down>c                 ó(   •— ‰j                  d¬«      S )Nr
   r>   r?   r)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>‘   s   ø€  d§k¡k¸ kÓ&:€ r/   z<Prior>c                 óF   •— ‰j                  ‰j                  «        ¬«      S ©Nr>   ©r@   Ú	_pagesizer)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>’   s   ø€  t§{¡{¸$¿.¹.Ó:JÐ9J {Ó'K€ r/   z<Next>c                 óD   •— ‰j                  ‰j                  «       ¬«      S rC   rD   r)   s    €r,   r-   z'MultiListbox.__init__.<locals>.<lambda>“   s   ø€  d§k¡k¸¿¹Ó8H kÓ&I€ r/   )Ú
isinstanceÚintÚlistÚrangeÚlenÚ
ValueErrorÚtupleÚ_column_namesÚ
_listboxesÚ_labelsÚ_column_weightsr   Ú__init__ÚFRAME_CONFIGÚgrid_rowconfigureÚ	enumerateÚgrid_columnconfigurer   ÚLABEL_CONFIGÚappendÚgridÚcolumn_indexr   ÚLISTBOX_CONFIGÚbindÚ_selectÚ_resize_columnÚ	configure)r+   ÚmasterÚcolumnsÚcolumn_weightsÚcnfÚkwÚinclude_labelsÚiÚlabelÚlÚlbs   `          r,   rR   zMultiListbox.__init__>   s�  ø€ ô* �gœsÔ#Üœ5 ›>Ó*ˆGØ"‰Nà!ˆNäˆw‹<˜1ÒÜÐ;Ó<Ð<ô # 7›^ˆÔØˆŒØˆŒð Ð!Ø˜S¤3 w£<Ñ/‰NÜ�Ó ¤C¨£LÒ0ÜÐIÓJÐJØ-ˆÔô 	�‰�t˜VÑ9 t×'8Ñ'8Ò9Ø×Ñ˜q¨ÐÔ+Ü! $×"4Ñ"4Ó5ó 	7‰HˆAˆuØ×%Ñ% a°¸qÑ0AÐ%ÔBñ Ü˜$Ñ@ UÐ@¨d×.?Ñ.?Ñ@�Ø—‘×#Ñ# AÔ&Ø—‘˜a Q¨v¸AÀA�ÔFØ!"�”ô ˜Ñ5 ×!4Ñ!4Ñ5ˆBØ�O‰O×"Ñ" 2Ô&Ø�G‰G˜1 !¨F¸ÀˆGÔCØˆBŒOð �G‰G�L $§,¡,Ô/Ø�G‰G�M 4§<¡<Ô0à�G‰G�LÓ"<Ô=Ø�G‰G�LÓ"<Ô=Ø�G‰G�NÓ$CÔDà�G‰G�LÓ"DÔEØ�G‰G�MÓ#GÔHð �G‰G�LÑ"3Ô4à�G‰G�L $×"5Ñ"5Ö6ð=	7ðD 	�	‰	�, × 3Ñ 3Ô4ð 	�	‰	�&Ó9Ô:Ø�	‰	�(Ó:Ô;Ø�	‰	�)ÓKÔLØ�	‰	�(ÓIÔJð 	ˆ�‰�sÑ!˜bÓ!r/   c                 ó
  — |j                   j                  d«      ryd| _        |j                   | u r`t        | j                  «      D ]G  \  }}t        |j                  |j                  «       |j                  «       z   z
  «      dk  sŒA|| _        ŒI nŒ|j                  |j                   j                  «       dz
  kD  r|j                   j                  | _        nF|j                  dk  r7|j                   j                  dk7  r|j                   j                  dz
  | _        | j                  �Z|j                   j                  d| j                  «       |j                   j                  d	|j                  z  | j                  «       y
y)zô
        Callback used to resize a column of the table.  Return ``True``
        if the column is actually getting resized (if the user clicked
        on the far left or far right 5 pixels of a label); and
        ``False`` otherwies.
        z<ButtonRelease>FNé
   é   r   r
   ú<Motion>ú<ButtonRelease-%d>T)Úwidgetr\   Ú_resize_column_indexrU   rO   Úabsr6   Úwinfo_xÚwinfo_widthrZ   Ú_resize_column_motion_cbÚnumÚ_resize_column_buttonrelease_cb)r+   Úeventrf   ri   s       r,   r^   zMultiListbox._resize_columnœ   s7  € ð �<‰<×ÑÐ.Ô/Øð %)ˆÔ!Ø�<‰<˜4ÑÜ" 4§?¡?Ó3ò 2‘��2Ü�u—w‘w "§*¡*£,°·±Ó1AÑ"AÑBÓCÀbÓHØ01�DÕ-ñ2ð �W‰W˜Ÿ™×0Ñ0Ó2°QÑ6Ò7Ø(-¯©×(AÑ(AˆDÕ%Ø�W‰W�qŠ[˜UŸ\™\×6Ñ6¸!Ò;Ø(-¯©×(AÑ(AÀAÑ(EˆDÔ%ð ×$Ñ$Ð0Ø�L‰L×Ñ˜j¨$×*GÑ*GÔHØ�L‰L×ÑØ$ u§y¡yÑ0°$×2VÑ2Vôð àr/   c                 ó:  — | j                   | j                     }|j                  «       |d   z  }|j                  |j                  j                  «       z   }|j                  «       |j                  «       z   }t        dt        |d   ||z
  |z  z   «      «      |d<   y )NÚwidthé   )rO   rp   rs   r6   ro   rr   ÚmaxrH   )r+   rw   ri   Ú	charwidthÚx1Úx2s         r,   rt   z%MultiListbox._resize_column_motion_cb½   s„   € Ø�_‰_˜T×6Ñ6Ñ7ˆØ—N‘NÓ$ r¨'¡{Ñ2ˆ	à�W‰W�u—|‘|×+Ñ+Ó-Ñ-ˆØ�Z‰Z‹\˜BŸN™NÓ,Ñ,ˆä˜!œS  G¡°°R±¸IÑ/EÑ!EÓFÓGˆˆ7Šr/   c                 óŠ   — |j                   j                  d|j                  z  «       |j                   j                  d«       y )Nrn   rm   )ro   Úunbindru   )r+   rw   s     r,   rv   z,MultiListbox._resize_column_buttonrelease_cbÆ   s0   € Ø�‰×ÑÐ0°5·9±9Ñ<Ô=Ø�‰×Ñ˜JÕ'r/   c                 ó   — | j                   S )zh
        A tuple containing the names of the columns used by this
        multi-column listbox.
        )rN   ©r+   s    r,   Úcolumn_nameszMultiListbox.column_namesÎ   s   € ð ×!Ñ!Ð!r/   c                 ó,   — t        | j                  «      S )aÉ  
        A tuple containing the ``Tkinter.Label`` widgets used to
        display the label of each column.  If this multi-column
        listbox was created without labels, then this will be an empty
        tuple.  These widgets will all be augmented with a
        ``column_index`` attribute, which can be used to determine
        which column they correspond to.  This can be convenient,
        e.g., when defining callbacks for bound events.
        )rM   rP   r‚   s    r,   Úcolumn_labelszMultiListbox.column_labelsÖ   s   € ô �T—\‘\Ó"Ð"r/   c                 ó,   — t        | j                  «      S )aY  
        A tuple containing the ``Tkinter.Listbox`` widgets used to
        display individual columns.  These widgets will all be
        augmented with a ``column_index`` attribute, which can be used
        to determine which column they correspond to.  This can be
        convenient, e.g., when defining callbacks for bound events.
        )rM   rO   r‚   s    r,   Ú	listboxeszMultiListbox.listboxesã   s   € ô �T—_‘_Ó%Ð%r/   c                 óÖ   — |j                   j                  |j                  «      }| j                  dd«       | j	                  |«       | j                  |«       | j                  «        y )Nr   Úend)ro   Únearestr7   Úselection_clearÚselection_setÚactivateÚfocus)r+   r*   rf   s      r,   r]   zMultiListbox._selectò   sM   € Ø�H‰H×Ñ˜QŸS™SÓ!ˆØ×Ñ˜Q Ô&Ø×Ñ˜1ÔØ�‰�aÔØ�
‰
�r/   c                 óJ   — | j                   D ]  }|j                  |d«       Œ y)NÚunitr;   ©rO   Úyview_scroll)r+   r3   ri   s      r,   r(   zMultiListbox._scrollù   s&   € Ø—/‘/ò 	+ˆBØ�O‰O˜E 6Õ*ð	+àr/   c                 ól   — t        | j                  d«      «      t        | j                  d«      «      z
  S )z2:return: The number of rows that makes up one pagez
@0,1000000z@0,0)rH   Úindexr‚   s    r,   rE   zMultiListbox._pagesizeþ   s)   € ä�4—:‘:˜lÓ+Ó,¬s°4·:±:¸fÓ3EÓ/FÑFÐFr/   c                 ój  — |�|�t        d«      ‚|�At        | j                  «       «      dk(  rd|z   }nt        | j                  «       d   «      |z   }| j	                  dd«       |�Mt        t        |d«      | j                  «       dz
  «      }| j                  |«       |r| j                  |«       yyy)aÒ  
        Set the selected row.  If ``index`` is specified, then select
        row ``index``.  Otherwise, if ``delta`` is specified, then move
        the current selection by ``delta`` (negative numbers for up,
        positive numbers for down).  This will not move the selection
        past the top or the bottom of the list.

        :param see: If true, then call ``self.see()`` with the newly
            selected index, to ensure that it is visible.
        Nz$specify index or delta, but not bothr   r&   r‰   r
   )
rL   rK   ÚcurselectionrH   r‹   Úminr{   ÚsizerŒ   Úsee©r+   r”   r3   r™   s       r,   r@   zMultiListbox.select  s»   € ð Ð EÐ$5ÜÐCÓDÐDð ÐÜ�4×$Ñ$Ó&Ó'¨1Ò,Ø˜U™
‘ä˜D×-Ñ-Ó/°Ñ2Ó3°eÑ;�ð 	×Ñ˜Q Ô&ð ÐÜœ˜E 1› t§y¡y£{°Q¡Ó7ˆEà×Ñ˜uÔ%ÙØ—‘˜•ð ð	 r/   c                 ó  — t        t        |j                  «       «      t        |j                  «       «      z   «      }t        |j                  «       «      D ]±  \  }}|j                  d«      s|j                  d«      r(| j                  D ]  }|j                  |dd |i«       Œ ŒP|j                  d«      s|j                  d«      r(| j                  D ]  }|j                  |dd |i«       Œ Œšt        j
                  | ||i«       Œ³ y)a¢  
        Configure this widget.  Use ``label_*`` to configure all
        labels; and ``listbox_*`` to configure all listboxes.  E.g.:

                >>> master = Tk()  # doctest: +SKIP
                >>> mlb = MultiListbox(master, 5)  # doctest: +SKIP
                >>> mlb.configure(label_foreground='red')  # doctest: +SKIP
                >>> mlb.configure(listbox_foreground='red')  # doctest: +SKIP
        Úlabel_zlabel-é   NÚlistbox_zlistbox-é   )ÚdictrI   ÚitemsÚ
startswithrP   r_   rO   r   )r+   rc   rd   ÚkeyÚvalrg   Úlistboxs          r,   r_   zMultiListbox.configure*  sÝ   € ô ”4˜Ÿ	™	›Ó$¤t¨B¯H©H«JÓ'7Ñ7Ó8ˆÜ˜SŸY™Y›[Ó)ò 	2‰HˆC�Ø�~‰~˜hÔ'¨3¯>©>¸(Ô+CØ!Ÿ\™\ò 4�EØ—O‘O S¨¨ W¨c NÕ3ñ4à—‘ 
Ô+¨s¯~©~¸jÔ/IØ#Ÿ™ò 6�GØ×%Ñ% s¨1¨2 w° nÕ5ñ6ô —‘  s¨C jÕ1ñ	2r/   c                 ó*   — | j                  ||i«       y)z|
        Configure this widget.  This is equivalent to
        ``self.configure({key,val``)}.  See ``configure()``.
        N)r_   )r+   r£   r¤   s      r,   Ú__setitem__zMultiListbox.__setitem__?  s   € ð
 	�‰˜˜S�zÕ"r/   c                 óN   — | j                   D ]  } |j                  ||fi |¤Ž Œ y)zÇ
        Configure all table cells in the given row.  Valid keyword
        arguments are: ``background``, ``bg``, ``foreground``, ``fg``,
        ``selectbackground``, ``selectforeground``.
        N©rO   Úitemconfigure)r+   Ú	row_indexrc   rd   ri   s        r,   ÚrowconfigurezMultiListbox.rowconfigureF  s.   € ð —/‘/ò 	3ˆBØˆB×Ñ˜Y¨Ñ2¨rÓ2ñ	3r/   c                 óp  — | j                   |   }t        t        |j                  «       «      t        |j                  «       «      z   «      }t        |j                  «       «      D ]O  \  }}|dv r3t	        |j                  «       «      D ]  }|j                  |||i«       Œ Œ=|j                  ||i«       ŒQ y)zÊ
        Configure all table cells in the given column.  Valid keyword
        arguments are: ``background``, ``bg``, ``foreground``, ``fg``,
        ``selectbackground``, ``selectforeground``.
        )r   Úbgr   Úfgr   ÚselectforegroundN)rO   r    rI   r¡   rJ   r˜   rª   r_   )r+   Ú	col_indexrc   rd   ri   r£   r¤   rf   s           r,   ÚcolumnconfigurezMultiListbox.columnconfigureO  s¤   € ð �_‰_˜YÑ'ˆä”4˜Ÿ	™	›Ó$¤t¨B¯H©H«JÓ'7Ñ7Ó8ˆÜ˜SŸY™Y›[Ó)ò 	)‰HˆC�Øð ñ ô ˜rŸw™w›yÓ)ò 4�AØ×$Ñ$ Q¨¨c¨
Õ3ñ4ð —‘˜c 3˜ZÕ(ñ	)r/   c                 óH   — | j                   |   } |j                  ||fi |¤ŽS )zÑ
        Configure the table cell at the given row and column.  Valid
        keyword arguments are: ``background``, ``bg``, ``foreground``,
        ``fg``, ``selectbackground``, ``selectforeground``.
        r©   )r+   r«   r±   rc   rd   ri   s         r,   rª   zMultiListbox.itemconfiguref  s,   € ð �_‰_˜YÑ'ˆØˆr×Ñ 	¨3Ñ5°"Ñ5Ð5r/   c                 óê   — |D ].  }t        |«      t        | j                  «      k7  sŒ%t        d«      ‚ t        | j                  t        t        |Ž «      «      D ]  \  }} |j                  |g|¢­Ž  Œ y)a0  
        Insert the given row or rows into the table, at the given
        index.  Each row value should be a tuple of cell values, one
        for each column in the row.  Index may be an integer or any of
        the special strings (such as ``'end'``) accepted by
        ``Tkinter.Listbox``.
        zDrows should be tuples whose length is equal to the number of columnsN)rK   rN   rL   ÚziprO   rI   Úinsert)r+   r”   ÚrowsÚeltri   Úeltss         r,   r¶   zMultiListbox.inserts  sx   € ð ò 	ˆCÜ�3‹xœ3˜t×1Ñ1Ó2Ó2Ü ð8óð ð	ô ˜DŸO™O¬T´#°t°*Ó-=Ó>ò 	$‰HˆB�ØˆB�I‰I�eÐ#˜dÔ#ñ	$r/   c                 óÀ   — | j                   D �cg c]  }|j                  ||«      ‘Œ }}|rt        |Ž D �cg c]  }t        |«      ‘Œ c}S t        |«      S c c}w c c}w )a  
        Return the value(s) of the specified row(s).  If ``last`` is
        not specified, then return a single row value; otherwise,
        return a list of row values.  Each row value is a tuple of
        cell values, one for each column in the row.
        )rO   Úgetrµ   rM   )r+   ÚfirstÚlastri   Úvaluesr    s         r,   r»   zMultiListbox.get„  sU   € ð 15·±Ö@¨"�"—&‘&˜ Õ%Ð@ˆÐ@ÙÜ*-¨v¨,Ö7 3”E˜#•JÒ7Ð7ä˜“=Ð ùò	 Aùâ7s
   �A¶Ac                 óü   — | j                  d|¬«      \  }}}}| j                  |   j                  |«      \  }}}}	t        |«      t        |«      z   t        |«      t        |«      z   t        |«      t        |	«      fS )zÇ
        Return the bounding box for the given table cell, relative to
        this widget's top-left corner.  The bounding box is a tuple
        of integers ``(left, top, width, height)``.
        r   )r    r   )Ú	grid_bboxrO   ÚbboxrH   )
r+   r    ÚcolÚdxÚdyÚ_r6   r7   ÚwÚhs
             r,   rÁ   zMultiListbox.bbox‘  sp   € ð —~‘~¨!°C�~Ó8‰ˆˆB��1Ø—_‘_ SÑ)×.Ñ.¨sÓ3‰
ˆˆ1ˆa�Ü�1‹vœ˜B›Ñ¤ Q£¬#¨b«'Ñ!1´3°q³6¼3¸q»6ÐAÐAr/   c                 ó¶   — | j                   r| j                   |   j                  «        | j                  |   j                  «        | j                  |d¬«       y)a1  
        Hide the given column.  The column's state is still
        maintained: its values will still be returned by ``get()``, and
        you must supply its values when calling ``insert()``.  It is
        safe to call this on a column that is already hidden.

        :see: ``show_column()``
        r   r   N)rP   Úgrid_forgetr‡   rV   )r+   r±   s     r,   Úhide_columnzMultiListbox.hide_columnŸ  sH   € ð �<Š<Ø�L‰L˜Ñ#×/Ñ/Ô1Ø�‰�yÑ!×-Ñ-Ô/Ø×!Ñ! )°AÐ!Õ6r/   c                 óì   — | j                   |   }| j                  r#| j                  |   j                  |dddd¬«       | j                  |   j                  |dddd¬«       | j	                  ||¬«       y)z�
        Display a column that has been hidden using ``hide_column()``.
        It is safe to call this on a column that is not hidden.
        r   r   r   r
   r   N)rQ   rP   rY   rO   rV   )r+   r±   r   s      r,   Úshow_columnzMultiListbox.show_column­  s€   € ð
 ×%Ñ% iÑ0ˆØ�<Š<Ø�L‰L˜Ñ#×(Ñ(Ø  a°¸QÀQð )ô ð 	�‰˜	Ñ"×'Ñ'Ø !¨F¸Àð 	(ô 	
ð 	×!Ñ! )°FÐ!Õ;r/   c                 ób   — | j                   D �cg c]  }|j                  |||«      ‘Œ c}S c c}w )aK  
        Add a binding to each ``Tkinter.Label`` widget in this
        mult-column listbox that will call ``func`` in response to the
        event sequence.

        :return: A list of the identifiers of replaced binding
            functions (if any), allowing for their deletion (to
            prevent a memory leak).
        )r…   r\   )r+   ÚsequenceÚfuncÚaddrg   s        r,   Úbind_to_labelszMultiListbox.bind_to_labelsÀ  s,   € ð >B×=OÑ=OÖP°E�—
‘
˜8 T¨3Õ/ÒPÐPùÒPs   �,c                 óL   — | j                   D ]  }|j                  |||«       Œ y)aM  
        Add a binding to each ``Tkinter.Listbox`` widget in this
        mult-column listbox that will call ``func`` in response to the
        event sequence.

        :return: A list of the identifiers of replaced binding
            functions (if any), allowing for their deletion (to
            prevent a memory leak).
        N)r‡   r\   )r+   rÎ   rÏ   rÐ   r¥   s        r,   Úbind_to_listboxeszMultiListbox.bind_to_listboxesÌ  s'   € ð —~‘~ò 	.ˆGØ�L‰L˜ 4¨Õ-ñ	.r/   c                 óP   — | j                  |||«      | j                  |||«      z   S )ac  
        Add a binding to each ``Tkinter.Label`` and ``Tkinter.Listbox``
        widget in this mult-column listbox that will call ``func`` in
        response to the event sequence.

        :return: A list of the identifiers of replaced binding
            functions (if any), allowing for their deletion (to
            prevent a memory leak).
        )rÑ   rÓ   ©r+   rÎ   rÏ   rÐ   s       r,   Úbind_to_columnszMultiListbox.bind_to_columnsÙ  s4   € ð ×"Ñ" 8¨T°3Ó7¸$×:PÑ:PØ�d˜Có;
ñ 
ð 	
r/   c                 ó@   —  | j                   d   j                  |i |¤ŽS ©Nr   )rO   r–   ©r+   ÚargsÚkwargss      r,   r–   zMultiListbox.curselectionì  s#   € Ø.ˆt�‰˜qÑ!×.Ñ.°Ð?¸Ñ?Ð?r/   c                 ó@   —  | j                   d   j                  |i |¤ŽS rØ   )rO   Úselection_includesrÙ   s      r,   rÝ   zMultiListbox.selection_includesï  s#   € Ø4ˆt�‰˜qÑ!×4Ñ4°dÐE¸fÑEÐEr/   c                 ó@   —  | j                   d   j                  |i |¤ŽS rØ   )rO   ÚitemcgetrÙ   s      r,   rß   zMultiListbox.itemcgetò  s#   € Ø*ˆt�‰˜qÑ!×*Ñ*¨DÐ;°FÑ;Ð;r/   c                 ó@   —  | j                   d   j                  |i |¤ŽS rØ   )rO   r˜   rÙ   s      r,   r˜   zMultiListbox.sizeõ  s#   € Ø&ˆt�‰˜qÑ!×&Ñ&¨Ð7°Ñ7Ð7r/   c                 ó@   —  | j                   d   j                  |i |¤ŽS rØ   )rO   r”   rÙ   s      r,   r”   zMultiListbox.indexø  s#   € Ø'ˆt�‰˜qÑ!×'Ñ'¨Ð8°Ñ8Ð8r/   c                 ó@   —  | j                   d   j                  |i |¤ŽS rØ   )rO   rŠ   rÙ   s      r,   rŠ   zMultiListbox.nearestû  s#   € Ø)ˆt�‰˜qÑ!×)Ñ)¨4Ð:°6Ñ:Ð:r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   r�   ©r+   rÚ   rÛ   ri   s       r,   r�   zMultiListbox.activateÿ  s(   € Ø—/‘/ò 	)ˆBØˆB�K‰K˜Ð( Ó(ñ	)r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   Údeleterä   s       r,   ræ   zMultiListbox.delete  s(   € Ø—/‘/ò 	'ˆBØˆB�I‰I�tÐ&˜vÓ&ñ	'r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   r5   rä   s       r,   r5   zMultiListbox.scan_mark  s(   € Ø—/‘/ò 	*ˆBØˆB�L‰L˜$Ð) &Ó)ñ	*r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   r9   rä   s       r,   r9   zMultiListbox.scan_dragto  s(   € Ø—/‘/ò 	,ˆBØˆB�N‰N˜DÐ+ FÓ+ñ	,r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   r™   rä   s       r,   r™   zMultiListbox.see  s(   € Ø—/‘/ò 	$ˆBØˆB�F‰F�DÐ#˜FÓ#ñ	$r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   Úselection_anchorrä   s       r,   rë   zMultiListbox.selection_anchor  s*   € Ø—/‘/ò 	1ˆBØˆB×Ñ Ð0¨Ó0ñ	1r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   r‹   rä   s       r,   r‹   zMultiListbox.selection_clear  s*   € Ø—/‘/ò 	0ˆBØˆB×Ñ Ð/¨Ó/ñ	0r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   rŒ   rä   s       r,   rŒ   zMultiListbox.selection_set  s*   € Ø—/‘/ò 	.ˆBØˆB×Ñ˜dÐ- fÓ-ñ	.r/   c                 óL   — | j                   D ]  } |j                  |i |¤Ž}Œ S r2   )rO   Úyview)r+   rÚ   rÛ   ri   Úvs        r,   rï   zMultiListbox.yview  s/   € Ø—/‘/ò 	*ˆBØ�—‘˜$Ð) &Ñ)‰Að	*àˆr/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   )rO   Úyview_movetorä   s       r,   rò   zMultiListbox.yview_moveto$  ó(   € Ø—/‘/ò 	-ˆBØˆB�O‰O˜TÐ, VÓ,ñ	-r/   c                 óJ   — | j                   D ]  } |j                  |i |¤Ž Œ y r2   r‘   rä   s       r,   r’   zMultiListbox.yview_scroll(  ró   r/   ©NNTr2   ©NNN)9Ú__name__Ú
__module__Ú__qualname__Ú__doc__r    rS   rW   r[   rR   r^   rt   rv   Úpropertyrƒ   r…   r‡   r]   r(   rE   r@   r_   r§   r¬   r²   rª   r¶   r»   rÁ   rÊ   rÌ   rÑ   rÓ   rÖ   r–   rÝ   rß   r˜   r”   rŠ   r�   ræ   r5   r9   r™   rë   r‹   rŒ   rï   rò   r’   Ú
itemconfigÚ	rowconfigÚcolumnconfigÚselect_anchorÚselect_clearÚselect_includesÚ
select_setr<   r/   r,   r	   r	      s’  „ ññ  6°TÈaÔP€Lñ ØØØ!ØØô€Lñ ØØØØØØØô€Nð 8<Àó X"ò|òBHò(ð ñ"ó ð"ð ñ
#ó ð
#ð ñ&ó ð&òòò
Gó ðH ó 2ò*#ð +-ó 3ð .0ó )ó.6ò$ó"!òBò7ò<ó&
Qó.ó
ò&@òFò<ò8ò9ò;ò)ò'ò*ò,ò$ò1ò0ò.òò
-ò-ð €JØ€IØ"€LØ$€MØ"€LØ(€OØ�Jr/   r	   c                   ó  — e Zd ZdZdddddi fd„Zd„ Zd„ Zd„ Zd&d„Zi fd	„Z	i fd
„Z
d'd„Zd&d„Zd&d„Zd&d„Ze	Ze
ZeZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ «       Zd„ Zd„ Zd„ Zd„ Z d(d„Z!d)d„Z"d„ Z#d*d „Z$d!„ Z%d+d#„Z&d,d$„Z'd"Z(	 d%„ Z)y)-ÚTableað  
    A display widget for a table of values, based on a ``MultiListbox``
    widget.  For many purposes, ``Table`` can be treated as a
    list-of-lists.  E.g., table[i] is a list of the values for row i;
    and table.append(row) adds a new row with the given list of
    values.  Individual cells can be accessed using table[i,j], which
    refers to the j-th column of the i-th row.  This can be used to
    both read and write values from the table.  E.g.:

        >>> table[i,j] = 'hello'  # doctest: +SKIP

    The column (j) can be given either as an index number, or as a
    column name.  E.g., the following prints the value in the 3rd row
    for the 'First Name' column:

        >>> print(table[3, 'First Name'])  # doctest: +SKIP
        John

    You can configure the colors for individual rows, columns, or
    cells using ``rowconfig()``, ``columnconfig()``, and ``itemconfig()``.
    The color configuration for each row will be preserved if the
    table is modified; however, when new rows are added, any color
    configurations that have been made for *columns* will not be
    applied to the new row.

    Note: Although ``Table`` acts like a widget in some ways (e.g., it
    defines ``grid()``, ``pack()``, and ``bind()``), it is not itself a
    widget; it just contains one.  This is because widgets need to
    define ``__getitem__()``, ``__setitem__()``, and ``__nonzero__()`` in
    a way that's incompatible with the fact that ``Table`` behaves as a
    list-of-lists.

    :ivar _mlb: The multi-column listbox used to display this table's data.
    :ivar _rows: A list-of-lists used to hold the cell values of this
        table.  Each element of _rows is a row value, i.e., a list of
        cell values, one for each column in the row.
    NTc	                 ój  — t        |«      | _        || _        t        |«      | _        t        |«      D �
�ci c]  \  }
}||
“Œ
 c}}
| _        |€g | _        n%|D ��cg c]  }|D �cg c]  }|‘Œ c}‘Œ c}}| _        | j                  D ]  }| j                  |«       Œ t        | j                  |||fi |	¤Ž| _
        | j                  j                  ddd¬«       |rlt        | j                  d| j                  j                  ¬«      }|j                  | j                  j                  d   d	<   |j                  d
d¬«       || _        d| _        |rCt        | j                  j$                  «      D ]!  \  }
}|j'                  d| j(                  «       Œ# | j+                  «        yc c}}
w c c}w c c}}w )aæ  
        Construct a new Table widget.

        :type master: Tkinter.Widget
        :param master: The widget that should contain the new table.
        :type column_names: list(str)
        :param column_names: A list of names for the columns; these
            names will be used to create labels for each column;
            and can be used as an index when reading or writing
            cell values from the table.
        :type rows: list(list)
        :param rows: A list of row values used to initialize the table.
            Each row value should be a tuple of cell values, one for
            each column in the row.
        :type scrollbar: bool
        :param scrollbar: If true, then create a scrollbar for the
            new table widget.
        :type click_to_sort: bool
        :param click_to_sort: If true, then create bindings that will
            sort the table's rows by a given column's values if the
            user clicks on that colum's label.
        :type reprfunc: function
        :param reprfunc: If specified, then use this function to
            convert each table cell value to a string suitable for
            display.  ``reprfunc`` has the following signature:
            reprfunc(row_index, col_index, cell_value) -> str
            (Note that the column is specified by index, not by name.)
        :param cnf, kw: Configuration parameters for this widget's
            contained ``MultiListbox``.  See ``MultiListbox.__init__()``
            for details.
        NÚleftTÚboth)ÚsideÚexpandÚfillÚvertical)ÚorientÚcommandr   ÚyscrollcommandÚrightr7   )r  r
  r$   )rK   Ú_num_columnsÚ	_reprfuncr   Ú_framerU   Ú_column_name_to_indexÚ_rowsÚ	_checkrowr	   Ú_mlbÚpackr   rï   Úsetr‡   Ú
_scrollbarÚ_sortkeyr…   r\   Ú_sortÚ_fill_table)r+   r`   rƒ   r·   rb   Ú	scrollbarÚclick_to_sortÚreprfuncrc   rd   rf   Úcr    rð   Úsbrh   s                   r,   rR   zTable.__init__l  st  € ôV   Ó-ˆÔØ!ˆŒÜ˜F“mˆŒä9BÀ<Ó9P×%Q©v°°1 a¨¡dÓ%QˆÔ"ð ˆ<ØˆD�Jà6:×;¨s cÖ* š1Ô*Ó;ˆDŒJØ—:‘:ò 	 ˆCØ�N‰N˜3Õð	 ô ! §¡¨l¸NÈCÑVÐSUÑVˆŒ	Ø�	‰	�‰˜F¨4°fˆÔ=ñ Ü˜4Ÿ;™;¨zÀ4Ç9Á9Ç?Á?ÔSˆBØ79·v±vˆD�I‰I×Ñ Ñ"Ð#3Ñ4ð �G‰G˜ sˆGÔ+Ø ˆDŒOð ˆŒÙÜ! $§)¡)×"9Ñ"9Ó:ò 1‘��1Ø—‘�| T§Z¡ZÕ0ð1ð 	×ÑÕùó= &Rùò +ùÓ;s   ¶F$Á	F/Á$	F*Á-F/Æ*F/c                 ó<   —  | j                   j                  |i |¤Ž y)zrPosition this table's main frame widget in its parent
        widget.  See ``Tkinter.Frame.pack()`` for more info.N)r  r  rÙ   s      r,   r  z
Table.packÀ  ó   € ð 	ˆ�‰×Ñ˜$Ð) &Ó)r/   c                 ó<   —  | j                   j                  |i |¤Ž y)zrPosition this table's main frame widget in its parent
        widget.  See ``Tkinter.Frame.grid()`` for more info.N)r  rY   rÙ   s      r,   rY   z
Table.gridÅ  r#  r/   c                 ó8   — | j                   j                  «        y)z-Direct (keyboard) input foxus to this widget.N)r  rŽ   r‚   s    r,   rŽ   zTable.focusÊ  s   € à�	‰	�‰Õr/   c                 ó>   — | j                   j                  |||«       y)zkAdd a binding to this table's main frame that will call
        ``func`` in response to the event sequence.N)r  r\   rÕ   s       r,   r\   z
Table.bindÎ  s   € ð 	�	‰	�‰�x  sÕ+r/   c                 ó@   —  | j                   j                  ||fi |¤Ž y)z%:see: ``MultiListbox.rowconfigure()``N)r  r¬   )r+   r«   rc   rd   s       r,   r¬   zTable.rowconfigureÓ  s   € àˆ�	‰	×Ñ˜y¨#Ñ4°Ó4r/   c                 ób   — | j                  |«      } | j                  j                  ||fi |¤Ž y)z(:see: ``MultiListbox.columnconfigure()``N)rZ   r  r²   )r+   r±   rc   rd   s       r,   r²   zTable.columnconfigure×  s-   € à×%Ñ% iÓ0ˆ	Ø!ˆ�	‰	×!Ñ! )¨SÑ7°BÓ7r/   c                 ób   — | j                  |«      } | j                  j                  |||fi |¤ŽS )z&:see: ``MultiListbox.itemconfigure()``)rZ   r  rª   )r+   r«   r±   rc   rd   s        r,   rª   zTable.itemconfigureÜ  s2   € à×%Ñ% iÓ0ˆ	Ø&ˆt�y‰y×&Ñ& y°)¸SÑGÀBÑGÐGr/   c                 ó<   — | j                   j                  |||«      S )z':see: ``MultiListbox.bind_to_labels()``)r  rÑ   rÕ   s       r,   rÑ   zTable.bind_to_labelsá  s   € à�y‰y×'Ñ'¨°$¸Ó<Ð<r/   c                 ó<   — | j                   j                  |||«      S )z*:see: ``MultiListbox.bind_to_listboxes()``)r  rÓ   rÕ   s       r,   rÓ   zTable.bind_to_listboxeså  s   € à�y‰y×*Ñ*¨8°T¸3Ó?Ð?r/   c                 ó<   — | j                   j                  |||«      S )z(:see: ``MultiListbox.bind_to_columns()``)r  rÖ   rÕ   s       r,   rÖ   zTable.bind_to_columnsé  s   € à�y‰y×(Ñ(¨°4¸Ó=Ð=r/   c           	      óP  — | j                  |«       | j                  j                  ||«       | j                  �.t	        |«      D ��cg c]  \  }}| j                  |||«      ‘Œ }}}| j
                  j                  ||«       | j                  r| j                  «        yyc c}}w )aT  
        Insert a new row into the table, so that its row index will be
        ``row_index``.  If the table contains any rows whose row index
        is greater than or equal to ``row_index``, then they will be
        shifted down.

        :param rowvalue: A tuple of cell values, one for each column
            in the new row.
        N)r  r  r¶   r  rU   r  Ú_DEBUGÚ_check_table_vs_mlb)r+   r«   ÚrowvalueÚjrð   s        r,   r¶   zTable.insertõ  s‘   € ð 	�‰�xÔ Ø�
‰
×Ñ˜) XÔ.Ø�>‰>Ð%ä>GÈÓ>Q÷Ù4:°Q¸�—‘˜y¨!¨QÕ/ðˆHñ ð 	�	‰	×Ñ˜ HÔ-Ø�;Š;Ø×$Ñ$Õ&ð ùó	s   ÁB"c                 ón   — |D ]  }| j                  |«       Œ | j                  r| j                  «        yy)zï
        Add new rows at the end of the table.

        :param rowvalues: A list of row values used to initialize the
            table.  Each row value should be a tuple of cell values,
            one for each column in the row.
        N)rX   r.  r/  )r+   Ú	rowvaluesr0  s      r,   ÚextendzTable.extend	  s7   € ð "ò 	"ˆHØ�K‰K˜Õ!ð	"à�;Š;Ø×$Ñ$Õ&ð r/   c                 óˆ   — | j                  t        | j                  «      |«       | j                  r| j	                  «        yy)zš
        Add a new row to the end of the table.

        :param rowvalue: A tuple of cell values, one for each column
            in the new row.
        N)r¶   rK   r  r.  r/  ©r+   r0  s     r,   rX   zTable.append  s2   € ð 	�‰”C˜Ÿ
™
“O XÔ.Ø�;Š;Ø×$Ñ$Õ&ð r/   c                 ó„   — g | _         | j                  j                  dd«       | j                  r| j	                  «        yy)z0
        Delete all rows in this table.
        r   r‰   N)r  r  ræ   r.  r/  r‚   s    r,   ÚclearzTable.clear!  s7   € ð ˆŒ
Ø�	‰	×Ñ˜˜EÔ"Ø�;Š;Ø×$Ñ$Õ&ð r/   c                 óò   — t        |t        «      rt        d«      ‚t        |t        «      r5t	        |«      dk(  r'| j
                  |d      | j                  |d   «         S t        | j
                  |   «      S )a‹  
        Return the value of a row or a cell in this table.  If
        ``index`` is an integer, then the row value for the ``index``th
        row.  This row value consists of a tuple of cell values, one
        for each column in the row.  If ``index`` is a tuple of two
        integers, ``(i,j)``, then return the value of the cell in the
        ``i``th row and the ``j``th column.
        úSlicing not supportedé   r   r
   )rG   ÚslicerL   rM   rK   r  rZ   )r+   r”   s     r,   Ú__getitem__zTable.__getitem__*  si   € ô �eœUÔ#ÜÐ4Ó5Ð5Ü˜œuÔ%¬#¨e«*¸ª/Ø—:‘:˜e A™hÑ'¨×(9Ñ(9¸%À¹(Ó(CÑDÐDä˜Ÿ™ EÑ*Ó+Ð+r/   c           	      ó†  — t        |t        «      rt        d«      ‚t        |t        «      rÐt	        |«      dk(  rÂ|d   | j                  |d   «      }}| j                  |g«      }|| j                  |   |<   | j                  �| j                  |||«      }| j                  j                  |   j                  ||«       | j                  j                  |   j                  |dz   «       | j                  |«       y| j                  |g«      }| j                  |«       t        |«      | j                  |<   | j                  �.t!        |«      D ��cg c]  \  }}| j                  |||«      ‘Œ }}}| j                  j                  ||«       | j                  j                  |dz   «       | j                  |«       yc c}}w )aú  
        Replace the value of a row or a cell in this table with
        ``val``.

        If ``index`` is an integer, then ``val`` should be a row value
        (i.e., a tuple of cell values, one for each column).  In this
        case, the values of the ``index``th row of the table will be
        replaced with the values in ``val``.

        If ``index`` is a tuple of integers, ``(i,j)``, then replace the
        value of the cell in the ``i``th row and ``j``th column with
        ``val``.
        r:  r;  r   r
   N)rG   r<  rL   rM   rK   rZ   Ú_save_config_infor  r  r  r‡   r¶   ræ   Ú_restore_config_infor  rI   rU   )r+   r”   r¤   rf   r1  Úconfig_cookierð   s          r,   r§   zTable.__setitem__:  s|  € ô �eœUÔ#ÜÐ4Ó5Ð5ô ˜œuÔ%¬#¨e«*¸ª/Ø˜‘8˜T×.Ñ.¨u°Q©xÓ8ˆqˆAØ ×2Ñ2°A°3Ó7ˆMØ"ˆD�J‰J�q‰M˜!ÑØ�~‰~Ð)Ø—n‘n Q¨¨3Ó/�Ø�I‰I×Ñ Ñ"×)Ñ)¨!¨SÔ1Ø�I‰I×Ñ Ñ"×)Ñ)¨!¨a©%Ô0Ø×%Ñ% mÕ4ð !×2Ñ2°E°7Ó;ˆMØ�N‰N˜3ÔÜ $ S£	ˆD�J‰J�uÑØ�~‰~Ð)ÜAJÈ3Ã×P±v¸¸1�t—~‘~ e¨Q°Õ2ÐP�ÑPØ�I‰I×Ñ˜U CÔ(Ø�I‰I×Ñ˜U Q™YÔ'Ø×%Ñ% mÕ4ùó Qs   ÅF=c                 ó  — t        |t        «      rt        d«      ‚t        |t        «      rt	        |«      dk(  rt        d«      ‚| j
                  |= | j                  j                  |«       | j                  r| j                  «        yy)zA
        Delete the ``row_index``th row from this table.
        r:  r;  zCannot delete a single cell!N)
rG   r<  rL   rM   rK   r  r  ræ   r.  r/  )r+   r«   s     r,   Ú__delitem__zTable.__delitem__a  sq   € ô �i¤Ô'ÜÐ4Ó5Ð5Ü�i¤Ô'¬C°	«N¸aÒ,?ÜÐ;Ó<Ð<Ø�J‰J�yÐ!Ø�	‰	×Ñ˜Ô#Ø�;Š;Ø×$Ñ$Õ&ð r/   c                 ó,   — t        | j                  «      S )z<
        :return: the number of rows in this table.
        )rK   r  r‚   s    r,   Ú__len__zTable.__len__n  s   € ô �4—:‘:‹Ðr/   c                 ó|   — t        |«      | j                  k7  r$t        d|t        |«      | j                  fz  «      ‚y)z‹
        Helper function: check that a given row value has the correct
        number of elements; and if not, raise an exception.
        z"Row %r has %d columns; expected %dN)rK   r  rL   r6  s     r,   r  zTable._checkrowt  sD   € ô
 ˆx‹=˜D×-Ñ-Ò-ÜØ4ØœS ›]¨D×,=Ñ,=Ð>ñ?óð ð .r/   c                 ó.   — | j                   j                  S )z1A list of the names of the columns in this table.)r  rƒ   r‚   s    r,   rƒ   zTable.column_namesƒ  s   € ð �y‰y×%Ñ%Ð%r/   c                 óp   — t        |t        «      rd|cxk  r| j                  k  r|S  | j                  |   S )zö
        If ``i`` is a valid column index integer, then return it as is.
        Otherwise, check if ``i`` is used as the name for any column;
        if so, return that column's index.  Otherwise, raise a
        ``KeyError`` exception.
        r   )rG   rH   r  r  )r+   rf   s     r,   rZ   zTable.column_indexˆ  s=   € ô �aœÔ ! qÔ"<¨4×+<Ñ+<Ò"<ØˆHð #=ð ×-Ñ-¨aÑ0Ð0r/   c                 óX   — | j                   j                  | j                  |«      «       y)z$:see: ``MultiListbox.hide_column()``N)r  rÊ   rZ   ©r+   rZ   s     r,   rÊ   zTable.hide_column•  ó   € à�	‰	×Ñ˜d×/Ñ/°Ó=Õ>r/   c                 óX   — | j                   j                  | j                  |«      «       y)z$:see: ``MultiListbox.show_column()``N)r  rÌ   rZ   rJ  s     r,   rÌ   zTable.show_column™  rK  r/   c                 óX   — | j                   j                  «       }|rt        |d   «      S y)z³
        Return the index of the currently selected row, or None if
        no row is selected.  To get the row value itself, use
        ``table[table.selected_row()]``.
        r   N)r  r–   rH   )r+   Úsels     r,   Úselected_rowzTable.selected_row¡  s*   € ð �i‰i×$Ñ$Ó&ˆÙÜ�s˜1‘v“;Ðàr/   c                 ó>   — | j                   j                  |||«       y)z:see: ``MultiListbox.select()``N)r  r@   rš   s       r,   r@   zTable.select­  s   € à�	‰	×Ñ˜  sÕ+r/   c                 ó¼  — |dvrt        d«      ‚| j                  |«      }| j                  d¬«      }|dk(  r*|| j                  k(  r| j                  j                  «        n:| j                  j                  t        j                  |«      |dk(  ¬«       || _        | j                  «        | j                  |dd¬«       | j                  r| j                  «        y	y	)
aÒ  
        Sort the rows in this table, using the specified column's
        values as a sort key.

        :param column_index: Specifies which column to sort, using
            either a column index (int) or a column's label name
            (str).

        :param order: Specifies whether to sort the values in
            ascending or descending order:

              - ``'ascending'``: Sort from least to greatest.
              - ``'descending'``: Sort from greatest to least.
              - ``'toggle'``: If the most recent call to ``sort_by()``
                sorted the table by the same column (``column_index``),
                then reverse the rows; otherwise sort in ascending
                order.
        )Ú	ascendingÚ
descendingÚtogglezBsort_by(): order should be "ascending", "descending", or "toggle".T)Úindex_by_idrT  rS  )r£   Úreverse)rU  r™   N)rL   rZ   r?  r  r  rV  ÚsortÚoperatorÚ
itemgetterr  r@  r.  r/  )r+   rZ   ÚorderrA  s       r,   Úsort_byzTable.sort_byµ  sÕ   € ð& Ð=Ñ=ÜØWóð ð ×(Ñ(¨Ó6ˆØ×.Ñ.¸4Ð.Ó@ˆð �HÒ °·±Ò!>Ø�J‰J×ÑÕ à�J‰J�O‰OÜ×'Ñ'¨Ó5ÀÈÑ@Uð ô ð )ˆDŒMð 	×ÑÔØ×!Ñ! -¸TÀtÐ!ÔLØ�;Š;Ø×$Ñ$Õ&ð r/   c                 óŠ   — |j                   j                  }| j                  j                  |«      ry| j	                  |«       y)zLEvent handler for clicking on a column label -- sort by
        that column.Úcontinue)ro   rZ   r  r^   r[  )r+   rw   rZ   s      r,   r  zTable._sortÞ  s;   € ð —|‘|×0Ñ0ˆð �9‰9×#Ñ# EÔ*Øð �L‰L˜Ô&Ør/   c           
      ó.  — | j                   j                  dd«       t        | j                  «      D ][  \  }}| j                  �.t        |«      D ��cg c]  \  }}| j	                  |||«      ‘Œ }}}| j                   j                  d|«       Œ] yc c}}w )a„  
        Re-draw the table from scratch, by clearing out the table's
        multi-column listbox; and then filling it in with values from
        ``self._rows``.  Note that any cell-, row-, or column-specific
        color configuration that has been done will be lost.  The
        selection will also be lost -- i.e., no row will be selected
        after this call completes.
        r   r‰   N)r  ræ   rU   r  r  r¶   )r+   Úsave_configrf   r    r1  rð   s         r,   r  zTable._fill_tableñ  s}   € ð 	�	‰	×Ñ˜˜EÔ"Ü §
¡
Ó+ò 	)‰FˆAˆsØ�~‰~Ð)Ü=FÀs»^×L±6°A°q�t—~‘~ a¨¨AÕ.ÐL�ÑLØ�I‰I×Ñ˜U CÕ(ñ	)ùãLs   ÁBc           	      ój   — dD �ci c]#  }|| j                   j                  |||«      d   “Œ% c}S c c}w )N)r   r°   r   r   r&   )r  rü   )r+   Úrr   Úks       r,   Ú_get_itemconfigzTable._get_itemconfig   sA   € ðö
àð ˆt�y‰y×#Ñ# A q¨!Ó,¨RÑ0Ñ0ò
ð 	
ùò 
s   …(0Fc                 ó$  — |€'t        t        t        | j                  «      «      «      }| j	                  «       }|r|�t        | j                  |   «      }|r]|D ��ci c]L  }t        | j                  |   «      t        | j                  «      D �cg c]  }| j                  ||«      ‘Œ c}“ŒN }}}||fS |D ��ci c]6  }|t        | j                  «      D �cg c]  }| j                  ||«      ‘Œ c}“Œ8 }}}||fS c c}w c c}}w c c}w c c}}w )a*  
        Return a 'cookie' containing information about which row is
        selected, and what color configurations have been applied.
        this information can the be re-applied to the table (after
        making modifications) using ``_restore_config_info()``.  Color
        configuration information will be saved for any rows in
        ``row_indices``, or in the entire table, if
        ``row_indices=None``.  If ``index_by_id=True``, the the cookie
        will associate rows with their configuration information based
        on the rows' python id.  This is useful when performing
        operations that re-arrange the rows (e.g. ``sort``).  If
        ``index_by_id=False``, then it is assumed that all rows will be
        in the same order when ``_restore_config_info()`` is called.
        )rI   rJ   rK   r  rO  Úidr  rc  )r+   Úrow_indicesrU  Ú	selectionra  r   Úconfigs          r,   r?  zTable._save_config_info  s%  € ð  ÐÜœu¤S¨¯©£_Ó5Ó6ˆKð ×%Ñ%Ó'ˆ	Ù˜9Ð0Ü˜4Ÿ:™: iÑ0Ó1ˆIñ ð
 %÷	ð ô �4—:‘:˜a‘=Ó!Ü8=¸d×>OÑ>OÓ8Pö$Ø34�D×(Ñ(¨¨AÕ.ò$ñ ðˆFñ ð ˜&Ð Ð ð %÷àð ¼¸d×>OÑ>OÓ8PÖQ°1�D×(Ñ(¨¨AÕ.ÒQÑQðˆFñ ð
 ˜&Ð Ð ùò$ùóùò Rùós0   Á3DÂC<Â)DÂ:DÃDÃ0DÃ<DÄDc           
      óN  — |\  }}|€| j                   j                  dd«       |r�t        | j                  «      D ]„  \  }}t	        |«      |v rFt        | j                  «      D ].  }| j                   j                  |||t	        |«         |   «       Œ0 t	        |«      |k(  sŒh| j                   j                  ||¬«       Œ† y|�| j                   j                  ||¬«       |D ]?  }t        | j                  «      D ]%  }| j                   j                  ||||   |   «       Œ' ŒA y)zy
        Restore selection & color configuration information that was
        saved using ``_save_config_info``.
        Nr   r‰   )r™   )	r  r‹   rU   r  re  rJ   r  rª   r@   )	r+   ÚcookierU  r™   rg  rh  ra  r    r   s	            r,   r@  zTable._restore_config_info3  s#  € ð
 #Ñˆ	�6ð ÐØ�I‰I×%Ñ% a¨Ô/ñ Ü# D§J¡JÓ/ò 1‘��3Ü�c“7˜fÑ$Ü" 4×#4Ñ#4Ó5ò J˜ØŸ	™	×/Ñ/°°1°f¼RÀ»W±oÀaÑ6HÕIðJä�c“7˜iÓ'Ø—I‘I×$Ñ$ Q¨CÐ$Õ0ñ1ð Ð$Ø—	‘	× Ñ  °Ð Ô4Øò @�Ü˜t×0Ñ0Ó1ò @�AØ—I‘I×+Ñ+¨A¨q°&¸±)¸A±,Õ?ñ@ñ@r/   c                 óä  — | j                   j                  D ]   }t        | «      |j                  «       k(  rŒ J ‚ | D ]  }t        |«      | j                  k(  rŒJ ‚ | j                  t        | j                   j
                  «      k(  sJ ‚t        | «      D ]Z  \  }}t        |«      D ]G  \  }}| j                  �| j                  |||«      }| j                   j                  |«      |   |k(  rŒGJ ‚ Œ\ y)a  
        Verify that the contents of the table's ``_rows`` variable match
        the contents of its multi-listbox (``_mlb``).  This is just
        included for debugging purposes, to make sure that the
        list-modifying operations are working correctly.
        N)	r  r‡   rK   r˜   r  rƒ   rU   r  r»   )r+   rÂ   r    rf   r1  Úcells         r,   r/  zTable._check_table_vs_mlbU  sé   € ð —9‘9×&Ñ&ò 	+ˆCÜ�t“9 §¡£
Ó*Ð*Ð*ð	+àò 	1ˆCÜ�s“8˜t×0Ñ0Ó0Ð0Ð0ð	1à× Ñ ¤C¨¯	©	×(>Ñ(>Ó$?Ò?Ð?Ð?ä “oò 	3‰FˆAˆsÜ$ S›>ò 3‘��4Ø—>‘>Ð-ØŸ>™>¨!¨Q°Ó5�DØ—y‘y—}‘} QÓ'¨Ñ*¨dÓ2Ð2Ð2ñ3ñ	3r/   rö   r2   rõ   )rT  )T)NF)FF)*r÷   rø   rù   rú   rR   r  rY   rŽ   r\   r¬   r²   rª   rÑ   rÓ   rÖ   rý   rþ   rü   r¶   r4  rX   r8  r=  r§   rC  rE  r  rû   rƒ   rZ   rÊ   rÌ   rO  r@   r[  r  r  rc  r?  r@  r.  r/  r<   r/   r,   r  r  E  sÿ   „ ñ$ðT ØØØØØóMòh*ò
*ò
ó,ð
 +-ó 5ð .0ó 8ó
Hó
=ó@ó>ð €IØ"€LØ€Jò'ò('ò	'ò'ò,ò %5òN'òò	ð ñ&ó ð&ò1ò?ò?ò
ó,ó''òRó&)ò	
ó&!óP@ð< €Fð#ó3r/   r  c                  ó¼  ‡
— t        «       Š
‰
j                  dˆ
fd„«       t        ‰
dj                  «       g d¢d„ ¬«      } | j	                  dd¬	«       d
dlm}m} t        t        |j                  «       d d «      «      D ]›  \  }}|d
   dk7  rŒ|j                  «       }|j                  |«      D ]i  }	 |j                  «       d
   j                  «       }	 |j                  «       d
   j                  «       }| j!                  ||j                  «       ||g«       Œk Œ� | j#                  dd¬«       | j#                  dd¬«       | j#                  dd¬«       | j#                  dd¬«       t%        t'        | «      «      D ])  }dD ]"  }	| ||	f   dk(  sŒ| j)                  ||	dd¬«       Œ$ Œ+ ‰
j+                  «        y # t        $ r d}Y Œów xY w# t        $ r d}Y Œâw xY w)Nz<Control-q>c                 ó$   •— ‰j                  «       S r2   )Údestroy)r*   Úroots    €r,   r-   zdemo.<locals>.<lambda>q  s   ø€  t§|¡|£~€ r/   zWord Synset Hypernym Hyponym)r   r
   r
   r
   c                 ó   — d|z  S )Nz  %sr<   )rf   r1  Úss      r,   r-   zdemo.<locals>.<lambda>w  s
   €  &¨1¡*€ r/   )rb   r  Tr  )r	  r
  r   )ÚbrownÚwordnetiô  ÚNz*none*ÚWordz#afa)r   ÚSynsetz#efeÚHypernymz#feeÚHyponymz#ffe)rx  ry  z#666)r   r°   )r   r\   r  Úsplitr  Únltk.corpusrs  rt  Úsortedr  Útagged_wordsÚlowerÚsynsetsÚ	hypernymsÚ
definitionÚ	ExceptionrX   rþ   rJ   rK   rü   Úmainloop)Útablers  rt  ÚwordÚposÚsynsetÚ	hyper_defÚhypo_defr    r   rp  s             @r,   ÚdemorŠ  o  sé  ø€ Ü‹4€DØ‡I�IˆmÓ5Ô6äØØ&×,Ñ,Ó.Ú#Ù,ô	€Eð 
‡J�J�d €JÔ(ç*äœC × 2Ñ 2Ó 4°T°cÐ :Ó;Ó<ò K‰	ˆˆcØˆq‰6�SŠ=ØØ�z‰z‹|ˆØ—o‘o dÓ+ò 		KˆFð%Ø"×,Ñ,Ó.¨qÑ1×<Ñ<Ó>�	ð$Ø!×+Ñ+Ó-¨aÑ0×;Ñ;Ó=�ð �L‰L˜$ × 1Ñ 1Ó 3°YÀÐIÕJñ		Kð	Kð 
×Ñ�v¨&ÐÔ1Ø	×Ñ�x¨FÐÔ3Ø	×Ñ�z¨fÐÔ5Ø	×Ñ�y¨VÐÔ4Ü”S˜“ZÓ ò ˆØ-ò 	ˆFØ�S˜&�[Ñ! XÓ-Ø× Ñ Ø˜¨FÀVð !õ ñ	ðð 	‡M�M…Oøô% ò %Ø$’	ð%ûô ò $Ø#’ð$ús$   Â5!F<Ã!GÆ<G
Ç	G
ÇGÇGÚ__main__)rú   rX  Útkinterr   r   r   r   r   r	   r  rŠ  r÷   r<   r/   r,   ú<module>r�     sK   ðñó ß 8Õ 8ôb�5ô b÷ba3ñ a3òT'ðT ˆzÒÙ…Fð r/   