s A multi-column listbox, where the current selection applies to an entire row. Based on the MultiListbox Tkinter widget recipe from the Python Cookbook (http://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. t backgrounds#888t takefocusthighlightthicknessit borderwidthtrelieftraisedtfontshelvetica -16 bolds#444t foregroundtwhitetselectborderwidthitexportselectiontselectbackgroundt activestyletnonec s-t|tr*tt|}t}nt}t|dkrQtdnt|_ g_ g_ |d#krdgt|}n't|t|krtdn|_ tj|jjdddxtj D]\}}j|d|||rtd|j} j j| | jd|ddd d d dd d|| _ntj} j j| | jd|ddd d d dd d|| _| jd j| jdj| jdfd| jdfd| jdfd| jdfd| jdfd| jdd| jd jqWjd jjdfdjdfdjdfd jd!fd"j||d#S($s/ 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, the 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.: >>> mlb = MultiListbox(master, 5, label_foreground='red') isExpected at least one columnis*Expected one column_weight for each columntweightttexttcolumntrowtstickytnewstpadxtpadys s s cs jdS(Ni(t_scroll(te(tself(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt|ss csjd S(Ni(R(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR}ss csj|jS(N(Rtdelta(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR~ss csj|j|jS(N(t scan_marktxty(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRss csj|j|jS(N(t scan_dragtoR"R#(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRss cSsdS(Ntbreak((R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsscsjddS(NR i(tselect(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsscsjddS(NR i(R&(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsscsjdj S(NR (R&t _pagesize(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsscsjdjS(NR (R&R'(R(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsN(t isinstancetinttlisttrangetFalsetTruetlent ValueErrorttuplet _column_namest _listboxest_labelstNonet_column_weightsRt__init__t FRAME_CONFIGtgrid_rowconfiguret enumeratetgrid_columnconfigureRt LABEL_CONFIGtappendtgridt column_indexRtLISTBOX_CONFIGtbindt_selectt_resize_columnt configure( Rtmastertcolumnstcolumn_weightstcnftkwtinclude_labelstitlabeltltlb((Rsa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR6;sT     ( ( cCs9|jjdrtSd|_|j|krxt|jD]A\}}t|j|j |j dkr>||_q>q>Wne|j|jj dkr|jj |_n7|jdkr|jj dkr|jj d|_n|jdk r1|jjd|j |jjd|j |jtStSdS( s 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. si iiissN(twidgetR@R,R4t_resize_column_indexR9R2tabsR"twinfo_xt winfo_widthR>t_resize_column_motion_cbtnumt_resize_column_buttonrelease_cbR-(RteventRJRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRBs"  )! cCs|j|j}|jt|d}|j|jj}|j|j}td|dt||||ds(RNtunbindRT(RRV((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRUscCs|jS(sh A tuple containing the names of the columns used by this multi-column listbox. (R1(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt column_namesscCs t|jS(s 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. (R0R3(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt column_labelss cCs t|jS(sY 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. (R0R2(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt listboxess cCsM|jj|j}|jdd|j||j||jdS(Nitend(RNtnearestR#tselection_cleart selection_settactivatetfocus(RRRJ((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRAs   cCs(x!|jD]}|j|dq WdS(NtunitR%(R2t yview_scroll(RR RM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscCs&t|jdt|jdS(s2:return: The number of rows that makes up one pages @0,1000000s@0,0(R)tindex(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR'scCs|dk r'|dk r'tdn|dk rut|jdkrXd|}qut|jd|}n|jdd|dk rtt|d|jd}|j ||r|j |qndS(s 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. s$specify index or delta, but not bothiiRaiN( R4R/R.t curselectionR)RctminRYtsizeRdtsee(RRiR Rm((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR&s    " cKstt|jt|j}xt|jD]\}}|jdse|jdrx|jD]}|ji||d6qoWq;|jds|jdrxC|jD]}|ji||d6qWq;tj|i||6q;WdS(s8 Configure this widget. Use ``label_*`` to configure all labels; and ``listbox_*`` to configure all listboxes. E.g.: >>> mlb = MultiListbox(master, 5) >>> mlb.configure(label_foreground='red') >>> mlb.configure(listbox_foreground='red') tlabel_slabel-itlistbox_slistbox-iN(tdictR*titemst startswithR3RCR2R(RRGRHtkeytvalRKtlistbox((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRC%s (cCs|ji||6dS(s| Configure this widget. This is equivalent to ``self.configure({key,val``)}. See ``configure()``. N(RC(RRsRt((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt __setitem__9scKs+x$|jD]}|j|||q WdS(s Configure all table cells in the given row. Valid keyword arguments are: ``background``, ``bg``, ``foreground``, ``fg``, ``selectbackground``, ``selectforeground``. N(R2t itemconfigure(Rt row_indexRGRHRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt rowconfigure@scKs|j|}tt|jt|j}xwt|jD]c\}}|dkrxHt|jD]}|j|i||6qsWqH|ji||6qHWdS( s Configure all table cells in the given column. Valid keyword arguments are: ``background``, ``bg``, ``foreground``, ``fg``, ``selectbackground``, ``selectforeground``. RtbgR tfgRtselectforegroundN(s backgroundsbgs foregroundR{sselectbackgroundsselectforeground(R2RpR*RqR+RlRwRC(Rt col_indexRGRHRMRsRtRJ((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytcolumnconfigureHs ( cKs |j|}|j|||S(s Configure the table cell at the given row and column. Valid keyword arguments are: ``background``, ``bg``, ``foreground``, ``fg``, ``selectbackground``, ``selectforeground``. (R2Rw(RRxR}RGRHRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRwXs cGs~x8|D]0}t|t|jkrtdqqWx<t|jtt|D]\}}|j||qZWdS(s0 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``. sDrows should be tuples whose length is equal to the number of columnsN(R.R1R/tzipR2R*tinsert(RRitrowsteltRMtelts((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRes  +cCs_g|jD]}|j||^q }|rQgt|D]}t|^q;St|SdS(s 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. N(R2tgetRR0(RtfirsttlastRMtvaluesR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRts(#c Cs|jddd|\}}}}|j|j|\}}}} t|t|t|t|t|t| fS(s 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)``. RiR(t grid_bboxR2tbboxR)( RRtcoltdxtdyt_R"R#twth((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs$"cCsE|jr|j|jn|j|j|j|dddS(s1 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()`` RiN(R3t grid_forgetR`R:(RR}((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt hide_columns c Cs|j|}|jrH|j|jd|ddddddddn|j|jd|dddddddd|j|d |d S( s Display a column that has been hidden using ``hide_column()``. It is safe to call this on a column that is not hidden. RRiRRRRiRN(R5R3R=R2R:(RR}R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt show_columns  cCs)g|jD]}|j|||^q S(sK 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@(RtsequencetfunctaddRK((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytbind_to_labelss cCs+x$|jD]}|j|||q WdS(sM 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@(RRRRRu((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytbind_to_listboxess cCs&|j||||j|||S(sc 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). (RR(RRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytbind_to_columnss cOs|jdj||S(Ni(R2Rj(Rtargstkwargs((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRjscOs|jdj||S(Ni(R2tselection_includes(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs|jdj||S(Ni(R2titemcget(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs|jdj||S(Ni(R2Rl(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRlscOs|jdj||S(Ni(R2Ri(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRiscOs|jdj||S(Ni(R2Rb(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRbscOs(x!|jD]}|j||q WdS(N(R2Re(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRescOs(x!|jD]}|j||q WdS(N(R2tdelete(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs(x!|jD]}|j||q WdS(N(R2R!(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR!scOs(x!|jD]}|j||q WdS(N(R2R$(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR$scOs(x!|jD]}|j||q WdS(N(R2Rm(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRmscOs(x!|jD]}|j||q WdS(N(R2tselection_anchor(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs(x!|jD]}|j||q WdS(N(R2Rc(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRcscOs(x!|jD]}|j||q WdS(N(R2Rd(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRdscOs*x#|jD]}|j||}q W|S(N(R2tyview(RRRRMtv((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs(x!|jD]}|j||q WdS(N(R2t yview_moveto(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs(x!|jD]}|j||q WdS(N(R2Rh(RRRRM((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRhsN(;t__name__t __module__t__doc__RpR-R7R;R,R?R4R6RBRSRUtpropertyR^R_R`RARR'R&RCRvRyR~RwRRRRRRRRRjRRRlRiRbReRR!R$RmRRcRdRRRht itemconfigt rowconfigt columnconfigt select_anchort select_cleartselect_includest select_set(((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs|     ^     #                           tTablecBseZdZd#d#eed#idZdZdZdZd#d#d#dZ idZ idZ d#dZ d#d#d#d Z d#d#d#d Zd#d#d#d Ze Ze Ze Zd Zd ZdZdZdZdZdZdZdZedZdZdZdZ dZ!d#d#edZ"ddZ#dZ$edZ%dZ&d#e'd Z(e'e'd!Z)e'Z*d"Z+RS($s 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 lits 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' 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']) 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. c Kst||_||_t||_tdt|D|_|dkr^g|_ n/g|D]} g| D] } | ^qr^qe|_ x|j D]} |j | qWt |j|||| |_ |j j dddtdd|rKt|jddd |j j} | j|j jd d <| j dd dd | |_nd|_|rx6t|j jD]\} }|jd|jqmWn|jdS(s 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 initialze 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. css!|]\}}||fVqdS(N((t.0RJtc((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pys dstsidetlefttexpandtfilltbothtorienttverticaltcommandityscrollcommandtrightR#s N(R.t _num_columnst _reprfuncRt_frameRpR9t_column_name_to_indexR4t_rowst _checkrowRt_mlbtpackR-RRtsetR`t _scrollbart_sortkeyR_R@t_sortt _fill_table(RRDR^RRFt scrollbart click_to_sorttreprfuncRGRHRRtsbRJRL((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR6=s0#   /   cOs|jj||dS(srPosition this table's main frame widget in its parent widget. See ``Tkinter.Frame.pack()`` for more info.N(RR(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscOs|jj||dS(srPosition this table's main frame widget in its parent widget. See ``Tkinter.Frame.grid()`` for more info.N(RR=(RRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR=scCs|jjdS(s-Direct (keyboard) input foxus to this widget.N(RRf(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRfscCs|jj|||dS(skAdd a binding to this table's main frame that will call ``func`` in response to the event sequence.N(RR@(RRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR@scKs|jj|||dS(s%:see: ``MultiListbox.rowconfigure()``N(RRy(RRxRGRH((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRyscKs)|j|}|jj|||dS(s(:see: ``MultiListbox.columnconfigure()``N(R>RR~(RR}RGRH((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR~scKs(|j|}|jj||||S(s&:see: ``MultiListbox.itemconfigure()``(R>RRw(RRxR}RGRH((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRwscCs|jj|||S(s':see: ``MultiListbox.bind_to_labels()``(RR(RRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscCs|jj|||S(s*:see: ``MultiListbox.bind_to_listboxes()``(RR(RRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscCs|jj|||S(s(:see: ``MultiListbox.bind_to_columns()``(RR(RRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRscCs|j||jj|||jdk rfgt|D]!\}}|j|||^q<}n|jj|||jr|jndS(sT 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( RRRRR4R9Rt_DEBUGt_check_table_vs_mlb(RRxtrowvaluetjR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs 4 cCs8x|D]}|j|qW|jr4|jndS(s Add new rows at the end of the table. :param rowvalues: A list of row values used to initialze the table. Each row value should be a tuple of cell values, one for each column in the row. N(R<RR(Rt rowvaluesR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytextends  cCs3|jt|j||jr/|jndS(s 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(RR.RRR(RR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR<s cCs6g|_|jjdd|jr2|jndS(s0 Delete all rows in this table. iRaN(RRRRR(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytclears  cCstt|trtdnRt|tr_t|dkr_|j|d|j|dSt|j|SdS(s 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. sSlicing not supportediiiN(R(tsliceR/R0R.RR>(RRi((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt __getitem__s ! cCst|trtdnzt|trt|dkr|d|j|d}}|j|g}||j||<|jdk r|j|||}n|j j |j |||j j |j |d|j|n|j|g}|j|t||j|<|jdk rdgt|D]!\}}|j|||^q:}n|j j |||j j |d|j|dS(s 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``. sSlicing not supportediiiN(R(RR/R0R.R>t_save_config_infoRRR4RR`RRt_restore_config_infoRR*R9(RRiRtRJRt config_cookieR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRvs&! 7cCstttrtdnt|trNt|dkrNtdn|j|=|jj||j r~|j ndS(sA Delete the ``row_index``th row from this table. sSlicing not supportedisCannot delete a single cell!N( R(RiRR/R0R.RRRRR(RRx((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt __delitem__%s!  cCs t|jS(s< :return: the number of rows in this table. (R.R(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt__len__1scCs>t||jkr:td|t||jfndS(s Helper function: check that a given row value has the correct number of elements; and if not, raise an exception. s"Row %r has %d columns; expected %dN(R.RR/(RR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR7scCs |jjS(s1A list of the names of the columns in this table.(RR^(R((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR^DscCsAt|tr2d|ko)|jknr2|S|j|SdS(s 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. iN(R(R)RR(RRJ((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR>Is.cCs|jj|j|dS(s$:see: ``MultiListbox.hide_column()``N(RRR>(RR>((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRVscCs|jj|j|dS(s$:see: ``MultiListbox.show_column()``N(RRR>(RR>((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRZscCs+|jj}|r#t|dSdSdS(s 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()]``. iN(RRjR)R4(Rtsel((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt selected_rowbscCs|jj|||dS(s:see: ``MultiListbox.select()``N(RR&(RRiR Rm((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR&lsttogglecCs|d krtdn|j|}|jdt}|dkrg||jkrg|jjn1|jjdtj |d|dk||_|j |j |dtdt|j r|j nd S( s 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. t ascendingt descendingRsBsort_by(): order should be "ascending", "descending", or "toggle".t index_by_idRstreverseRmN(RRR(R/R>RR-RRRtsorttoperatort itemgetterRRRR(RR>torderR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytsort_byts     cCs7|jj}|jj|r"dS|j|dSdS(sLEvent handler for clicking on a column label -- sort by that column.tcontinueN(RNR>RRBR(RRVR>((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs   cCs|jjddxvt|jD]e\}}|jdk rugt|D]!\}}|j|||^qK}n|jjd|q#WdS(s 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. iRaN(RRR9RRR4R(Rt save_configRJRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs 7cs tfddDS(Nc3s1|]'}|jj|dfVqdS(iN(RR(Rtk(RtrR(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pys sR R|RR(s foregroundsselectforegrounds backgroundsselectbackground(Rp(RRR((RRRsa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt_get_itemconfigscs|dkr*tttj}nj}|r^|dk r^tj|}n|rtfd|D}ntfd|D}||fS(s* 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. c3sP|]F}tj|gtjD]}j||^q)fVqdS(N(tidRR+RR(RRR(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pys sc3sC|]9}|gtjD]}j||^qfVqdS(N(R+RR(RRR(R(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pys sN(R4R*R+R.RRRRp(Rt row_indicesRt selectiontconfig((Rsa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs   c CsG|\}}|dkr.|jjddn|rx t|jD]\}}t||krx>t|jD]*}|jj|||t||qrWnt||krD|jj |d|qDqDWnn|dk r|jj |d|nxF|D]>}x5t|jD]$}|jj|||||qWqWdS(sy Restore selection & color configuration information that was saved using ``_save_config_info``. iRaRmN( R4RRcR9RRR+RRwR&( RtcookieRRmRRRRR((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs  +   cCs x2|jjD]$}t||jks tq Wx)|D]!}t||jks<tq<W|jt|jjkstxt|D]r\}}xct|D]U\}}|jdk r|j|||}n|jj |||kstqWqWdS(s 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( RR`R.RltAssertionErrorRR^R9RR4R(RRRRJRtcell((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRs" !N(,RRRR4R-R6RR=RfR@RyR~RwRRRRRRRRR<RRRvRRRRR^R>RRRR&RRRRR,RRRR(((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyRsR%I          (      &   %c stjdfdtdjdddddgdd}|jd td d d d lm}d dlm}xt t |j d D]\}}|ddkrqn|j }x|j |D]q}|jdgd}|jdgd}|j|t|ddt|ddt|ddgqWqW|jddd|jddd|jddd|jdddx`tt|D]L}xCd D];} ||| fdkr|j|| ddddqqWqWjdS(!Ns cs jS(N(tdestroy(R(troot(sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR"ssWord Synset Hypernym HyponymRFiiRcSsd|S(Ns %s((RJRts((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyR&sRRRi(twordnet(tbrownitNtt definitions*none*tWordRs#afatSynsets#efetHypernyms#feetHyponyms#ffeR s#666R|(RR(RR@RtsplitRR-t nltk.corpusRRtsortedRt tagged_wordstlowertsynsetst hypernymsthyponymsR<tgetattrRR+R.Rtmainloop( ttableRRtwordtpostsynsetthyperthypoRR((Rsa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pytdemo s:  )   t__main__(Rt nltk.compattnltkRttkinterRRRRRRtobjectRR R(((sa/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/draw/table.pyt s  ( !