Your IP : 216.73.216.86


Current Path : /home/emeraadmin/public_html/4d695/
Upload File :
Current File : /home/emeraadmin/public_html/4d695/tkinter.tar

__pycache__/tix.cpython-312.pyc000064400000332250151710635150012274 0ustar00�

T��h�,��v�ddlZddlZddlZddl�ddlmZejded��dZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z dZ!Gd!�d"�Z"Gd#�d$ejFe"�Z#Gd%�d&�Z$ejJjLe$fzejJ_&Gd'�d(ejJ�Z'Gd)�d*e'�Z(Gd+�d,�Z)Gd-�d.e'�Z*Gd/�d0e'�Z+Gd1�d2e'�Z,Gd3�d4e'�Z-Gd5�d6e'�Z.Gd7�d8e'�Z/Gd9�d:e'�Z0Gd;�d<e'�Z1Gd=�d>e'�Z2Gd?�d@e'�Z3GdA�dBe'�Z4GdC�dDe'�Z5GdE�dFe'�Z6GdG�dHe'e7e8�Z9GdI�dJe'�Z:GdK�dLe'�Z;GdM�dNe'�Z<GdO�dPe'�Z=GdQ�dRe'�Z>GdS�dTe'�Z?GdU�dVe'�Z@GdW�dXe'�ZAGdY�dZe'�ZBGd[�d\e'�ZCGd]�d^e'�ZDGd_�d`e'�ZEGda�dbe'�ZFGdc�dde'�ZGGde�dfe'�ZHGdg�dhe'�ZIGdi�dje'�ZJGdk�dle'�ZKGdm�dne'�ZLGdo�dpe'�ZMGdq�dre'e7e8�ZNGds�dte'�ZOGdu�dve'�ZPGdw�dxeQe(�ZRGdy�dzeSe(�ZTGd{�d|eUe(�ZVGd}�d~eWe(�ZXGd�d�eYe(�ZZGd��d�e[e(�Z\Gd��d�e]e(�Z^Gd��d�e_e(�Z`Gd��d�eae(�ZbGd��d�ece(�ZdGd��d�eFe(�ZeGd��d�e9e(�ZfGd��d�eEe(�ZgGd��d�eNe(�ZhGd��d�e,e(�ZiGd��d�e.e(�ZjGd��d�e0e(�ZkGd��d�e1e(�ZlGd��d�e4e(�ZmGd��d�e,e(�ZnGd��d�eMe(�ZoGd��d�e@e(�ZpGd��d�eBe(�Zqd��Zrd��ZsGd��d�e'�ZtGd��d�e'e7e8�ZuGd��d�eu�Zvy)��N)�*)�	_cnfmergeznThe Tix Tk extension is unmaintained, and the tkinter.tix wrapper module is deprecated in favor of tkinter.ttk�)�
stacklevel�window�text�status�	immediate�image�	imagetext�balloon�auto�	acrosstop�ascii�cell�column�
decreasing�
increasing�integer�main�max�real�rowzs-regionzx-regionzy-region���� c�F�eZdZdZd�Zd�Zdd�Zdd�Zd�Zd�Z	d	�Z
dd
�Zy)�
tixCommanda�The tix commands provide access to miscellaneous  elements
    of  Tix's  internal state and the Tix application context.
    Most of the information manipulated by these  commands pertains
    to  the  application  as a whole, or to a screen or
    display, rather than to a particular window.

    This is a mixin class, assumed to be mixed to Tkinter.Tk
    that supports the self.tk.call method.
    c�<�|jjdd|�S)a�Tix maintains a list of directories under which
        the  tix_getimage  and tix_getbitmap commands will
        search for image files. The standard bitmap  directory
        is $TIX_LIBRARY/bitmaps. The addbitmapdir command
        adds directory into this list. By  using  this
        command, the  image  files  of an applications can
        also be located using the tix_getimage or tix_getbitmap
        command.
        �tix�addbitmapdir��tk�call)�self�	directorys  �$/usr/lib64/python3.12/tkinter/tix.py�tix_addbitmapdirztixCommand.tix_addbitmapdirYs���w�w�|�|�E�>�9�=�=�c�<�|jjdd|�S)z�Returns  the  current  value  of the configuration
        option given by option. Option may be  any  of  the
        options described in the CONFIGURATION OPTIONS section.
        r!�cgetr#�r&�options  r(�tix_cgetztixCommand.tix_cgetes��
�w�w�|�|�E�6�6�2�2r*Nc�
�|rt||f�}n
|rt|�}|�|jdd�St|t�r|j	ddd|z�S|j
j
d|j|�z�S)a�Query or modify the configuration options of the Tix application
        context. If no option is specified, returns a dictionary all of the
        available options.  If option is specified with no value, then the
        command returns a list describing the one named option (this list
        will be identical to the corresponding sublist of the value
        returned if no option is specified).  If one or more option-value
        pairs are specified, then the command modifies the given option(s)
        to have the given value(s); in this case the command returns an
        empty string. Option may be any of the configuration options.
        r!�	configure�-)r!r1)r�
_getconfigure�
isinstance�str�_getconfigure1r$r%�_options�r&�cnf�kws   r(�
tix_configureztixCommand.tix_configurels~����S�"�I�&�C�
��C�.�C��;��%�%�e�[�9�9��c�3���&�&�u�k�3�s�7�C�C��w�w�|�|�0�4�=�=��3E�E�F�Fr*c�x�|�|jjdd|�S|jjdd�S)a�Returns the file selection dialog that may be shared among
        different calls from this application.  This command will create a
        file selection dialog widget when it is called the first time. This
        dialog will be returned by all subsequent calls to tix_filedialog.
        An optional dlgclass parameter can be passed to specified what type
        of file selection dialog widget is desired. Possible options are
        tix FileSelectDialog or tixExFileSelectDialog.
        r!�
filedialogr#)r&�dlgclasss  r(�tix_filedialogztixCommand.tix_filedialog�s6�����7�7�<�<��|�X�>�>��7�7�<�<��|�4�4r*c�<�|jjdd|�S)a�Locates a bitmap file of the name name.xpm or name in one of the
        bitmap directories (see the tix_addbitmapdir command above).  By
        using tix_getbitmap, you can avoid hard coding the pathnames of the
        bitmap files in your application. When successful, it returns the
        complete pathname of the bitmap file, prefixed with the character
        '@'.  The returned value can be used to configure the -bitmap
        option of the TK and Tix widgets.
        r!�	getbitmapr#�r&�names  r(�
tix_getbitmapztixCommand.tix_getbitmap�s���w�w�|�|�E�;��5�5r*c�<�|jjdd|�S)a�Locates an image file of the name name.xpm, name.xbm or name.ppm
        in one of the bitmap directories (see the addbitmapdir command
        above). If more than one file with the same name (but different
        extensions) exist, then the image type is chosen according to the
        depth of the X display: xbm images are chosen on monochrome
        displays and color images are chosen on color displays. By using
        tix_ getimage, you can avoid hard coding the pathnames of the
        image files in your application. When successful, this command
        returns the name of the newly created image, which can be used to
        configure the -image option of the Tk and Tix widgets.
        r!�getimager#rBs  r(�tix_getimageztixCommand.tix_getimage�s���w�w�|�|�E�:�t�4�4r*c�>�|jjddd|�S)a@Gets  the options  maintained  by  the  Tix
        scheme mechanism. Available options include:

            active_bg       active_fg      bg
            bold_font       dark1_bg       dark1_fg
            dark2_bg        dark2_fg       disabled_fg
            fg              fixed_font     font
            inactive_bg     inactive_fg    input1_bg
            input2_bg       italic_font    light1_bg
            light1_fg       light2_bg      light2_fg
            menu_font       output1_bg     output2_bg
            select_bg       select_fg      selector
            r!r.�getr#rBs  r(�tix_option_getztixCommand.tix_option_get�s���w�w�|�|�E�8�U�D�9�9r*c��|�|jjdd|||�S|jjdd||�S)a�Resets the scheme and fontset of the Tix application to
        newScheme and newFontSet, respectively.  This affects only those
        widgets created after this call. Therefore, it is best to call the
        resetoptions command before the creation of any widgets in a Tix
        application.

        The optional parameter newScmPrio can be given to reset the
        priority level of the Tk options set by the Tix schemes.

        Because of the way Tk handles the X option database, after Tix has
        been has imported and inited, it is not possible to reset the color
        schemes and font sets using the tix config command.  Instead, the
        tix_resetoptions command must be used.
        r!�resetoptionsr#)r&�	newScheme�
newFontSet�
newScmPrios    r(�tix_resetoptionsztixCommand.tix_resetoptions�s>���!��7�7�<�<��~�y�*�j�Y�Y��7�7�<�<��~�y�*�M�Mr*�N)�__name__�
__module__�__qualname__�__doc__r)r/r;r?rDrGrJrP�r*r(rrNs1���
>�3�G�,5�	6�5�:�"Nr*rc��eZdZdZdd�Zd�Zy)�Tkz{Toplevel widget of Tix which represents mostly the main window
    of an application. It has an associated Tcl interpreter.Nc�n�tjj||||�tjjd�}|jjd�|�<|jjd|z�|jjd|z�|jjd�y)N�TIX_LIBRARYz<global auto_path; lappend auto_path [file dir [info nameof]]z(global auto_path; lappend auto_path {%s}z,global tcl_pkgPath; lappend tcl_pkgPath {%s}zpackage require Tix)�tkinterrX�__init__�os�environrIr$�eval)r&�
screenName�baseName�	className�tixlibs     r(r\zTk.__init__�s����
�
���D�*�h�	�B������
�.�������S�T����G�G�L�L�C�f�L�M��G�G�L�L�G�&�P�Q�	
�����*�+r*c�f�|jdd�tjj|�y)N�WM_DELETE_WINDOW�)�protocolr[rX�destroy�r&s r(rhz
Tk.destroy�s#���
�
�(�"�-��
�
���4� r*)NN�Tix�rRrSrTrUr\rhrVr*r(rXrX�s��@�,�!r*rXc�F�eZdZdZifd�ZeZd�Zd�Zd�Zd
d�Z	dd�Z
d	�Zy)�Formz�The Tix Form geometry manager

    Widgets can be arranged by specifying attachments to other widgets.
    See Tix documentation for complete detailsc�t�|jjd|jg|j||����y)N�tixForm�r$r%�_wr7r8s   r(�configzForm.config�s*��������Y����A�$�-�-��R�*@�Ar*c�4�tj|||i�yrQ)rm�form�r&�key�values   r(�__setitem__zForm.__setitem__�s���	�	�$��e��%r*c�P�|jjdd|j�S)Nro�check�r$r%rqris r(rzz
Form.check�s���w�w�|�|�I�w����8�8r*c�R�|jjdd|j�y)Nro�forgetr{ris r(r}zForm.forget�s�������Y��$�'�'�2r*c�4�|sn|sl|jjdd|j�}|jj|�}d}|D]!}||jj	|�fz}�#|S|jjdd|j||�S)Nro�gridrV)r$r%rq�	splitlist�getint)r&�xsize�ysize�x�y�zs      r(rz	Form.grid�s����������Y�����8�A����!�!�!�$�A��A����������*�,�,����H��w�w�|�|�I�v�t�w�w��u�E�Er*Nc��|s'|jjdd|j�S|ddk7rd|z}|jjdd|j|�S)Nro�inforr2r{r-s  r(r�z	Form.infosR����7�7�<�<�	�6�4�7�7�;�;��!�9����6�\�F��w�w�|�|�I�v�t�w�w��?�?r*c���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)Nro�slaves)r$r�r%rq�
_nametowidget�r&r�s  r(r�zForm.slaves
s`�����!�!��w�w�|�|� �(�D�G�G�5�6�7�6�+,��"�"�1�%�6�7�	7��7s�A)rrrQ)rRrSrTrUrrrtrxrzr}rr�r�rVr*r(rmrm�s9��2�
�B��D�&�9�3�F�@�7r*rmc�^�eZdZdZdddiifd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zidfd�Zd�Z
y)
�	TixWidgetaQA TixWidget class is used to package all (or most) Tix widgets.

    Widget initialization is extended in two ways:
       1) It is possible to give a list of options which must be part of
       the creation command (so called Tix 'static' options). These cannot be
       given as a 'config' command later.
       2) It is possible to give the name of an existing TK widget. These are
       child widgets created automatically by a Tix mega-widget. The Tk call
       to create these widgets is therefore bypassed in TixWidget.__init__

    Both options are for use by subclasses only.
    Nc��|rt||f�}nt|�}d}|r|jd�ndg}t|j��D]\}}||vs�|d|z|fz}||=�||_|j||�|r(|jj||jg|���|rtj||�i|_y)NrV�optionsr2)r�append�list�items�
widgetName�_setupr$r%rq�Widgetrr�subwidget_list)	r&�masterr��static_optionsr9r:�extra�k�vs	         r(r\zTixWidget.__init__!s�����S�"�I�&�C��C�.�C�����!�!�)�,�'�[�N���	�	��$�C�A�a��N�"���q��!��,����F�%�
%������F�C� ���D�G�G�L�L��T�W�W�5�u�5���M�M�$��$�
!��r*c�R�||jvr|j|St|��rQ)r��AttributeErrorrBs  r(�__getattr__zTixWidget.__getattr__Ns,���4�&�&�&��&�&�t�,�,��T�"�"r*c�R�|jjd|j|�y)z1Set a variable without calling its action routine�tixSetSilentNr{)r&rws  r(�
set_silentzTixWidget.set_silentSs�������^�T�W�W�e�4r*c��|j|�}|std|zdz|jz��|t|j�dzd}|j|�S)zSReturn the named subwidget (which must have been created by
        the sub-class).z
Subwidget z not child of �N)�_subwidget_name�TclError�_name�lenrqr�)r&rC�ns   r(�	subwidgetzTixWidget.subwidgetWs_��
� � ��&����<�$�.�1A�A�D�J�J�N�O�O�
�c�$�'�'�l�1�n�o����!�!�!�$�$r*c���|j�}|sgSg}|D]>}|t|j�dzd}	|j|j	|���@|S#Y�GxYw)zReturn all subwidgets.r�N)�_subwidget_namesr�rqr�r�)r&�names�retlistrCs    r(�subwidgets_allzTixWidget.subwidgets_allasl���%�%�'����I����D���D�G�G��Q���(�D�
����t�1�1�$�7�8�����
��s� A�A c�p�	|jj|jd|�S#t$rYywxYw)z7Get a subwidget name (returns a String, not a Widget !)r�N)r$r%rqr�rBs  r(r�zTixWidget._subwidget_nameps4��	��7�7�<�<�����d�;�;���	��	�s�&)�	5�5c��	|jj|jdd�}|jj|�S#t$rYywxYw)z"Return the name of all subwidgets.�
subwidgetsz-allN)r$r%rqr�r�r�s  r(r�zTixWidget._subwidget_nameswsH��	������T�W�W�l�F�;�A��7�7�$�$�Q�'�'���	��	�s�AA�	A�Ac���|dk(ryt|t�st|�}t|t�st|�}|j�}|D]#}|jj|dd|z|��%y)z8Set configuration options for all subwidgets (and self).rfNr1r2)r4r5�reprr�r$r%)r&r.rwr�rCs     r(�
config_allzTixWidget.config_allsd���R�<���F�C�(��&�\�F��%��%���K�E��%�%�'���D��G�G�L�L��{�C�&�L�%�@�r*c��|�|}|r|rt||f�}n|r|}d}|j�D]+\}}t|�r|j|�}|d|z|fz}�-|jjdd|f|z�S)NrVr2r�create)rr��callable�	_registerr$r%)r&�imgtyper9r�r:r�r�r�s        r(�image_createzTixWidget.image_create�s����>��F�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���{��N�N�1�%����Q���
�*�G� ��y�y�~�~�w��'�;�g�E�F�Fr*c�^�	|jjdd|�y#t$rYywxYw)Nr�delete)r$r%r�)r&�imgnames  r(�image_deletezTixWidget.image_delete�s-��	��G�G�L�L��(�G�4���	��	�s� �	,�,)rRrSrTrUr\r�r�r�r�r�r�r�r�r�rVr*r(r�r�sQ��� $��#���&!�Z#�
5�%�
���
A�)+�4�
G�r*r�c� �eZdZdZ	dd�Zd�Zy)�TixSubWidgetz�Subwidget class.

    This is used to mirror child widgets automatically created
    by Tix/Tk as part of a mega-widget in Python (which is not informed
    of this)c��|r>|j|�}	|t|j�dzd}|jd�}|s#tj||ddd|i�||_y|}t
t�dz
�D]-}dj|d|dz�}		|j|	�}
|
}�/|r|d}tj||ddd|i�||_y#g}Y��xYw#t$rt|||dd��}Y��wxYw)Nr��.rCr)�destroy_physically�check_intermediate���)r�r�rq�splitr�r\�range�joinr��KeyErrorr�r�)r&r�rCr�r��path�plist�parent�ir��ws           r(r\zTixSubWidget.__init__�s"����)�)�$�/�D�
��C��	�	�N�1�,�-�.���
�
�3���"����t�V�T�4�&�4��I�$#5����F��3�u�:��>�*���H�H�U�4�A�a�C�[�)��@��,�,�Q�/�A��F�	+���R�y�����t�V�T�4�&�4��I�"4����/
���� �@�)�&�%��(�=>�=>�@�F�@�s�,C�C"�C�"D�?Dc���t|jj��D]}|j��|j|j
jvr!|j
j|j=|j|j
jvr!|j
j|j=|jr'|jjd|j�yy)Nrh)r��children�valuesrhr�r�r�r�r$r%rq�r&�cs  r(rhzTixSubWidget.destroy�s���
�d�m�m�*�*�,�-�A�q�y�y�{�-��:�:����-�-�-����$�$�T�Z�Z�0��:�:����3�3�3����*�*�4�:�:�6��"�"��G�G�L�L��D�G�G�,�#r*N)r�r�rkrVr*r(r�r��s���9:�5�@-r*r�c�H�eZdZdZifdd�d�Zd�Zd�Zd�Zd�Zifd	�Z	d
�Z
y)�DisplayStylezRDisplayStyle - handle configuration options shared by
    (multiple) Display ItemsN)r�c���|�)d|vr|d}nd|vr|d}ntjd�}|j|_|jjd|g|j	||����|_y)N�	refwindowzcreate display style�tixDisplayStyle)r[�_get_default_rootr$r%r7�	stylename)r&�itemtyper9r�r:s     r(r\zDisplayStyle.__init__�st���>��b� ��K�����#��[�)�� �2�2�3I�J���)�)���%������&7��5�!�]�]�3�r�2�5��r*c��|jSrQ)r�ris r(�__str__zDisplayStyle.__str__�s���~�~�r*c�z�|r|rt||f�}n|r|}d}|j�D]\}}|d|z|fz}�|S)NrVr2)rr�)r&r9r:�optsr�r�s      r(r7zDisplayStyle._options�sM��
�#��S�"�I�&�C�
��C����I�I�K�D�A�q��3�q�5�!�*�$�D� ��r*c�P�|jj|jd�y�Nr��r$r%r�ris r(r�zDisplayStyle.delete�s�������T�^�^�X�.r*c�Z�|jj|jdd|z|�y)Nr1�-%sr�rus   r(rxzDisplayStyle.__setitem__�s �������T�^�^�[�%��)�U�Cr*c�^�|j|jdg|j||����S)Nr1)r3r�r7r8s   r(rrzDisplayStyle.config�s6��!�t�!�!��N�N�K�A�*.�-�-��B�*?�A�	Ar*c�V�|jj|jdd|z�S)Nr,r�r�)r&rvs  r(�__getitem__zDisplayStyle.__getitem__�s!���w�w�|�|�D�N�N�F�E�#�I�>�>r*)rRrSrTrUr\r�r7r�rxrrr�rVr*r(r�r��s=�� �&(�
5�4�
5���/�D��A�?r*r�c�,�eZdZdZdifd�Zifd�Zd�Zy)�BalloonzBalloon help widget.

    Subwidget       Class
    ---------       -----
    label           Label
    message         MessageNc��gd�}tj||d|||�t|dd��|jd<t|dd��|jd<y)N)r��installcolormap�initwait�	statusbar�cursor�
tixBalloon�labelr�r��message�r�r\�_dummyLabelr��r&r�r9r:�statics     r(r\zBalloon.__init__s[�������4���v�s�B�G�'2�4��FG�(I����G�$�)4�T�9�HI�*K����I�&r*c��|jj|jd|jg|j||����y)zkBind balloon widget to another.
        One balloon widget may be bound to several widgets at the same time�bindNrp)r&�widgetr9r:s    r(�bind_widgetzBalloon.bind_widgets2��	������T�W�W�f�f�i�i�I�$�-�-��R�2H�Ir*c�f�|jj|jd|j�y�N�unbindr{�r&r�s  r(�
unbind_widgetzBalloon.unbind_widget��������T�W�W�h��	�	�2r*)rRrSrTrUr\r�rrVr*r(r�r�s$���#��K�')�J�
3r*r�c�,�eZdZdZdifd�Zifd�Zd�Zy)�	ButtonBoxzgButtonBox - A container for pushbuttons.
    Subwidgets are the buttons added with the add method.
    Nc�<�tj||dddg||�y)N�tixButtonBox�orientationr��r�r\�r&r�r9r:s    r(r\zButtonBox.__init__&s#�����4���)�9�5�s�B�	@r*c��|jj|jd|g|j||����}t	||�|j
|<|S)z$Add a button with given name to box.�add�r$r%rqr7�_dummyButtonr�)r&rCr9r:�btns     r(r
z
ButtonBox.add*sL���d�g�g�l�l�4�7�7�E�4�I�$�-�-��R�2H�I��$0��t�$<����D�!��
r*c�p�||jvr(|jj|jd|�yy�N�invoke�r�r$r%rqrBs  r(rzButtonBox.invoke1�-���4�&�&�&��G�G�L�L����(�D�1�'r*�rRrSrTrUr\r
rrVr*r(rr"s#���#��@���2r*rc�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�ComboBoxa�ComboBox - an Entry field with a dropdown menu. The user can select a
    choice by either typing in the entry subwidget or selecting from the
    listbox subwidget.

    Subwidget       Class
    ---------       -----
    entry       Entry
    arrow       Button
    slistbox    ScrolledListBox
    tick        Button
    cross       Button : present if created with the fancy optionNc��tj||dgd�||�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)	N�tixComboBox)�editable�dropdown�fancyr�r��entry�arrow�slistbox�tick�cross)r�r\r�r��_dummyEntryr�_dummyScrolledListBox�	TypeErrorrs    r(r\zComboBox.__init__Cs������4���G���	$�(3�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B5�5	C�Cc�R�|jj|jd|�y)N�
addhistoryr{�r&r5s  r(�add_historyzComboBox.add_historyUs�������T�W�W�l�C�0r*c�R�|jj|jd|�y)N�
appendhistoryr{r%s  r(�append_historyzComboBox.append_historyXs�������T�W�W�o�s�3r*c�T�|jj|jd||�y�N�insertr{)r&�indexr5s   r(r,zComboBox.insert[s�������T�W�W�h��s�3r*c�R�|jj|jd|�y)N�pickr{�r&r-s  r(r/z
ComboBox.pick^s�������T�W�W�f�e�,r*)	rRrSrTrUr\r&r)r,r/rVr*r(rr5s(��
E� $���$1�4�4�-r*rc�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�Controla�Control - An entry field with value change arrows.  The user can
    adjust the value by pressing the two arrow buttons or by entering
    the value directly into the entry. The new value will be checked
    against the user-defined upper and lower limits.

    Subwidget       Class
    ---------       -----
    incr       Button
    decr       Button
    entry       Entry
    label       LabelNc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<y)N�
tixControlr��incr�decrr�r)r�r\rr�r�r rs    r(r\zControl.__init__osx�����4���	�{�C��L�&2�4��&@����F�#�&2�4��&@����F�#�'2�4��'A����G�$�'2�4��'A����G�$r*c�P�|jj|jd�y)Nr6r{ris r(�	decrementzControl.decrementv��������T�W�W�f�%r*c�P�|jj|jd�y)Nr5r{ris r(�	incrementzControl.incrementyr9r*c�P�|jj|jd�yrr{ris r(rzControl.invoke|��������T�W�W�h�'r*c�P�|jj|jd�y)N�updater{ris r(r?zControl.updater=r*)	rRrSrTrUr\r8r;rr?rVr*r(r2r2as(��
� $��B�&�&�(�(r*r2c� �eZdZdZifd�Zd�Zy)�DirListaRDirList - displays a list view of a directory, its previous
    directories and its sub-directories. The user can choose one of
    the directories displayed in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist       HList
    hsb              Scrollbar
    vsb              Scrollbarc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirListr��hlist�vsb�hsb�r�r\�_dummyHListr��_dummyScrollbarrs    r(r\zDirList.__init__��a�����4���	�{�C��L�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�R�|jj|jd|�y�N�chdirr{�r&�dirs  r(rMz
DirList.chdir���������T�W�W�g�s�+r*N�rRrSrTrUr\rMrVr*r(rArA�s��"�$&�B�,r*rAc� �eZdZdZifd�Zd�Zy)�DirTreea�DirTree - Directory Listing in a hierarchical view.
    Displays a tree view of a directory, its previous directories and its
    sub-directories. The user can choose one of the directories displayed
    in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist           HList
    hsb             Scrollbar
    vsb             Scrollbarc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirTreer�rDrErFrGrs    r(r\zDirTree.__init__�rJr*c�R�|jj|jd|�yrLr{rNs  r(rMz
DirTree.chdir�rPr*NrQrVr*r(rSrS�s��	!�$&�B�,r*rSc��eZdZdZifd�Zy)�DirSelectBoxa�DirSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBoxc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixDirSelectBoxr��dirlist�dircbx)r�r\�
_dummyDirListr��_dummyFileComboBoxrs    r(r\zDirSelectBox.__init__�sK�����4��):�Y�K��b�Q�)6�t�Y�)G����I�&�(:�4��(J����H�%r*N�rRrSrTrUr\rVr*r(rXrX�s��'�$&�Kr*rXc�&�eZdZdZifd�Zd�Zd�Zy)�ExFileSelectBoxa�ExFileSelectBox - MS Windows style file select box.
    It provides a convenient method for the user to select files.

    Subwidget       Class
    ---------       -----
    cancel       Button
    ok              Button
    hidden       Checkbutton
    types       ComboBox
    dir              ComboBox
    file       ComboBox
    dirlist       ScrolledListBox
    filelist       ScrolledListBoxc���tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d	�|jd	<t|d
�|jd
<y)N�tixExFileSelectBoxr��cancel�ok�hidden�typesrOr[�file�filelist)r�r\rr��_dummyCheckbutton�_dummyComboBoxr]r!rs    r(r\zExFileSelectBox.__init__�s������4��)=�	�{�C�QS�T�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)6�t�Y�)G����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*c�P�|jj|jd�y�N�filterr{ris r(rnzExFileSelectBox.filter�r=r*c�P�|jj|jd�yrr{ris r(rzExFileSelectBox.invoke�r=r*N)rRrSrTrUr\rnrrVr*r(rara�s��&�$&�	R�(�(r*rac�&�eZdZdZifd�Zd�Zd�Zy)�DirSelectDialoga#The DirSelectDialog widget presents the directories in the file
    system in a dialog window. The user can use this dialog window to
    navigate through the file system to select the desired directory.

    Subwidgets       Class
    ----------       -----
    dirbox       DirSelectDialogc�l�tj||ddg||�t|d�|jd<y)N�tixDirSelectDialogr��dirbox)r�r\�_dummyDirSelectBoxr�rs    r(r\zDirSelectDialog.__init__�s7�����4��)=�%�;��R�	1�(:�4��(J����H�%r*c�P�|jj|jd�y�N�popupr{ris r(rxzDirSelectDialog.popup���������T�W�W�g�&r*c�P�|jj|jd�y�N�popdownr{ris r(r|zDirSelectDialog.popdown���������T�W�W�i�(r*N�rRrSrTrUr\rxr|rVr*r(rqrq�s��$�$&�K�'�)r*rqc�&�eZdZdZifd�Zd�Zd�Zy)�ExFileSelectDialogz�ExFileSelectDialog - MS Windows style file select dialog.
    It provides a convenient method for the user to select files.

    Subwidgets       Class
    ----------       -----
    fsbox       ExFileSelectBoxc�l�tj||ddg||�t|d�|jd<y)N�tixExFileSelectDialogr��fsbox)r�r\�_dummyExFileSelectBoxr�rs    r(r\zExFileSelectDialog.__init__s7�����4��)@�%�;��R�	1�'<�T�7�'K����G�$r*c�P�|jj|jd�yrwr{ris r(rxzExFileSelectDialog.popupryr*c�P�|jj|jd�yr{r{ris r(r|zExFileSelectDialog.popdownr}r*Nr~rVr*r(r�r��s��#�$&�L�
'�)r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�
FileSelectBoxa�ExFileSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBoxc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixFileSelectBoxr�r[rirn�	selection)r�r\r!r�rkrs    r(r\zFileSelectBox.__init__sy�����4��);�i�[�#�r�R�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*c�P�|jj|jd�yrmr{ris r(�apply_filterzFileSelectBox.apply_filter#r=r*c�P�|jj|jd�yrr{ris r(rzFileSelectBox.invoke&r=r*N)rRrSrTrUr\r�rrVr*r(r�r�s��'�$&�M�(�(r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�FileSelectDialogz�FileSelectDialog - Motif style file select dialog.

    Subwidgets       Class
    ----------       -----
    btns       StdButtonBox
    fsbox       FileSelectBoxc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixFileSelectDialogr��btnsr�)r�r\�_dummyStdButtonBoxr��_dummyFileSelectBoxrs    r(r\zFileSelectDialog.__init__3sN�����4��)>�%�;��R�	1�&8��v�&F����F�#�':�4��'I����G�$r*c�P�|jj|jd�yrwr{ris r(rxzFileSelectDialog.popup9ryr*c�P�|jj|jd�yr{r{ris r(r|zFileSelectDialog.popdown<r}r*Nr~rVr*r(r�r�*s��!�$&�J�'�)r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�	FileEntrya_FileEntry - Entry field with button that invokes a FileSelectDialog.
    The user can type in the filename manually. Alternatively, the user can
    press the button widget that sits next to the entry, which will bring
    up a file selection dialog.

    Subwidgets       Class
    ----------       -----
    button       Button
    entry       Entryc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�tixFileEntry�
dialogtyper��buttonr)r�r\rr�r rs    r(r\zFileEntry.__init__KsP�����4���(�)�4�c�2�	?�(4�T�8�(D����H�%�'2�4��'A����G�$r*c�P�|jj|jd�yrr{ris r(rzFileEntry.invokeQr=r*c��yrQrVris r(�file_dialogzFileEntry.file_dialogTs��r*N)rRrSrTrUr\rr�rVr*r(r�r�?s���$&�B�(�
r*r�c��eZdZdZdifd�Zifd�Zdifd�Zd�Zd�Zd7d�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zifd�Zifd�Zd�Zd�ZeZd�Zd�Zd�Zifd�Zifd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d8d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,ifd+�Z-ifd,�Z.d-�Z/d.�Z0d/�Z1ifd0�Z2d1�Z3d2�Z4ifd3�Z5d4�Z6d8d5�Z7d6�Z8y)9�HListaHList - Hierarchy display  widget can be used to display any data
    that have a hierarchical structure, for example, file system directory
    trees. The list entries are indented and connected by branch lines
    according to their places in the hierarchy.

    Subwidgets - NoneNc�<�tj||dddg||�y)N�tixHList�columnsr�rrs    r(r\zHList.__init__`s"�����4���%�y�1�3��	<r*c�t�|jj|jd|g|j||����S�Nr
rp�r&rr9r:s    r(r
z	HList.addds/���t�w�w�|�|�D�G�G�U�E�K�D�M�M�#�r�4J�K�Kr*c�|�|�d}|jj|jd|g|j||����S)Nrf�addchildrp)r&r�r9r:s    r(�	add_childzHList.add_childgsD���>��F��t�w�w�|�|��W�W�j�&�K�37�=�=��b�3I�K�	Kr*c�T�|jj|jdd|�y�N�anchor�setr{�r&rs  r(�
anchor_setzHList.anchor_setm��������T�W�W�h��u�5r*c�R�|jj|jdd�y�Nr��clearr{ris r(�anchor_clearzHList.anchor_clearp��������T�W�W�h��0r*c��|s)|jj|jdd||�S|jj|jdd|d|�S)Nr�widthz-charr{)r&�colr��charss    r(�column_widthzHList.column_widthssJ����7�7�<�<�����7�C��G�G��7�7�<�<�����7�C� '��0�
0r*c�R�|jj|jdd�y)Nr��allr{ris r(�
delete_allzHList.delete_allzs�������T�W�W�h��.r*c�T�|jj|jdd|�y)Nr�rr{r�s  r(�delete_entryzHList.delete_entry}s�������T�W�W�h���7r*c�T�|jj|jdd|�y)Nr��
offspringsr{r�s  r(�delete_offspringszHList.delete_offsprings�s�������T�W�W�h��e�<r*c�T�|jj|jdd|�y)Nr��siblingsr{r�s  r(�delete_siblingszHList.delete_siblings�s�������T�W�W�h�
�E�:r*c�T�|jj|jdd|�y�N�dragsiter�r{r0s  r(�dragsite_setzHList.dragsite_set���������T�W�W�j�%��7r*c�R�|jj|jdd�y�Nr�r�r{ris r(�dragsite_clearzHList.dragsite_clear���������T�W�W�j�'�2r*c�T�|jj|jdd|�y�N�dropsiter�r{r0s  r(�dropsite_setzHList.dropsite_set�r�r*c�R�|jj|jdd�y�Nr�r�r{ris r(�dropsite_clearzHList.dropsite_clear�r�r*c�x�|jj|jdd|g|j||����y)N�headerr�rp�r&r�r9r:s    r(�
header_createzHList.header_create�s.��������T�W�W�h��#�O��
�
�c�2�8N�Or*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1�r3rqr$r%r7r�s    r(�header_configurezHList.header_configure�sS���;��%�%�d�g�g�x��c�J�J�������T�W�W�h��S�	.��m�m�C��,�	.r*c�T�|jj|jdd||�S)Nr�r,r{)r&r��opts   r(�header_cgetzHList.header_cget�s!���w�w�|�|�D�G�G�X�v�s�C�@�@r*c��|jj|jj|jdd|��S)Nr��exist)r$�
getbooleanr%rq�r&r�s  r(�
header_existszHList.header_exists�s0���w�w�!�!�$�'�'�,�,�t�w�w��'�3�"O�P�Pr*c�T�|jj|jdd|�y)Nr�r�r{r�s  r(�
header_deletezHList.header_delete�s�������T�W�W�h��#�6r*c�R�|jj|jdd|�S)Nr��sizer{r�s  r(�header_sizezHList.header_size�s���w�w�|�|�D�G�G�X�v�s�;�;r*c�T�|jj|jdd|�y)N�hiderr{r�s  r(�
hide_entryzHList.hide_entry�s�������T�W�W�f�g�u�5r*c�x�|jj|jdd|g|j||����y)N�	indicatorr�rpr�s    r(�indicator_createzHList.indicator_create�s6���������g�g�{�H�e�	N�6:�m�m�C��6L�	Nr*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1r�r�s    r(�indicator_configurezHList.indicator_configure�s[���;��%�%�����k�5�:�
:��������g�g�{�K��	Q�9=���s�B�9O�	Qr*c�T�|jj|jdd||�S)Nr�r,r{�r&rr�s   r(�indicator_cgetzHList.indicator_cget�s!���w�w�|�|�D�G�G�[�&�%��E�Er*c�R�|jj|jdd|�S)Nr��existsr{r�s  r(�indicator_existszHList.indicator_exists�s���w�w�|�|�T�W�W�k�8�U�C�Cr*c�T�|jj|jdd|�y)Nr�r�r{r�s  r(�indicator_deletezHList.indicator_delete�s�������T�W�W�k�8�U�;r*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�indicator_sizezHList.indicator_size�s���w�w�|�|�D�G�G�[�&�%�@�@r*c�P�|jj|jdd�S�Nr�r�r{ris r(�info_anchorzHList.info_anchor�����w�w�|�|�D�G�G�V�X�6�6r*c�x�|j|jj|jdd|��xsdS�Nr��bbox)�_getintsr$r%rqr�s  r(�	info_bboxzHList.info_bbox�s7���}�}������T�W�W�f�f�e�<�>�F�AE�	Fr*c��|jj|jdd|�}|jj|�S)Nr�r��r$r%rqr�)r&rr�s   r(�
info_childrenzHList.info_children�s3���G�G�L�L����&�*�e�<���w�w� � ��#�#r*c�R�|jj|jdd|�S)Nr��datar{r�s  r(�	info_datazHList.info_data�����w�w�|�|�D�G�G�V�V�U�;�;r*c�P�|jj|jdd�S)Nr�r�r{ris r(�
info_dragsitezHList.info_dragsite�����w�w�|�|�D�G�G�V�Z�8�8r*c�P�|jj|jdd�S)Nr�r�r{ris r(�
info_dropsitezHList.info_dropsite�rr*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�info_existszHList.info_exists�����w�w�|�|�D�G�G�V�X�u�=�=r*c�R�|jj|jdd|�S)Nr�rfr{r�s  r(�info_hiddenzHList.info_hidden�rr*c�R�|jj|jdd|�S)Nr��nextr{r�s  r(�	info_nextzHList.info_next�r
r*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�info_parentzHList.info_parent�rr*c�R�|jj|jdd|�S)Nr��prevr{r�s  r(�	info_prevzHList.info_prev�r
r*c��|jj|jdd�}|jj|�S�Nr�r�rr�s  r(�info_selectionzHList.info_selection��1���G�G�L�L����&�+�6���w�w� � ��#�#r*c�V�|jj|jdd|||�S)N�itemr,r{)r&rr�r�s    r(�	item_cgetzHList.item_cget�s#���w�w�|�|�D�G�G�V�V�U�C��E�Er*c��|�|j|jdd||�S|jj|jdd||g|j	||����y)Nr%r1r��r&rr�r9r:s     r(�item_configurezHList.item_configure�sW���;��%�%�d�g�g�v�{�E�3�O�O�������T�W�W�f�k�5�#�	'��}�}�S�"�%�	'r*c�z�|jj|jdd||g|j||����y)Nr%r�rpr(s     r(�item_createzHList.item_create�s8���������g�g�v�x���	N�6:�m�m�C��6L�	Nr*c�T�|jj|jdd||�S)Nr%r�r{�r&rr�s   r(�item_existszHList.item_exists�s!���w�w�|�|�D�G�G�V�X�u�c�B�Br*c�V�|jj|jdd||�y)Nr%r�r{r-s   r(�item_deletezHList.item_delete�s�������T�W�W�f�h��s�;r*c�R�|jj|jd||�S)N�	entrycgetr{r�s   r(r2zHList.entrycget�s���w�w�|�|�D�G�G�[�%��=�=r*c��|�|j|jd|�S|jj|jd|g|j	||����y�N�entryconfigurer�r�s    r(r5zHList.entryconfiguresQ���;��%�%�d�g�g�/?��G�G�������T�W�W�.��	'��}�}�S�"�%�	'r*c�P�|jj|jd|�S�N�nearestr{)r&r�s  r(r8z
HList.nearests���w�w�|�|�D�G�G�Y��2�2r*c�R�|jj|jd|�y�N�seer{r�s  r(r;z	HList.see��������T�W�W�e�U�+r*c�v�|jj|jddg|j||����y�Nr�r�rpr8s   r(�selection_clearzHList.selection_clear�,��������T�W�W�k�7�L�T�]�]�3��5K�Lr*c�R�|jj|jdd|�S�Nr��includesr{r�s  r(�selection_includeszHList.selection_includes����w�w�|�|�D�G�G�[�*�e�D�Dr*c�V�|jj|jdd||�y�Nr�r�r{�r&�first�lasts   r(�
selection_setzHList.selection_set��������T�W�W�k�5�%��>r*c�R�|jj|jdd|�S)N�showrr{r�s  r(�
show_entryzHList.show_entry����w�w�|�|�D�G�G�V�W�e�<�<r*)rNNrQ)9rRrSrTrUr\r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��header_existr�r�r�r�r�r�r�r�r�rrr	rrrrrrrrr"r&r)r+r.r0r2r5r8r;r?rDrKrOrVr*r(r�r�Xs]���#�r�<� �L� $��K�6�1�0�/�8�=�;�8�3�8�3�&(�P�)+�.�A�Q�
!�L�7�<�6�+-�N�.0�Q�F�D�<�A�7�F�$�<�9�9�>�>�<�>�<�$�F�.0�'�+-�N�C�<�>�)+�'�3�,�#%�M�E�?�=r*r�c��eZdZdZdifd�Zy)�	InputOnlyz?InputOnly - Invisible widget. Unix only.

    Subwidgets - NoneNc�8�tj||dd||�y)N�tixInputOnlyrrs    r(r\zInputOnly.__init__s�����4����s�B�Gr*r_rVr*r(rSrSs���#�r�Hr*rSc��eZdZdZdifd�Zy)�
LabelEntryaLabelEntry - Entry field with label. Packages an entry widget
    and a label into one mega widget. It can be used to simplify the creation
    of ``entry-form'' type of interface.

    Subwidgets       Class
    ----------       -----
    label       Label
    entry       EntryNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelEntry�	labelsider�r�r)r�r\r�r�r rs    r(r\zLabelEntry.__init__,�P�����4���'�	�2�C��	=�'2�4��'A����G�$�'2�4��'A����G�$r*r_rVr*r(rWrW"s���#�r�Br*rWc��eZdZdZdifd�Zy)�
LabelFrameaeLabelFrame - Labelled Frame container. Packages a frame widget
    and a label into one mega widget. To create widgets inside a
    LabelFrame widget, one creates the new widgets relative to the
    frame subwidget and manage them inside the frame subwidget.

    Subwidgets       Class
    ----------       -----
    label       Label
    frame       FrameNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelFramerZr�r��frame)r�r\r�r��_dummyFramers    r(r\zLabelFrame.__init__=r[r*r_rVr*r(r]r]2s���#�r�Br*r]c�6�eZdZdZifd�Zifd�Zd�Zd�Zd�Zy)�ListNoteBookaA ListNoteBook widget is very similar to the TixNoteBook widget:
    it can be used to display many windows in a limited space using a
    notebook metaphor. The notebook is divided into a stack of pages
    (windows). At one time only one of these pages can be shown.
    The user can navigate through these pages by
    choosing the name of the desired page in the hlist subwidget.c���tj||ddg||�t|dd��|jd<t	|d�|jd<t|d�|jd<y)N�tixListNoteBookr��panerr�rD�shlist)r�r\�_dummyPanedWindowr�rH�_dummyScrolledHListrs    r(r\zListNoteBook.__init__Lsh�����4��):�Y�K��b�Q�&7��f�KL�'N����F�#�'2�4��'A����G�$�(;�D�(�(K����H�%r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr��r$r%rqr7r�r��r&rCr9r:s    r(r
zListNoteBook.addT�T��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�$<����D�!��"�"�4�(�(r*c�$�|j|�SrQ�r�rBs  r(�pagezListNoteBook.pageY����~�~�d�#�#r*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|S�N�pages�r$r�r%rqr�r��r&r��retr�s    r(rtzListNoteBook.pages\�R�����!�!�$�'�'�,�,�t�w�w��"@�A�����A��J�J�t�~�~�a�(�)���
r*c�R�|jj|jd|�y�N�raiser{rBs  r(�
raise_pagezListNoteBook.raise_paged��������T�W�W�g�t�,r*N)	rRrSrTrUr\r
rprtr|rVr*r(rcrcDs,��E�$&�L��)�
$��-r*rcc��eZdZdZdifd�Zy)�MeterzuThe Meter widget can be used to show the progress of a background
    job which may take a long time to execute.
    Nc�:�tj||ddg||�y)N�tixMeterr�rrs    r(r\zMeter.__init__ls�����4���%�;��R�	1r*r_rVr*r(rrgs���#��1r*rc�D�eZdZdZdifd�Zifd�Zd�Zd�Zd�Zd�Z	d	�Z
y)
�NoteBookz�NoteBook - Multi-page container widget (tabbed notebook metaphor).

    Subwidgets       Class
    ----------       -----
    nbframe       NoteBookFrame
    <pages>       page widgets added dynamically with the add methodNc�p�tj||ddg||�t|dd��|jd<y)N�tixNoteBookr��nbframerr�)r�r\r�r�rs    r(r\zNoteBook.__init__xs9�����4��}�y�k�3��K�)5�d�I�IJ�*L����I�&r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr�rkrls    r(r
zNoteBook.add}rmr*c��|jj|jd|�|j|j	�|j|=yr��r$r%rqr�rhrBs  r(r�zNoteBook.delete��?�������T�W�W�h��-����D�!�)�)�+�����%r*c�$�|j|�SrQrorBs  r(rpz
NoteBook.page�rqr*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|Srsrurvs    r(rtzNoteBook.pages�rxr*c�R�|jj|jd|�yrzr{rBs  r(r|zNoteBook.raise_page�r}r*c�N�|jj|jd�S)N�raisedr{ris r(r�zNoteBook.raised�s���w�w�|�|�D�G�G�X�.�.r*)rRrSrTrUr\r
r�rprtr|r�rVr*r(r�r�ps8��H�#�r�L�
�)�
&�
$��-�/r*r�c��eZdZy)�
NoteBookFrameN)rRrSrTrVr*r(r�r��s��r*r�c�@�eZdZdZifd�Zifd�Zifd�Zd�Zd�Zd�Z	y)	�
OptionMenuz�OptionMenu - creates a menu button of options.

    Subwidget       Class
    ---------       -----
    menubutton      Menubutton
    menu            Menuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�
tixOptionMenur��
menubutton�menu�r�r\�_dummyMenubuttonr��
_dummyMenurs    r(r\zOptionMenu.__init__�sJ�����4���9�+�s�B�O�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�x�|jj|jdd|g|j||����y)Nr
�commandrprls    r(�add_commandzOptionMenu.add_command�s.��������T�W�W�e�Y��N�t�}�}�S�"�7M�Nr*c�x�|jj|jdd|g|j||����y)Nr
�	separatorrprls    r(�
add_separatorzOptionMenu.add_separator�s.��������T�W�W�e�[�$�P����s�B�9O�Pr*c�R�|jj|jd|�yr�r{rBs  r(r�zOptionMenu.delete���������T�W�W�h��-r*c�R�|jj|jd|�y)N�disabler{rBs  r(r�zOptionMenu.disable�s�������T�W�W�i��.r*c�R�|jj|jd|�y)N�enabler{rBs  r(r�zOptionMenu.enable�r�r*N)
rRrSrTrUr\r�r�r�r�r�rVr*r(r�r��s6���$&�?�
%'�O�')�Q�.�/�.r*r�c�F�eZdZdZifd�Zifd�Zd�Zd�Zd�Zifd�Z	d�Z
y	)
�PanedWindowa�PanedWindow - Multi-pane container widget
    allows the user to interactively manipulate the sizes of several
    panes. The panes can be arranged either vertically or horizontally.The
    user changes the sizes of the panes by dragging the resize handle
    between two panes.

    Subwidgets       Class
    ----------       -----
    <panes>       g/p widgets added dynamically with the add method.c�<�tj||dddg||�y)N�tixPanedWindowrr�rrs    r(r\zPanedWindow.__init__�s"�����4��)9�M�9�;U�WZ�\^�_r*c���|jj|jd|g|j||����t	||d��|j
|<|j
|S)Nr
r)r�rkrls    r(r
zPanedWindow.add�sZ��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�DE�%G����D�!��"�"�4�(�(r*c��|jj|jd|�|j|j	�|j|=yr�r�rBs  r(r�zPanedWindow.delete�r�r*c�R�|jj|jd|�y)Nr}r{rBs  r(r}zPanedWindow.forget�r�r*c�R�|jj|jd||�S)N�panecgetr{r�s   r(r�zPanedWindow.panecget�s���w�w�|�|�D�G�G�Z���<�<r*c��|�|j|jd|�S|jj|jd|g|j	||����y)N�
paneconfigurer�r�s    r(r�zPanedWindow.paneconfigure�sJ���;��%�%�d�g�g���F�F�������T�W�W�o�u�N�t�}�}�S�"�7M�Nr*c���|jj|jj|jd��}|D�cgc]}|j	|���c}Scc}w)N�panes)r$r�r%rqr�)r&r�r�s   r(r�zPanedWindow.panes�sJ�����!�!�$�'�'�,�,�t�w�w��"@�A��+0�1�5�a����q�!�5�1�1��1s�AN)rRrSrTrUr\r
r�r}r�r�r�rVr*r(r�r��s<��H�$&�`��)�&�
.�=�(*�O�
2r*r�c�,�eZdZdZifd�Zd�Zd�Zd�Zy)�	PopupMenuaPopupMenu widget can be used as a replacement of the tk_popup command.
    The advantage of the Tix PopupMenu widget is it requires less application
    code to manipulate.


    Subwidgets       Class
    ----------       -----
    menubutton       Menubutton
    menu       Menuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixPopupMenur�r�r�r�rs    r(r\zPopupMenu.__init__�sJ�����4���)��c�2�N�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�f�|jj|jd|j�y)Nr�r{r�s  r(r�zPopupMenu.bind_widget���������T�W�W�f�f�i�i�0r*c�f�|jj|jd|j�yr�r{r�s  r(rzPopupMenu.unbind_widget�rr*c�j�|jj|jd|j||�y)N�postr{)r&r�r�r�s    r(�post_widgetzPopupMenu.post_widget�s"�������T�W�W�f�f�i�i��A�6r*N)rRrSrTrUr\r�rr�rVr*r(r�r��s ���$&�?�
1�3�7r*r�c�2�eZdZdZifd�Zd�Zd�Zd�Zd�Zy)�ResizeHandlez;Internal widget to draw resize handles on Scrolled widgets.c�@�gd�}tj||d|||�y)N)	r�r��cursorfg�cursorbg�
handlesize�	hintcolor�	hintwidthr�r��tixResizeHandler)r&r�r9r:�flagss     r(r\zResizeHandle.__init__�s'����	���4��):� �#�r�	+r*c�f�|jj|jd|j�y)N�attachwidgetr{r�s  r(�
attach_widgetzResizeHandle.attach_widget��������T�W�W�n�f�i�i�8r*c�f�|jj|jd|j�y)N�detachwidgetr{r�s  r(�
detach_widgetzResizeHandle.detach_widget
r�r*c�f�|jj|jd|j�y)Nr�r{r�s  r(r�zResizeHandle.hide
r�r*c�f�|jj|jd|j�y)NrNr{r�s  r(rNzResizeHandle.showr�r*N)	rRrSrTrUr\r�r�r�rNrVr*r(r�r��s!��E�#%�+�9�9�1�1r*r�c��eZdZdZifd�Zy)�
ScrolledHListz0ScrolledHList - HList with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledHListr�rDrErFrGrs    r(r\zScrolledHList.__init__�e�����4��);�i�[���	$�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r����:�$&�Br*r�c��eZdZdZifd�Zy)�ScrolledListBoxz4ScrolledListBox - Listbox with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledListBoxr��listboxrErF)r�r\�
_dummyListboxr�rIrs    r(r\zScrolledListBox.__init__"sc�����4��)=�	�{�C�QS�T�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�s��>�$&�Br*r�c��eZdZdZifd�Zy)�ScrolledTextz.ScrolledText - Text with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTextr�rrErF)r�r\�
_dummyTextr�rIrs    r(r\zScrolledText.__init__,sb�����4��):�Y�K��b�Q�&0��v�&>����F�#�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�(s��8�$&�Br*r�c��eZdZdZifd�Zy)�
ScrolledTListz0ScrolledTList - TList with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTListr��tlistrErF)r�r\�_dummyTListr�rIrs    r(r\zScrolledTList.__init__6r�r*Nr_rVr*r(r�r�2r�r*r�c��eZdZdZifd�Zy)�ScrolledWindowz2ScrolledWindow - Window with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledWindowr�rrErF)r�r\rar�rIrs    r(r\zScrolledWindow.__init__Asc�����4��)<�y�k�3�PR�S�(3�D�(�(C����H�%�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�=s��<�$&�Br*r�c�*�eZdZdZifd�Zifd�Zd�Zy)�Selectz�Select - Container of button subwidgets. It can be used to provide
    radio-box or check-box style of selection options for the user.

    Subwidgets are buttons added dynamically using the add method.c�n�tj||dgd�||�t|d�|jd<y)N�	tixSelect)�	allowzero�radiorrZr�r�r�rs    r(r\zSelect.__init__Ns9�����4���'���	$�(3�4��'A����G�$r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr�rrls    r(r
z
Select.addUrmr*c�R�|jj|jd|�yrr{rBs  r(rz
Select.invokeZr�r*NrrVr*r(r�r�Gs"��F�$&�B��)�
.r*r�c��eZdZdZdifd�Zy)�Shellz'Toplevel window.

    Subwidgets - NoneNc�<�tj||dddg||�y)N�tixShellr��titlerrs    r(r\zShell.__init__bs �����4���i��5I�3�PR�Sr*r_rVr*r(r�r�]s���#�r�Tr*r�c�.�eZdZdZdifd�Zd�Zd�Zd�Zy)�DialogShellz�Toplevel window, with popup popdown and center methods.
    It tells the window manager that it is a dialog window and should be
    treated specially. The exact treatment depends on the treatment of
    the window manager.

    Subwidgets - NoneNc�<�tj||dgd�||�y)N�tixDialogShell)r�r��mapped�	minheight�minwidthr��	transientrrs    r(r\zDialogShell.__init__ns!�����4��+�3�47��		=r*c�P�|jj|jd�yr{r{ris r(r|zDialogShell.popdownur}r*c�P�|jj|jd�yrwr{ris r(rxzDialogShell.popupxryr*c�P�|jj|jd�y)N�centerr{ris r(rzDialogShell.center{r=r*)rRrSrTrUr\r|rxrrVr*r(r�r�es"���#�r�=�)�'�(r*r�c�"�eZdZdZdifd�Zd�Zy)�StdButtonBoxz@StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) Nc��tj||dddg||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)N�tixStdButtonBoxrr�re�applyrd�help)r�r\rr�rs    r(r\zStdButtonBox.__init__�s������4��):�)�9�5�s�B�	@�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*c�p�||jvr(|jj|jd|�yyrrrBs  r(rzStdButtonBox.invoke�rr*)rRrSrTrUr\rrVr*r(rr~s��J�"��A�2r*rc��eZdZdZdifd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
ifd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Zdd�Zy)�TLista�TList - Hierarchy display widget which can be
    used to display data in a tabular format. The list entries of a TList
    widget are similar to the entries in the Tk listbox widget. The main
    differences are (1) the TList widget can display the list entries in a
    two dimensional format and (2) you can use graphical images as well as
    multiple colors and fonts for the list entries.

    Subwidgets - NoneNc�:�tj||ddg||�y)N�tixTListr�rrs    r(r\zTList.__init__�s�����4���i�[�#�r�Jr*c�T�|jj|jdd|�y)N�activer�r{r0s  r(�
active_setzTList.active_set�r�r*c�R�|jj|jdd�y)Nrr�r{ris r(�active_clearzTList.active_clear�r�r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.anchor_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.anchor_clear�r�r*c�T�|jj|jd||�yr�r{�r&�from_�tos   r(r�zTList.delete�s�������T�W�W�h��r�2r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.dragsite_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.dragsite_clear�r�r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.dropsite_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.dropsite_clear�r�r*c�v�|jj|jd|g|j||����yr+rp)r&r-r9r:s    r(r,zTList.insert�s,��������T�W�W�h��G��
�
�c�2�0F�Gr*c�P�|jj|jdd�S)Nr�rr{ris r(�info_activezTList.info_active�rr*c�P�|jj|jdd�Sr�r{ris r(rzTList.info_anchor�rr*c�R�|jj|jdd|�S)Nr��downr{r0s  r(�	info_downzTList.info_down�r
r*c�R�|jj|jdd|�S)Nr��leftr{r0s  r(�	info_leftzTList.info_left�r
r*c�R�|jj|jdd|�S)Nr��rightr{r0s  r(�
info_rightzTList.info_right�rPr*c��|jj|jdd�}|jj|�Sr!rr�s  r(r"zTList.info_selection�r#r*c�P�|jj|jdd�S)Nr�r�r{ris r(�	info_sizezTList.info_size�s���w�w�|�|�D�G�G�V�V�4�4r*c�R�|jj|jdd|�S)Nr��upr{r0s  r(�info_upz
TList.info_up�s���w�w�|�|�D�G�G�V�T�5�9�9r*c�R�|jj|jd||�Sr7r{�r&r�r�s   r(r8z
TList.nearest�s���w�w�|�|�D�G�G�Y��1�5�5r*c�R�|jj|jd|�yr:r{r0s  r(r;z	TList.see�r<r*c�v�|jj|jddg|j||����yr>rpr8s   r(r?zTList.selection_clear�r@r*c�R�|jj|jdd|�SrBr{r0s  r(rDzTList.selection_includes�rEr*c�V�|jj|jdd||�yrGr{rHs   r(rKzTList.selection_set�rLr*rQ)rRrSrTrUr\rrr�r�r�r�r�r�r�r,r!rr%r(r+r"r.r1r8r;r?rDrKrVr*r(r
r
�s����#�r�K�6�1�6�1�3�8�3�8�3�!#�H�7�7�<�<�=�$�5�:�6�,�#%�M�E�?r*r
c�<�eZdZdZdifd�Zd�Zd�Zd�Zd�Zd	d�Z	y)
�Treez�Tree - The tixTree widget can be used to display hierarchical
    data in a tree form. The user can adjust
    the view of the tree by opening or closing parts of the tree.Nc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixTreer�rDrErFrGrs    r(r\z
Tree.__init__�sd�����4���%�;��R�	1�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�P�|jj|jd�y�aThis command calls the setmode method for all the entries in this
     Tree widget: if an entry has no child entries, its mode is set to
     none. Otherwise, if the entry has any hidden child entries, its mode is
     set to open; otherwise its mode is set to close.�autosetmodeNr{ris r(r>zTree.autosetmode����
	
�����T�W�W�m�,r*c�R�|jj|jd|�y�z8Close the entry given by entryPath if its mode is close.�closeNr{�r&�	entrypaths  r(rBz
Tree.close���������T�W�W�g�y�1r*c�P�|jj|jd|�S�z9Returns the current mode of the entry given by entryPath.�getmoder{rCs  r(rHzTree.getmode�����w�w�|�|�D�G�G�Y�	�:�:r*c�R�|jj|jd|�y�z6Open the entry given by entryPath if its mode is open.�openNr{rCs  r(rLz	Tree.open���������T�W�W�f�i�0r*c�T�|jj|jd||�y)a�This command is used to indicate whether the entry given by
     entryPath has children entries and whether the children are visible. mode
     must be one of open, close or none. If mode is set to open, a (+)
     indicator is drawn next the entry. If mode is set to close, a (-)
     indicator is drawn next the entry. If mode is set to none, no
     indicators will be drawn for this entry. The default mode is none. The
     open mode indicates the entry has hidden children and this entry can be
     opened by the user. The close mode indicates that all the children of the
     entry are now visible and the entry can be closed by the user.�setmodeNr{�r&rD�modes   r(rOzTree.setmodes��	
�����T�W�W�i��D�9r*)�none)
rRrSrTrUr\r>rBrHrLrOrVr*r(r9r9�s.��E�
#��B�-�2�;�1�
:r*r9c�J�eZdZdZdifd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
dd
�Zy)�	CheckListz�The CheckList widget
    displays a list of items to be selected by the user. CheckList acts
    similarly to the Tk checkbutton or radiobutton widgets, except it is
    capable of handling many more items than checkbuttons or radiobuttons.
    Nc���tj||dddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixCheckListr�r�rDrErFrGrs    r(r\zCheckList.__init__sg�����4���%�w�/��b�	:�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�P�|jj|jd�yr=r{ris r(r>zCheckList.autosetmoder?r*c�R�|jj|jd|�yrAr{rCs  r(rBzCheckList.close#rEr*c�P�|jj|jd|�SrGr{rCs  r(rHzCheckList.getmode'rIr*c�R�|jj|jd|�yrKr{rCs  r(rLzCheckList.open+rMr*c��|jj|jj|jd|��S)z�Returns a list of items whose status matches status. If status is
     not specified, the list of items in the "on" status will be returned.
     Mode can be on, off, default�getselection)r$r�r%rq)r&rQs  r(r\zCheckList.getselection/s.���w�w� � ������d�g�g�~�t�!L�M�Mr*c�P�|jj|jd|�S)z(Returns the current status of entryPath.�	getstatusr{rCs  r(r^zCheckList.getstatus5s���w�w�|�|�D�G�G�[�)�<�<r*c�T�|jj|jd||�y)z~Sets the status of entryPath to be status. A bitmap will be
     displayed next to the entry its status is on, off or default.�	setstatusNr{rPs   r(r`zCheckList.setstatus9s��	
�����T�W�W�k�9�d�;r*)�on)rRrSrTrUr\r>rBrHrLr\r^r`rVr*r(rTrTs8���#��B�-�2�;�1�N�=�<r*rTc��eZdZdd�Zy)rc�4�tj||||�yrQ�r�r\�r&r�rCr�s    r(r\z_dummyButton.__init__E������d�F�D�2D�Er*N�r��rRrSrTr\rVr*r(rrD���Fr*rc��eZdZdd�Zy)rjc�4�tj||||�yrQrdres    r(r\z_dummyCheckbutton.__init__Irfr*NrgrhrVr*r(rjrjHrir*rjc��eZdZdd�Zy)r c�4�tj||||�yrQrdres    r(r\z_dummyEntry.__init__Mrfr*NrgrhrVr*r(r r Lrir*r c��eZdZdd�Zy)rac�4�tj||||�yrQrdres    r(r\z_dummyFrame.__init__Qrfr*NrgrhrVr*r(raraPrir*rac��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyLabel.__init__Urfr*NrgrhrVr*r(r�r�Trir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyListbox.__init__Yrfr*NrgrhrVr*r(r�r�Xrir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyMenu.__init__]rfr*NrgrhrVr*r(r�r�\rir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyMenubutton.__init__arfr*NrgrhrVr*r(r�r�`rir*r�c��eZdZdd�Zy)rIc�4�tj||||�yrQrdres    r(r\z_dummyScrollbar.__init__erfr*NrgrhrVr*r(rIrIdrir*rIc��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyText.__init__irfr*NrgrhrVr*r(r�r�hrir*r�c��eZdZdd�Zy)r!c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr�rErF)r�r\r�r�rIres    r(r\z_dummyScrolledListBox.__init__ms\�����d�F�D�2D�E�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*NrgrhrVr*r(r!r!l���Br*r!c��eZdZdd�Zy)rHc�4�tj||||�yrQrdres    r(r\z_dummyHList.__init__trfr*NrgrhrVr*r(rHrHsrir*rHc��eZdZdd�Zy)ric���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y�NrDrErF�r�r\rHr�rIres    r(r\z_dummyScrolledHList.__init__x�\�����d�F�D�2D�E�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*NrgrhrVr*r(ririwr~r*ric��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyTList.__init__rfr*NrgrhrVr*r(r�r�~rir*r�c��eZdZdd�Zy)rkc��tj|||d|g�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)Nrr�rrrrr)r�r\r�r�r rr!r"res    r(r\z_dummyComboBox.__init__�s������d�F�D�7�;M�2N�O�'2�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B3�3	B?�>B?NrgrhrVr*r(rkrk�s��r*rkc��eZdZdd�Zy)r]c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<yr�r�res    r(r\z_dummyDirList.__init__�r�r*NrgrhrVr*r(r]r]�r~r*r]c��eZdZdd�Zy)ruc��tj||||�t|d�|jd<t	|d�|jd<y)Nr[r\)r�r\r]r�r^res    r(r\z_dummyDirSelectBox.__init__�sE�����d�F�D�2D�E�)6�t�Y�)G����I�&�(:�4��(J����H�%r*NrgrhrVr*r(ruru�s��Kr*ruc��eZdZdd�Zy)r�c���tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d�|jd<t
|d�|jd<y)	NrdrerfrgrOr[rhri)r�r\rr�rjrkr!res    r(r\z_dummyExFileSelectBox.__init__�s������d�F�D�2D�E�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)>�t�Y�)O����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*NrgrhrVr*r(r�r��s��	Rr*r�c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr[rirnr�)r�r\r!r�rkres    r(r\z_dummyFileSelectBox.__init__�ss�����d�F�D�2D�E�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*NrgrhrVr*r(r�r��s��Mr*r�c��eZdZdd�Zy)r^c�f�tj||||�t|d�|jd<y)Nr\)r�r\rkr�res    r(r\z_dummyFileComboBox.__init__�s.�����d�F�D�2D�E�(6�t�X�(F����H�%r*NrgrhrVr*r(r^r^�s��Gr*r^c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)Nrer	rdr
)r�r\rr�res    r(r\z_dummyStdButtonBox.__init__�ss�����d�F�D�2D�E�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*NrgrhrVr*r(r�r��s��Ar*r�c��eZdZdd�Zy)�_dummyNoteBookFramec�4�tj||||�yrQrdres    r(r\z_dummyNoteBookFrame.__init__�rfr*N)rrhrVr*r(r�r��rir*r�c��eZdZdd�Zy)rhc�4�tj||||�yrQrdres    r(r\z_dummyPanedWindow.__init__�rfr*NrgrhrVr*r(rhrh�rir*rhc�N�|jjd|j�S)zzReturns the qualified path name for the widget. Normally used to set
    default options for subwidgets. See tixwidgets.py�
tixOptionNamer{)r�s r(�
OptionNamer��s���9�9�>�>�/�6�9�9�5�5r*c�h�d}|j�D]}|dz|zdz|zdz||zdz}�|S)Nrfz{{z} {z - z}} )�keys)�dict�s�types   r(�FileTypeListr��sF��
�A��	�	���
��H�t�O�e�#�d�*�U�2�T�$�Z�?�%�G����Hr*c��eZdZdZy)�CObjViewaBThis file implements the Canvas Object View widget. This is a base
    class of IconView. It implements automatic placement/adjustment of the
    scrollbars according to the canvas objects inside the canvas subwidget.
    The scrollbars are adjusted so that the canvas is just large enough
    to see all the objects.
    N)rRrSrTrUrVr*r(r�r��s���	r*r�c��eZdZdZdifd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zdd�Z
d
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zy)�Grida}The Tix Grid command creates a new window  and makes it into a
    tixGrid widget. Additional options, may be specified on the command
    line or in the option database to configure aspects such as its cursor
    and relief.

    A Grid widget displays its contents in a two dimensional grid of cells.
    Each cell may contain one Tix display item, which may be in text,
    graphics or other formats. See the DisplayStyle class for more information
    about Tix display items. Individual cells, or groups of cells, can be
    formatted with a wide range of attributes, such as its color, relief and
    border.

    Subwidgets - NoneNc�J�g}||_tj||d|||�y)N�tixGrid�r9r�r\r�s     r(r\z
Grid.__init__�s&����������4���F�C��Dr*c�>�|jj|dd�y)zRemoves the selection anchor.r�r�Nr#ris r(r�zGrid.anchor_clears�������T�8�W�-r*c�Z�|j|jj|dd��S)z3Get the (x,y) coordinate of the current anchor cellr�rI�rr$r%ris r(�
anchor_getzGrid.anchor_gets"���}�}�T�W�W�\�\�$��%�@�A�Ar*c�B�|jj|dd||�y)z/Set the selection anchor to the cell at (x, y).r�r�Nr#r3s   r(r�zGrid.anchor_sets�������T�8�U�A�q�1r*c��|�|jj|dd|�y|jj|dd||�y)zdDelete rows between from_ and to inclusive.
        If to is not provided,  delete only row at from_Nr�rr#rs   r(�
delete_rowzGrid.delete_rows7���:��G�G�L�L��x���6��G�G�L�L��x���r�:r*c��|�|jj|dd|�y|jj|dd||�y)zjDelete columns between from_ and to inclusive.
        If to is not provided,  delete only column at from_Nr�rr#rs   r(�
delete_columnzGrid.delete_columns7���:��G�G�L�L��x��5�9��G�G�L�L��x��5�"�=r*c�>�|jj|dd�y)zUIf any cell is being edited, de-highlight the cell  and  applies
        the changes.�editr	Nr#ris r(�
edit_applyzGrid.edit_apply#s��	
�����T�6�7�+r*c�B�|jj|dd||�y)zmHighlights  the  cell  at  (x, y) for editing, if the -editnotify
        command returns True for this cell.r�r�Nr#r3s   r(�edit_setz
Grid.edit_set(s��	
�����T�6�5�!�Q�/r*c�^�|r
|ddk7rd|z}|jj|d|||�S)z&Get the option value for cell at (x,y)rr2r2r#)r&r�r�r.s    r(r2zGrid.entrycget-s4���f�Q�i�3�&��6�\�F��w�w�|�|�D�+�q�!�V�<�<r*c�.�|jd||f||�Sr4)�
_configure)r&r�r�r9r:s     r(r5zGrid.entryconfigure3s����� 0�!�Q�7��b�A�Ar*c	�^�|j|jj|dd||��S)z+Return True if display item exists at (x,y)r�r�)�_getbooleanr$r%r3s   r(rzGrid.info_exists9s(����������T�6�8�Q�� J�K�Kr*c�@�|jj|dd||�Srr#r3s   r(rzGrid.info_bbox=s���w�w�|�|�D�&�&�!�Q�7�7r*c�D�|jj|dd|||�y)z�Moves the range of columns from position FROM through TO by
        the distance indicated by OFFSET. For example, move_column(2, 4, 1)
        moves the columns 2,3,4 to columns 3,4,5.�moverNr#�r&rr�offsets    r(�move_columnzGrid.move_columnAs��	
�����T�6�8�U�B��?r*c�D�|jj|dd|||�y)z�Moves the range of rows from position FROM through TO by
        the distance indicated by OFFSET.
        For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.r�rNr#r�s    r(�move_rowz
Grid.move_rowGs��	
�����T�6�5�%��V�<r*c�\�|j|jj|d||��S)z8Return coordinate of cell nearest pixel coordinate (x,y)r8r�r3s   r(r8zGrid.nearestMs$���}�}�T�W�W�\�\�$�	�1�a�@�A�Ar*c��|j|j|�}|�d|f|z}|jj|d||g|���y)Nz	-itemtyper�)r7r9r$r%)r&r�r�r�r:�argss      r(r�zGrid.setWsH���m�m�D�H�H�b�)������)�D�0�D�������T�5�!�Q�.��.r*c	��|jj|jj|jdd|g|j	i|�����S)a�Queries or sets the size of the column given by
        INDEX.  INDEX may be any non-negative
        integer that gives the position of a given column.
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all columns.
        When no option-value pair is given, this command returns a tuple
        containing the current size setting of the given column.  When
        option-value pairs are given, the corresponding options of the
        size setting of the given column are changed. Options may be one
        of the following:
              pad0 pixels
                     Specifies the paddings to the left of a column.
              pad1 pixels
                     Specifies the paddings to the right of a column.
              size val
                     Specifies the width of a column.  Val may be:
                     "auto" -- the width of the column is set to the
                     width of the widest cell in the column;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the width of the column to the
                     given number of characters.r�r)r$r�r%rqr7�r&r-r:s   r(�size_columnzGrid.size_column]sK��.�w�w� � �������d�g�g�v�x��"5�"�m�m�B��3�"5�6�	6r*c	��|jj|jj|dd|g|ji|�����S)a�Queries or sets the size of the row given by
        INDEX. INDEX may be any non-negative
        integer that gives the position of a given row .
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all rows.
        When no option-value pair is given, this command returns a list con-
        taining the current size setting of the given row . When option-value
        pairs are given, the corresponding options of the size setting of the
        given row are changed. Options may be one of the following:
              pad0 pixels
                     Specifies the paddings to the top of a row.
              pad1 pixels
                     Specifies the paddings to the bottom of a row.
              size val
                     Specifies the height of a row.  Val may be:
                     "auto" -- the height of the row is set to the
                     height of the highest cell in the row;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the height of the row to the
                     given number of characters.r�r)r$r�r%r7r�s   r(�size_rowz
Grid.size_rowwsL��,�w�w� � ��������&�%��"H�15���r�2�1F�"H�I�	Ir*c�T�|jj|jd||�y)z7Clears the cell at (x, y) by removing its display item.�unsetNr{r3s   r(r�z
Grid.unset�s�������T�W�W�g�q�!�,r*rQ)rRrSrTrUr\r�r�r�r�r�r�r�r2r5rrr�r�r8r�r�r�r�rVr*r(r�r��st���"#��E�.�B�2�;�>�,�
0�
=�B�L�8�@�=�B�/�6�4I�2-r*r�c��eZdZdZdifd�Zy)�ScrolledGridzScrolled Grid widgetsNc�J�g}||_tj||d|||�y)N�tixScrolledGridr�r�s     r(r\zScrolledGrid.__init__�s'����������4��):�F�C��Lr*r_rVr*r(r�r��s���#��Mr*r�)wr]�warningsr[r�warn�DeprecationWarning�WINDOW�TEXT�STATUS�	IMMEDIATE�IMAGE�	IMAGETEXT�BALLOON�AUTO�	ACROSSTOP�ASCII�CELL�COLUMN�
DECREASING�
INCREASING�INTEGER�MAIN�MAX�REAL�ROW�S_REGION�X_REGION�Y_REGION�
TCL_DONT_WAIT�TCL_WINDOW_EVENTS�TCL_FILE_EVENTS�TCL_TIMER_EVENTS�TCL_IDLE_EVENTS�TCL_ALL_EVENTSrrXrmr��	__bases__r�r�r�r�rrr2rArSrXrarqr�r�r�r��XView�YViewr�rSrWr]rcrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr
r9rT�Buttonr�Checkbuttonrj�Entryr �Framera�Labelr��Listboxr��Menur��
Menubuttonr��	ScrollbarrI�Textr�r!rHrir�rkr]rur�r�r^r�r�rhr�r�r�r�r�rVr*r(�<module>rs���4
�����
��
�
�-���	�
��
��	���	����	�
��
���	�	��
��	��
�
�
�
�
��
����
�����������
�����������~N�~N�@!����Z�!�.)7�)7�Z#�>�>�3�3�t�g�=�����G����G�X3-�9�3-�p(?�(?�^3�i�3�62�	�2�&*-�y�*-�X(�i�(�B,�i�,�*,�i�,�,K�9�K�&(�i�(�D)�i�)�0)��)�((�I�(�8)�y�)�*
�	�
�2@=�I�u�e�@=�DH�	�H�B��B� B��B�$!-�9�!-�F1�I�1�&/�y�&/�P	�I�	�.��.�8'2�)�'2�R7�	�7�41�9�1�0	B�I�	B�B�i�B�B�9�B�	B�I�	B�B�Y�B�.�Y�.�,T�I�T�(�)�(�2
2�9�
2�Q?�I�u�e�Q?�f*:�9�*:�\.<�	�.<�lF�6�<�F�F��\�F�F�%��F�F�%��F�F�%��F�F�G�\�F�F��|�F�F�z�<�F�F�i��F�F��|�F�B�O�\�B�F�%��F�B�-��B�F�%��F��X�|��"B�G�\�B�K��|�K�
R�O�\�
R�M�-��M�G��<�G�
A��|�A�F�-��F�F��\�F�6�
�	�y�	�f-�9�e�U�f-�RM�4�Mr*__pycache__/ttk.cpython-312.pyc000064400000217617151710635150012303 0ustar00�

T��h����"�dZdZdZgd�ZddlZddlmZmZmZmZdBd�Z	dCd�Z
d	�ZdBd
�ZdBd�Z
dDd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdEd�ZGd�de�ZGd�dej4�ZGd�de�ZGd�de�ZGd�deej:�ZGd �d!e�ZGd"�d#e�ZGd$�d%e�Z Gd&�d'e�Z!e!Z"Gd(�d)e�Z#Gd*�d+e�Z$Gd,�d-eejJ�Z&e&Z%Gd.�d/e�Z'Gd0�d1e�Z(Gd2�d3eejR�Z)Gd4�d5eejT�Z*Gd6�d7e�Z+Gd8�d9e�Z,Gd:�d;e�Z-Gd<�d=eej\ej^�Z0Gd>�d?e�Z1Gd@�dAe#�Z2y)Fa�Ttk wrapper.

This module provides classes to allow using Tk themed widget set.

Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.

Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
appearance. Widget class bindings are primarily responsible for
maintaining the widget state and invoking callbacks, all aspects
of the widgets appearance lies at Themes.
z0.3.1z!Guilherme Polo <ggpolo@gmail.com>)�Button�Checkbutton�Combobox�Entry�Frame�Label�
Labelframe�
LabelFrame�
Menubutton�Notebook�Panedwindow�PanedWindow�Progressbar�Radiobutton�Scale�	Scrollbar�	Separator�Sizegrip�Spinbox�Style�Treeview�LabeledScale�
OptionMenu�
tclobjs_to_py�setup_master�N)�_flatten�_join�
_stringify�
_splitdictc�f�|r
t|�}|St|ttf�rt	|�}|S)zInternal function.)r�
isinstance�list�tupler)�value�scripts  �$/usr/lib64/python3.12/tkinter/ttk.py�_format_optvaluer' s6��
��5�!���L�
�E�D�%�=�	)��e����L�c��g}|j�D]>\}}|r||vs�
|jd|z�|��$|jt||���@t|�S)z�Formats optdict to a tuple to pass it to tk.call.

    E.g. (script=False):
      {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
      ('-foreground', 'blue', '-padding', '1 2 3 4')�-%s)�items�appendr'r)�optdictr%�ignore�opts�optr$s      r&�_format_optdictr1*s]���D��m�m�o�
��U���F�*��K�K����$�� ����,�U�F�;�<�	&��D�>�r(c��g}|D]S�^}}t|�dk(r
|dxsd}ndj|�}|j|�|��C|j|��U|S)N�r�� )�len�joinr,)r+�opt_val�state�vals    r&�_mapdict_valuesr;:sd���G������u�:��?��!�H�N��E��H�H�U�O�E����u���?��N�N�3����Nr(c	��g}|j�D].\}}|jd|ztt|�|�f��0t	|�S)z�Formats mapdict to pass it to tk.call.

    E.g. (script=False):
      {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]}

      returns:

      ('-expand', '{active selected} grey focus {1, 2, 3, 4}')r*)r+�extendr'r;r)�mapdictr%r/r0r$s     r&�_format_mapdictr?OsQ���D��m�m�o�
��U����U�S�[�%�o�e�&<�f�E�G�	H�&��D�>�r(c�X�d}d}|dvr_|dk(r$|d}tt|dd��}|�d|��}n)|dd\}}	tt|dd��}
|�d|	�d|
��}t||�}n(|d	k(r#|d}t|�dkDrt	|d|�f}|rd
|z}dj|�}||fS)zAFormats args and kw according to the given element factory etype.N�)�image�vsapirBrr3r5��fromz{%s})rr;r1r6r'r7)�etyper%�args�kw�specr/�iname�	imagespec�
class_name�part_id�statemaps           r&�_format_elemcreaterO`s����D�
�D��"�"��G����G�E��o�d�1�2�h�7�8�I�#�Y�/�D�#'�r��(��J���_�T�!�"�X�6�7�H�!+�W�h�?�D��r�6�*��	�&���A�w���t�9�q�=�$�T�!�W�f�5�7�D�
���}���x�x��~����:�r(c��g}|D]�}|\}}|xsi}djt|dd��}d|z�|�|rd|znd��}d|vrZ|j|dz�||z
}t|d||�\}	}|j|	�||z}|jdd|zz���|j|���d	j|�|fS)
a$Formats a layout list so we can pass the result to ttk::style
    layout and ttk::style settings. Note that the layout doesn't have to
    be a list necessarily.

    E.g.:
      [("Menubutton.background", None),
       ("Menubutton.button", {"children":
           [("Menubutton.focus", {"children":
               [("Menubutton.padding", {"children":
                [("Menubutton.label", {"side": "left", "expand": 1})]
               })]
           })]
       }),
       ("Menubutton.indicator", {"side": "right"})
      ]

      returns:

      Menubutton.background
      Menubutton.button -children {
        Menubutton.focus -children {
          Menubutton.padding -children {
            Menubutton.label -side left -expand 1
          }
        }
      }
      Menubutton.indicator -side rightr5T)�childrenz %sr4rQz -children {z%s}�
)r7r1r,�_format_layoutlist)
�layout�indent�indent_sizer%�layout_elem�elemr/�fopts�head�	newscripts
          r&rSrS�s���8�F��� �
��d��z�r�������t�]�C�D����<��%���
�R�/O�P������M�M�$��/�0��k�!�F� 2�4�
�3C�V��!��I�v��M�M�)�$��k�!�F��M�M�%�3��<�0�1��M�M�$���"�9�9�V��f�$�$r(c�<�g}|j�D�]v\}}|jd�r6djt|dd��}|j	d|�d|�d��|jd�r6djt|dd��}|j	d|�d|�d��d|vr1|dsd	}nt
|d�\}}|j	d
|�d|�d��|jd
�s��|d
}|d}d}|t|�kr2t||d�s#|dz
}|t|�krt||d�s�#|d|}	|t|�kr
||r||ni}
t|dg|	��i|
��\}}|j	d|�d|�d|�d|�����ydj|�S)z�Returns an appropriate script, based on settings, according to
    theme_settings definition to be used by theme_settings and
    theme_create.�	configurer5Tzttk::style configure �;�mapzttk::style map rT�nullzttk::style layout z {
z
}zelement createrr3r+zttk::style element create rR)
r+�getr7r1r,r?rSr6�hasattrrO)�settingsr%�namer/�s�_�eoptsrF�argc�elemargs�elemkwrIs            r&�_script_from_settingsrk�s����F��n�n�&�
��d��8�8�K� ������k�):�D�A�B�A��M�M�4��C�D��8�8�E�?������e��d�;�<�A��M�M�T�1�=�>��t����>���)�$�x�.�9���1��M�M�T�1�E�F��8�8�$�%��)�*�E��!�H�E��D���U��#�G�E�$�K��,I���	����U��#�G�E�$�K��,I��Q�t�}�H�$(�3�u�:�$5�%��+�U�4�[�2�F�+�E�4�M�(�M�f�M�J�D�$��M�M��e�T�4�)�
*�='�B�9�9�V��r(c��t|t�r|Sg}t|�}t||�D]�\}}t	|d�rt|�j�}n:t|t�r|j�}nt|ttf�s|f}t	|d�rt|�}|jg|�|�����|S)ztConstruct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict.�typename)	r!�str�iter�ziprb�splitr#r"r,)�stuple�result�itr9r:s     r&�_list_from_statespecru�s����&�#���
�
�F�	
�f��B��"�b�k�
��s��5�*�%���J�$�$�&�E�
��s�
#��K�K�M�E��E�E�4�=�1��H�E��3�
�#��c�(�C��
�
�m��m�s�m�$�"��Mr(c�\�|j|�}g}d}|t|�kr�||}i}|j||f�|dz
}|t|�krL|||dz\}}|jd�sn/|dd}|dz
}|dk(rt	||�}|||<|t|�kr�L|t|�kr��|S)zpConstruct a list from the tuple returned by ttk::layout, this is
    somewhat the reverse of _format_layoutlist.rr3rD�-NrQ)�	splitlistr6r,�
startswith�_list_from_layouttuple)�tk�ltuple�res�indxrdr/r0r:s        r&rzrz�s����\�\�&�
!�F�
�C��D�
��V��
��d�|�����
�
�D�$�<� ���	���S��[� ��d�4�!�8�,�H�C���>�>�#�&���a�b�'�C��A�I�D��j� �,�R��5���D��I��S��[� �
��V��
�&�Jr(c��t|�}|j||z�}t|�dzr|St||t��S)ahFormat options then call Tk command with args and options and return
    the appropriate result.

    If no option is specified, a dict is returned. If an option is
    specified with the None value, the value for that option is returned.
    Otherwise, the function just sets the passed options and the caller
    shouldn't be expecting a return value anyway.rD)�conv)r1�callr6r�
_tclobj_to_py)r{�optionsrGr}s    r&�_val_or_dictr�sB���g�&�G�
�"�'�'�D�7�N�
$�C�
�7�|�a���
��b�#�M�2�2r(c�`�t|�}	t|�}|S#ttf$rY|SwxYw)zAConverts a value to, hopefully, a more appropriate Python object.)rn�int�
ValueError�	TypeError)r$s r&�_convert_stringvalr� s>����J�E�
��E�
���L��
�	�"�
���L�
�s��-�-c�^�t|t�rd|vr
t|�}|St|�}|S)N�.)r!rn�floatr�)�xs r&�
_to_numberr�*s3���!�S���!�8��a��A�
�H��A��A��Hr(c���|rWt|d�rKt|t�s;t|ddd�dk(r
t	|�}|Stt
t|��}|St|d�rt|�}|S)z8Return value converted from Tcl object to Python object.�__len__rrmN�	StateSpec)rbr!rn�getattrrur"r_r�)r:s r&r�r�2ss��
�w�s�I�&�z�#�s�/C��3�q�6�:�t�,��;�&�s�+�C��J��s�-�s�3�4�C�
�J�
��j�	!� ��%���Jr(c�R�|j�D]\}}t|�||<�|S)zOReturns adict with its values converted from Tcl objects to Python
    objects.)r+r�)�adictr0r:s   r&rr?s-���K�K�M���S�"�3�'��c�
�"��Lr(c�2�|�tj�}|S)aIf master is not None, itself is returned. If master is None,
    the default master is returned if there is one, otherwise a new
    master is created and returned.

    If it is not allowed to use the default root and master is None,
    RuntimeError is raised.)�tkinter�_get_default_root)�masters r&rrGs���~��*�*�,���Mr(c�j�eZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zdd�Z
d
�Zd�Zdd�Zy)rzManipulate style database.z
ttk::styleNc�^�t|�}||_|jj|_y�N)rr�r{)�selfr�s  r&�__init__zStyle.__init__Xs"���f�%������+�+�.�.��r(c�d�|�d||<t|j||jd|�}|s|r|Sy)z�Query or sets the default value of the specified option(s) in
        style.

        Each key in kw is an option and each value is either a string or
        a sequence identifying the value for that option.Nr])r�r{�_name)r��style�	query_optrHrss     r&r]zStyle.configure^s<��� � �B�y�M��d�g�g�r�4�:�:�{�E�J���Y��M�r(c
���|�O|jj|jd|d|z�}t|jj	|��S|jj|jd|gt|����}t
|j|�j�D��cic]*\}}|t|jj	|����,c}}Scc}}w)aSQuery or sets dynamic values of the specified option(s) in
        style.

        Each key in kw is an option and each value should be a list or a
        tuple (usually) containing statespecs grouped in tuples, or list,
        or something else of your preference. A statespec is compound of
        one or more states and then a value.r_r*)r{r�r�rurxr?rr+)r�r�r�rHrs�k�vs       r&r_z	Style.mapks���� ��W�W�\�\�$�*�*�e�U�E�I�<M�N�F�'����(9�(9�&�(A�B�B�������d�j�j�%��M���9L�M��&�t�w�w��7�=�=�?�A�?�D�A�q��'����(9�(9�!�(<�=�=�?�A�	A��As�+/Cc��|rdj|�nd}|jj|jd|d|z||�S)aReturns the value specified for option in style.

        If state is specified it is expected to be a sequence of one
        or more states. If the default argument is set, it is used as
        a fallback value in case no specification for option is found.r5r4�lookupr*)r7r{r�r�)r�r��optionr9�defaults     r&r�zStyle.lookup|s?��$)������b���w�w�|�|�D�J�J��%�����7��	r(c	��d}|rt|�d}n|�d}t|j|jj|jd||��S)a�Define the widget layout for given style. If layoutspec is
        omitted, return the layout specification for given style.

        layoutspec is expected to be a list or an object different than
        None that evaluates to False if you want to "turn off" that style.
        If it is a list (or tuple, or something else), each item should be
        a tuple where the first item is the layout name and the second item
        should have the format described below:

        LAYOUTS

            A layout can contain the value None, if takes no options, or
            a dict of options specifying how to arrange the element.
            The layout mechanism uses a simplified version of the pack
            geometry manager: given an initial cavity, each element is
            allocated a parcel. Valid options/values are:

                side: whichside
                    Specifies which side of the cavity to place the
                    element; one of top, right, bottom or left. If
                    omitted, the element occupies the entire cavity.

                sticky: nswe
                    Specifies where the element is placed inside its
                    allocated parcel.

                children: [sublayout... ]
                    Specifies a list of elements to place inside the
                    element. Each element is a tuple (or other sequence)
                    where the first item is the layout name, and the other
                    is a LAYOUT.Nrr`rT)rSrzr{r�r�)r�r��
layoutspec�lspecs    r&rTzStyle.layout�sV��@���&�z�2�1�5�E�
�
#��E�&�d�g�g��G�G�L�L����X�u�e�<�>�	>r(c��t|dg|��i|��\}}|jj|jdd|||g|���y)z9Create a new element in the current theme of given etype.F�element�createN)rOr{r�r�)r��elementnamerFrGrHrIr/s       r&�element_createzStyle.element_create�sG��'��u�B�t�B�r�B�
��d�������T�Z�Z��H�k�5��	��	r(c
��td�|jj|jj|jdd��D��S)z:Returns the list of elements defined in the current theme.c3�>K�|]}|jd����y�w�rwN��lstrip)�.0�ns  r&�	<genexpr>z&Style.element_names.<locals>.<genexpr>�s!����;�-:�q�Q�X�X�c�]�-:���r��names�r#r{rxr�r��r�s r&�
element_nameszStyle.element_names�sB���;�D�G�G�,=�,=��G�G�L�L����Y��8�-:�;�;�	;r(c��td�|jj|jj|jdd|��D��S)z)Return the list of elementname's options.c3�>K�|]}|jd����y�wr�r�)r��os  r&r�z(Style.element_options.<locals>.<genexpr>�s$����J�-I�q�Q�X�X�c�]�-I�r�r�r�r�)r�r�s  r&�element_optionszStyle.element_options�sI���J�D�G�G�,=�,=��G�G�L�L����Y�	�;�G�-I�J�J�	Jr(c
���|rt|�nd}|r-|jj|jdd|d|d|�y|jj|jdd|d|�y)a.Creates a new theme.

        It is an error if themename already exists. If parent is
        specified, the new theme will inherit styles, elements and
        layouts from the specified parent theme. If settings are present,
        they are expected to have the same syntax used for theme_settings.r4�themer�z-parentz	-settingsN�rkr{r�r�)r��	themename�parentrcr%s     r&�theme_createzStyle.theme_create�s^��5=�&�x�0�"����G�G�L�L����W�h�	��6�;��
8�
�G�G�L�L����W�h�	��V�
%r(c�l�t|�}|jj|jdd||�y)a�Temporarily sets the current theme to themename, apply specified
        settings and then restore the previous theme.

        Each key in settings is a style and each value may contain the
        keys 'configure', 'map', 'layout' and 'element create' and they
        are expected to have the same format as specified by the methods
        configure, map, layout and element_create respectively.r�rcNr�)r�r�rcr%s    r&�theme_settingszStyle.theme_settings�s*��'�x�0�������T�Z�Z��*�i��Hr(c��|jj|jj|jdd��S)z#Returns a list of all known themes.r�r�)r{rxr�r�r�s r&�theme_nameszStyle.theme_names�s,���w�w� � ������d�j�j�'�7�!K�L�Lr(c�v�|�|jjd�S|jjd|�y)z�If themename is None, returns the theme in use, otherwise, set
        the current theme to themename, refreshes all widgets and emits
        a <<ThemeChanged>> event.Nzreturn $ttk::currentThemez
ttk::setTheme)r{�evalr�)r�r�s  r&�	theme_usezStyle.theme_use�s4�����7�7�<�<� ;�<�<�
	
�����_�i�0r(r��NN)�__name__�
__module__�__qualname__�__doc__r�r�r]r_r�rTr�r�r�r�r�r�r�rAr(r&rrSsK��$��E�!�
�A�"	�(>�V�;�J�%�"	I�M�
1r(rc�.�eZdZdZdd�Zd�Zdd�Zdd�Zy)�Widgetz!Base class for Tk themed widgets.Nc�`�t|�}tjj||||��y)a�Constructs a Ttk Widget with the parent master.

        STANDARD OPTIONS

            class, cursor, takefocus, style

        SCROLLABLE WIDGET OPTIONS

            xscrollcommand, yscrollcommand

        LABEL WIDGET OPTIONS

            text, textvariable, underline, image, compound, width

        WIDGET STATES

            active, disabled, focus, pressed, selected, background,
            readonly, alternate, invalid
        )rHN)rr�r�r�)r�r��
widgetnamerHs    r&r�zWidget.__init__�s)��(�f�%��������f�j�R��@r(c�R�|jj|jd||�S)z�Returns the name of the element at position x, y, or the empty
        string if the point does not lie within any element.

        x and y are pixel coordinates relative to the widget.�identify�r{r��_w�r�r��ys   r&r�zWidget.identifys!��
�w�w�|�|�D�G�G�Z��A�6�6r(c	��|jj|jj|jddj	|���}|r
|�||i|��S|S)a1Test the widget's state.

        If callback is not specified, returns True if the widget state
        matches statespec and False otherwise. If callback is specified,
        then it will be invoked with *args, **kw if the widget state
        matches statespec. statespec is expected to be a sequence.�instater5)r{�
getbooleanr�r�r7)r��	statespec�callbackrGrH�rets      r&r�zWidget.instatesW���g�g� � ������T�W�W�i����)�1D�E�G���8�'��T�(�R�(�(��
r(c	��|�dj|�}|jjt|jj	|j
d|���S)aModify or inquire widget state.

        Widget state is returned if statespec is None, otherwise it is
        set according to the statespec flags and then a new state spec
        is returned indicating which flags were changed. statespec is
        expected to be a sequence.r5r9)r7r{rxrnr�r�)r�r�s  r&r9zWidget.state)sG��� �����+�I��w�w� � ��T�W�W�\�\�$�'�'�7�I�%N�!O�P�Pr(r�)r�r�r�r�r�r�r�r9rAr(r&r�r��s��+�A�07��
Qr(r�c��eZdZdZdd�Zd�Zy)rzcTtk Button widget, displays a textual label and/or image, and
    evaluates a command when pressed.Nc�4�tj||d|�y)aConstruct a Ttk Button widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, default, width
        zttk::buttonN�r�r��r�r�rHs   r&r�zButton.__init__:s��	����f�m�R�8r(c�N�|jj|jd�S)z/Invokes the command associated with the button.�invoker�r�s r&r�z
Button.invokeIs���w�w�|�|�D�G�G�X�.�.r(r��r�r�r�r�r�r�rAr(r&rr6s��)�9�/r(rc��eZdZdZdd�Zd�Zy)rz;Ttk Checkbutton widget which is either in on- or off-state.Nc�4�tj||d|�y)a'Construct a Ttk Checkbutton widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, offvalue, onvalue, variable
        zttk::checkbuttonNr�r�s   r&r�zCheckbutton.__init__Q���	����f�&8�"�=r(c�N�|jj|jd�S)aWToggles between the selected and deselected states and
        invokes the associated command. If the widget is currently
        selected, sets the option variable to the offvalue option
        and deselects the widget; otherwise, sets the option variable
        to the option onvalue.

        Returns the result of the associated command.r�r�r�s r&r�zCheckbutton.invoke`s���w�w�|�|�D�G�G�X�.�.r(r�r�rAr(r&rrNs��E�>�/r(rc�*�eZdZdZdd�Zd�Zd�Zd�Zy)rzeTtk Entry widget displays a one-line text string and allows that
    string to be edited by the user.Nc�<�tj|||xsd|�y)a�Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        z
ttk::entryNr�)r�r��widgetrHs    r&r�zEntry.__init__os�� 	����f�f�&<��b�Ar(c�n�|j|jj|jd|��S)zqReturn a tuple of (x, y, width, height) which describes the
        bounding box of the character given by index.�bbox��_getintsr{r�r�)r��indexs  r&r�z
Entry.bbox�s(���}�}�T�W�W�\�\�$�'�'�6�5�A�B�Br(c�R�|jj|jd||�S)zxReturns the name of the element at position x, y, or the
        empty string if the coordinates are outside the window.r�r�r�s   r&r�zEntry.identify��!���w�w�|�|�D�G�G�Z��A�6�6r(c��|jj|jj|jd��S)z�Force revalidation, independent of the conditions specified
        by the validate option. Returns False if validation fails, True
        if it succeeds. Sets or clears the invalid state accordingly.�validate�r{r�r�r�r�s r&r�zEntry.validate�s,���w�w�!�!�$�'�'�,�,�t�w�w�
�"C�D�Dr(r�)r�r�r�r�r�r�r�r�rAr(r&rrks��(�B�&C�7�Er(rc�&�eZdZdZdd�Zdd�Zd�Zy)rzMTtk Combobox widget combines a text field with a pop-down list of
    values.Nc�4�tj||dfi|��y)aConstruct a Ttk Combobox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            exportselection, justify, height, postcommand, state,
            textvariable, values, width
        z
ttk::comboboxN�rr�r�s   r&r�zCombobox.__init__�s��	���t�V�_�;��;r(c���|�G|jj|jd�}|dk(ry|jj|�S|jj|jd|�S)aIf newindex is supplied, sets the combobox value to the
        element at position newindex in the list of values. Otherwise,
        returns the index of the current value in the list of values
        or -1 if the current value does not appear in the list.�currentr4���)r{r�r��getint)r��newindexr}s   r&rzCombobox.current�sZ��
���'�'�,�,�t�w�w�	�2�C��b�y���7�7�>�>�#�&�&��w�w�|�|�D�G�G�Y��9�9r(c�R�|jj|jd|�y)z(Sets the value of the combobox to value.�setNr��r�r$s  r&rzCombobox.set���������T�W�W�e�U�+r(r�)r�r�r�r�r�rrrAr(r&rr�s���<�
:�,r(rc��eZdZdZdd�Zy)rzJTtk Frame widget is a container, used to group other widgets
    together.Nc�4�tj||d|�y)z�Construct a Ttk Frame with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            borderwidth, relief, padding, width, height
        z
ttk::frameNr�r�s   r&r�zFrame.__init__����	����f�l�B�7r(r��r�r�r�r�r�rAr(r&rr�s���8r(rc��eZdZdZdd�Zy)rz7Ttk Label widget displays a textual label and/or image.Nc�4�tj||d|�y)aGConstruct a Ttk Label with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, style, takefocus, text,
            textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            anchor, background, font, foreground, justify, padding,
            relief, text, wraplength
        z
ttk::labelNr�r�s   r&r�zLabel.__init__�s��	����f�l�B�7r(r�rrAr(r&rr�s
��A�
8r(rc��eZdZdZdd�Zy)rz�Ttk Labelframe widget is a container used to group other widgets
    together. It has an optional label, which may be a plain text string
    or another widget.Nc�4�tj||d|�y)z�Construct a Ttk Labelframe with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS
            labelanchor, text, underline, padding, labelwidget, width,
            height
        zttk::labelframeNr�r�s   r&r�zLabelframe.__init__�s��	����f�&7��<r(r�rrAr(r&rr�s���=r(rc��eZdZdZdd�Zy)r
zbTtk Menubutton widget displays a textual label and/or image, and
    displays a menu when pressed.Nc�4�tj||d|�y)aConstruct a Ttk Menubutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            direction, menu
        zttk::menubuttonNr�r�s   r&r�zMenubutton.__init__�s��	����f�&7��<r(r�rrAr(r&r
r
�s��%�=r(r
c�X�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
dd
�Zdd�Zd�Z
d
�Zy)rz�Ttk Notebook widget manages a collection of windows and displays
    a single one at a time. Each child window is associated with a tab,
    which the user may select to change the currently-displayed window.Nc�4�tj||d|�y)a\Construct a Ttk Notebook with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            height, padding, width

        TAB OPTIONS

            state, sticky, padding, text, image, compound, underline

        TAB IDENTIFIERS (tab_id)

            The tab_id argument found in several methods may take any of
            the following forms:

                * An integer between zero and the number of tabs
                * The name of a child window
                * A positional specification of the form "@x,y", which
                  defines the tab
                * The string "current", which identifies the
                  currently-selected tab
                * The string "end", which returns the number of tabs (only
                  valid for method index)
        z
ttk::notebookNr�r�s   r&r�zNotebook.__init__s��:	����f�o�r�:r(c�h�|jj|jd|gt|����y)z�Adds a new tab to the notebook.

        If window is currently managed by the notebook but hidden, it is
        restored to its previous position.�addN�r{r�r�r1)r��childrHs   r&rzNotebook.add,s(��
	������T�W�W�e�U�C�o�b�.A�Cr(c�R�|jj|jd|�y)zXRemoves the tab specified by tab_id, unmaps and unmanages the
        associated window.�forgetNr��r��tab_ids  r&rzNotebook.forget4s��	
�����T�W�W�h��/r(c�R�|jj|jd|�y)z�Hides the tab specified by tab_id.

        The tab will not be displayed, but the associated window remains
        managed by the notebook and its configuration remembered. Hidden
        tabs may be restored with the add command.�hideNr�rs  r&rz
Notebook.hide:s��	
�����T�W�W�f�f�-r(c�R�|jj|jd||�S)zZReturns the name of the tab element at position x, y, or the
        empty string if none.r�r�r�s   r&r�zNotebook.identifyCr�r(c��|jj|jj|jd|��S)z|Returns the numeric index of the tab specified by tab_id, or
        the total number of tabs if tab_id is the string "end".r��r{rr�r�rs  r&r�zNotebook.indexIs,���w�w�~�~�d�g�g�l�l�4�7�7�G�V�D�E�Er(c�j�|jj|jd||gt|����y)z�Inserts a pane at the specified position.

        pos is either the string end, an integer index, or the name of
        a managed child. If child is already managed by the notebook,
        moves it to the specified position.�insertNr�r��posrrHs    r&r#zNotebook.insertO�*��	������T�W�W�h��U�K�o�b�6I�Kr(c�P�|jj|jd|�S)z�Selects the specified tab.

        The associated child window will be displayed, and the
        previously-selected window (if different) is unmapped. If tab_id
        is omitted, returns the widget name of the currently selected
        pane.�selectr�rs  r&r(zNotebook.selectXs���w�w�|�|�D�G�G�X�v�6�6r(c�V�|�d||<t|j||jd|�S)z�Query or modify the options of the specific tab_id.

        If kw is not given, returns a dict of the tab option values. If option
        is specified, returns the value of that option. Otherwise, sets the
        options to the corresponding values.N�tab�r�r{r�)r�rr�rHs    r&r*zNotebook.tabbs.�����B�v�J��D�G�G�R����%��@�@r(c��|jj|jj|jd�xsd�S)z2Returns a list of windows managed by the notebook.�tabsrA�r{rxr�r�r�s r&r-z
Notebook.tabsms/���w�w� � ������d�g�g�v�!>�!D�"�E�Er(c�P�|jjd|j�y)a�Enable keyboard traversal for a toplevel window containing
        this notebook.

        This will extend the bindings for the toplevel window containing
        this notebook as follows:

            Control-Tab: selects the tab following the currently selected
                         one

            Shift-Control-Tab: selects the tab preceding the currently
                               selected one

            Alt-K: where K is the mnemonic (underlined) character of any
                   tab, will select that tab.

        Multiple notebooks in a single toplevel may be enabled for
        traversal, including nested notebooks. However, notebook traversal
        only works properly if all panes are direct children of the
        notebook.zttk::notebook::enableTraversalNr�r�s r&�enable_traversalzNotebook.enable_traversalrs��.	
�����5�t�w�w�?r(r�)r�r�r�r�r�rrrr�r�r#r(r*r-r0rAr(r&rrsF��K�;�@D�0�.�7�F�L�7�A�F�
@r(rc�Z�eZdZdZdd�ZejjZd�Zdd�Z	dd�Z
y)rzfTtk Panedwindow widget displays a number of subwindows, stacked
    either vertically or horizontally.Nc�4�tj||d|�y)z�Construct a Ttk Panedwindow with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, width, height

        PANE OPTIONS

            weight
        zttk::panedwindowNr�r�s   r&r�zPanedwindow.__init__�s��	����f�&8�"�=r(c�j�|jj|jd||gt|����y)z�Inserts a pane at the specified positions.

        pos is either the string end, and integer index, or the name
        of a child. If child is already managed by the paned window,
        moves it to the specified position.r#Nrr$s    r&r#zPanedwindow.insert�r&r(c�V�|�d||<t|j||jd|�S)aQQuery or modify the options of the specified pane.

        pane is either an integer index or the name of a managed subwindow.
        If kw is not given, returns a dict of the pane option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.N�paner+)r�r5r�rHs    r&r5zPanedwindow.pane��.�����B�v�J��D�G�G�R����&�$�?�?r(c��|jj|jj|jd||��S)aLIf newpos is specified, sets the position of sash number index.

        May adjust the positions of adjacent sashes to ensure that
        positions are monotonically increasing. Sash positions are further
        constrained to be between 0 and the total size of the widget.

        Returns the new position of sash number index.�sashposr!)r�r��newposs   r&r8zPanedwindow.sashpos�s.���w�w�~�~�d�g�g�l�l�4�7�7�I�u�f�M�N�Nr(r�)r�r�r�r�r�r�r
rr#r5r8rAr(r&rr�s1��*�>�$�
 �
 �
'�
'�F�L�	@�Or(rc�.�eZdZdZdd�Zdd�Zdd�Zd�Zy)ra6Ttk Progressbar widget shows the status of a long-running
    operation. They can operate in two modes: determinate mode shows the
    amount completed relative to the total amount of work to be done, and
    indeterminate mode provides an animated display to let the user know
    that something is happening.Nc�4�tj||d|�y)z�Construct a Ttk Progressbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, length, mode, maximum, value, variable, phase
        zttk::progressbarNr�r�s   r&r�zProgressbar.__init__�s��	����f�&8�"�=r(c�R�|jj|jd|�y)z�Begin autoincrement mode: schedules a recurring timer event
        that calls method step every interval milliseconds.

        interval defaults to 50 milliseconds (20 steps/second) if omitted.�startNr�)r��intervals  r&r=zProgressbar.start�s��
	
�����T�W�W�g�x�0r(c�R�|jj|jd|�y)zRIncrements the value option by amount.

        amount defaults to 1.0 if omitted.�stepNr�)r��amounts  r&r@zProgressbar.step�s��	
�����T�W�W�f�f�-r(c�P�|jj|jd�y)zVStop autoincrement mode: cancels any recurring timer event
        initiated by start.�stopNr�r�s r&rCzProgressbar.stop�s��	
�����T�W�W�f�%r(r�)r�r�r�r�r�r=r@rCrAr(r&rr�s��$�>�1�.�&r(rc��eZdZdZdd�Zd�Zy)rzeTtk Radiobutton widgets are used in groups to show or change a
    set of mutually-exclusive options.Nc�4�tj||d|�y)aConstruct a Ttk Radiobutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, value, variable
        zttk::radiobuttonNr�r�s   r&r�zRadiobutton.__init__�r�r(c�N�|jj|jd�S)z�Sets the option variable to the option value, selects the
        widget, and invokes the associated command.

        Returns the result of the command, or an empty string if
        no command is specified.r�r�r�s r&r�zRadiobutton.invokes���w�w�|�|�D�G�G�X�.�.r(r�r�rAr(r&rr�s��*�>�/r(rc�(�eZdZdZdd�Zdd�Zdd�Zy)rzTtk Scale widget is typically used to control the numeric value of
    a linked variable that varies uniformly over some range.Nc�4�tj||d|�y)z�Construct a Ttk Scale with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, from, length, orient, to, value, variable
        z
ttk::scaleNr�r�s   r&r�zScale.__init__rr(c���tj||fi|��}t|td�tf�s|j|�t
d|vd|vd|vg�r|jd�|S)z�Modify or query scale options.

        Setting a value for any of the "from", "from_" or "to" options
        generates a <<RangeChanged>> event.NrE�from_�to�<<RangeChanged>>)r�r]r!�typern�update�any�event_generate)r��cnfrH�retvals    r&r]zScale.configuresh��
�!�!�$��2�r�2���#��T�
�C�0�1��I�I�c�N���"��g��m�T�R�Z�8�9���� 2�3��
r(c�R�|jj|jd||�S)z�Get the current value of the value option, or the value
        corresponding to the coordinates x, y if they are specified.

        x and y are pixel coordinates relative to the scale widget
        origin.rar�r�s   r&raz	Scale.get,s!���w�w�|�|�D�G�G�U�A�q�1�1r(r�r�)r�r�r�r�r�r]rarAr(r&rr
s��@�8�
�2r(rc��eZdZdZdd�Zy)rz;Ttk Scrollbar controls the viewport of a scrollable widget.Nc�4�tj||d|�y)z�Construct a Ttk Scrollbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, orient
        zttk::scrollbarNr�r�s   r&r�zScrollbar.__init__8���	����f�&6��;r(r�rrAr(r&rr5s
��E�<r(rc��eZdZdZdd�Zy)rzITtk Separator widget displays a horizontal or vertical separator
    bar.Nc�4�tj||d|�y)z�Construct a Ttk Separator with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient
        zttk::separatorNr�r�s   r&r�zSeparator.__init__JrVr(r�rrAr(r&rrFs���<r(rc��eZdZdZdd�Zy)rzlTtk Sizegrip allows the user to resize the containing toplevel
    window by pressing and dragging the grip.Nc�4�tj||d|�y)z�Construct a Ttk Sizegrip with parent master.

        STANDARD OPTIONS

            class, cursor, state, style, takefocus
        z
ttk::sizegripNr�r�s   r&r�zSizegrip.__init__\s��	����f�o�r�:r(r�rrAr(r&rrXs��1�;r(rc��eZdZdZdd�Zd�Zy)rz�Ttk Spinbox is an Entry with increment and decrement arrows

    It is commonly used for number entry or to select from a list of
    string values.
    Nc�4�tj||dfi|��y)a/Construct a Ttk Spinbox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, validate,
            validatecommand, xscrollcommand, invalidcommand

        WIDGET-SPECIFIC OPTIONS

            to, from_, increment, values, wrap, format, command
        zttk::spinboxNr�r�s   r&r�zSpinbox.__init__ms��	���t�V�^�:�r�:r(c�R�|jj|jd|�y)z'Sets the value of the Spinbox to value.rNr�rs  r&rzSpinbox.set|rr(r�)r�r�r�r�r�rrAr(r&rrfs���;�,r(rc���eZdZdZd$d�Zd$d�Zd$d�Zd�Zd$d�Zd�Z	d	�Z
d
�Zd$d�Zd$d�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd$d�Zd$d�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d%d �Z"d%d!�Z#d$d"�Z$d$d#�Z%y)&rz�Ttk Treeview widget displays a hierarchical collection of items.

    Each item has a textual label, an optional image, and an optional list
    of data values. The data values are displayed in successive columns
    after the tree label.Nc�4�tj||d|�y)a�Construct a Ttk Treeview with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand,
            yscrollcommand

        WIDGET-SPECIFIC OPTIONS

            columns, displaycolumns, height, padding, selectmode, show

        ITEM OPTIONS

            text, image, values, open, tags

        TAG OPTIONS

            foreground, background, font, image
        z
ttk::treeviewNr�r�s   r&r�zTreeview.__init__�s��(	����f�o�r�:r(c�x�|j|jj|jd||��xsdS)aTReturns the bounding box (relative to the treeview widget's
        window) of the specified item in the form x y width height.

        If column is specified, returns the bounding box of that cell.
        If the item is not visible (i.e., if it is a descendant of a
        closed item or is scrolled offscreen), returns an empty string.r�r4r�)r��item�columns   r&r�z
Treeview.bbox�s/���}�}�T�W�W�\�\�$�'�'�6�4��H�I�O�R�Or(c��|jj|jj|jd|xsd�xsd�S)zhReturns a tuple of children belonging to item.

        If item is not specified, returns root children.rQr4rAr.�r�ras  r&�get_childrenzTreeview.get_children�s>���w�w� � ������T�W�W�j�$�*�"�=�C��E�	Er(c�T�|jj|jd||�y)z�Replaces item's child with newchildren.

        Children present in item that are not present in newchildren
        are detached from tree. No items in newchildren may be an
        ancestor of item.rQNr�)r�ra�newchildrens   r&�set_childrenzTreeview.set_children�s��	
�����T�W�W�j�$��<r(c�V�|�d||<t|j||jd|�S)a
Query or modify the options for the specified column.

        If kw is not given, returns a dict of the column option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.Nrbr+)r�rbr�rHs    r&rbzTreeview.column�s.�����B�v�J��D�G�G�R����(�F�C�Cr(c�R�|jj|jd|�y)z_Delete all specified items and all their descendants. The root
        item may not be deleted.�deleteNr��r�r+s  r&rkzTreeview.delete�s��	
�����T�W�W�h��.r(c�R�|jj|jd|�y)z�Unlinks all of the specified items from the tree.

        The items and all of their descendants are still present, and may
        be reinserted at another point in the tree, but will not be
        displayed. The root item may not be detached.�detachNr�rls  r&rnzTreeview.detach�s��	
�����T�W�W�h��.r(c��|jj|jj|jd|��S)zSReturns True if the specified item is present in the tree,
        False otherwise.�existsr�rds  r&rpzTreeview.exists�s.���w�w�!�!�$�'�'�,�,�t�w�w��$�"G�H�Hr(c�P�|jj|jd|�S)z}If item is specified, sets the focus item to item. Otherwise,
        returns the current focus item, or '' if there is none.�focusr�rds  r&rrzTreeview.focus�s���w�w�|�|�D�G�G�W�d�3�3r(c���|jd�}|r9t|t�s)|jj	||j
�|d<|�d||<t
|j||jd|�S)a_Query or modify the heading options for the specified column.

        If kw is not given, returns a dict of the heading option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.

        Valid options/values are:
            text: text
                The text to display in the column heading
            image: image_name
                Specifies an image to display to the right of the column
                heading
            anchor: anchor
                Specifies how the heading text should be aligned. One of
                the standard Tk anchor values
            command: callback
                A callback to be invoked when the heading label is
                pressed.

        To configure the tree column heading, call this with column = "#0" �commandN�heading)	rar!rnr��register�_substituter�r{r�)r�rbr�rH�cmds     r&ruzTreeview.heading�sh��*�f�f�Y����z�#�s�+� �K�K�0�0��d�6F�6F�G�B�y�M����B�v�J��D�G�G�R����)�V�D�Dr(c�T�|jj|jd|||�S)z�Returns a description of the specified component under the
        point given by x and y, or the empty string if no such component
        is present at that position.r�r�)r��	componentr�r�s    r&r�zTreeview.identifys#���w�w�|�|�D�G�G�Z��A�q�A�Ar(c�(�|jdd|�S)z.Returns the item ID of the item at position y.�rowr�r�)r�r�s  r&�identify_rowzTreeview.identify_rows���}�}�U�A�q�)�)r(c�(�|jd|d�S)zaReturns the data column identifier of the cell at position x.

        The tree column has ID #0.rbrr})r�r�s  r&�identify_columnzTreeview.identify_columns���}�}�X�q�!�,�,r(c�(�|jd||�S)z�Returns one of:

        heading: Tree heading area.
        separator: Space between two columns headings;
        tree: The tree area.
        cell: A data cell.

        * Availability: Tk 8.6�regionr}r�s   r&�identify_regionzTreeview.identify_regions���}�}�X�q�!�,�,r(c�(�|jd||�S)zEReturns the element at position x, y.

        * Availability: Tk 8.6r�r}r�s   r&�identify_elementzTreeview.identify_elements���}�}�Y��1�-�-r(c��|jj|jj|jd|��S)zOReturns the integer index of item within its parent's list
        of children.r�r!rds  r&r�zTreeview.index&s,���w�w�~�~�d�g�g�l�l�4�7�7�G�T�B�C�Cr(c���t|�}|�.|jj|jd||d|g|���}|S|jj|jd||g|���}|S)a�Creates a new item and return the item identifier of the newly
        created item.

        parent is the item ID of the parent item, or the empty string
        to create a new top-level item. index is an integer, or the value
        end, specifying where in the list of parent's children to insert
        the new item. If index is less than or equal to zero, the new node
        is inserted at the beginning, if index is greater than or equal to
        the current number of children, it is inserted at the end. If iid
        is specified, it is used as the item identifier, iid must not
        already exist in the tree. Otherwise, a new unique identifier
        is generated.r#z-id)r1r{r�r�)r�r�r��iidrHr/r}s       r&r#zTreeview.insert,sq���r�"���?��$�'�'�,�,�t�w�w��&�%��s�#�!�#�C�
�
��$�'�'�,�,�t�w�w��&�%�G�$�G�C��
r(c�V�|�d||<t|j||jd|�S)a-Query or modify the options for the specified item.

        If no options are given, a dict with options/values for the item
        is returned. If option is specified then the value for that option
        is returned. Otherwise, sets the options to the corresponding
        values as given by kw.Nrar+)r�rar�rHs    r&raz
Treeview.itemCr6r(c�V�|jj|jd|||�y)aRMoves item to position index in parent's list of children.

        It is illegal to move an item under one of its descendants. If
        index is less than or equal to zero, item is moved to the
        beginning, if greater than or equal to the number of children,
        it is moved to the end. If item was detached it is reattached.�moveNr�)r�rar�r�s    r&r�z
Treeview.moveOs ��	
�����T�W�W�f�d�F�E�:r(c�P�|jj|jd|�S)zeReturns the identifier of item's next sibling, or '' if item
        is the last child of its parent.�nextr�rds  r&r�z
Treeview.next[����w�w�|�|�D�G�G�V�T�2�2r(c�P�|jj|jd|�S)zaReturns the ID of the parent of item, or '' if item is at the
        top level of the hierarchy.r�r�rds  r&r�zTreeview.parentas���w�w�|�|�D�G�G�X�t�4�4r(c�P�|jj|jd|�S)zjReturns the identifier of item's previous sibling, or '' if
        item is the first child of its parent.�prevr�rds  r&r�z
Treeview.prevgr�r(c�R�|jj|jd|�y)z�Ensure that item is visible.

        Sets all of item's ancestors open option to True, and scrolls
        the widget if necessary so that item is within the visible
        portion of the tree.�seeNr�rds  r&r�zTreeview.seems��	
�����T�W�W�e�T�*r(c��|jj|jj|jd��S)z$Returns the tuple of selected items.�	selectionr.r�s r&r�zTreeview.selectionvs*���w�w� � ������d�g�g�{�!C�D�Dr(c��t|�dk(rt|dttf�r|d}|jj|jd||�y)Nr3rr�)r6r!r#r"r{r�r�)r��selopr+s   r&�
_selectionzTreeview._selection{sA���u�:��?�z�%��(�U�D�M�B��!�H�E������T�W�W�k�5�%�8r(c�(�|jd|�y)z.The specified items becomes the new selection.rN�r�rls  r&�
selection_setzTreeview.selection_set��������u�%r(c�(�|jd|�y)z0Add all of the specified items to the selection.rNr�rls  r&�
selection_addzTreeview.selection_add�r�r(c�(�|jd|�y)z5Remove all of the specified items from the selection.�removeNr�rls  r&�selection_removezTreeview.selection_remove��������%�(r(c�(�|jd|�y)z2Toggle the selection state of each specified item.�toggleNr�rls  r&�selection_togglezTreeview.selection_toggle�r�r(c��|jj|jd|||�}|�|�t|j|dt��S|S)a;Query or set the value of given item.

        With one argument, return a dictionary of column/value pairs
        for the specified item. With two arguments, return the current
        value of the specified column. With three arguments, set the
        value of given column in given item to the specified value.rF)�	cut_minusr�)r{r�r�rr�)r�rarbr$r}s     r&rzTreeview.set�sN���g�g�l�l�4�7�7�E�4���?���>�e�m��d�g�g�s�(-�M�C�
C��Jr(c�J�|j|jdd|f||d��y)z�Bind a callback for the given event sequence to the tag tagname.
        When an event is delivered to an item, the callbacks for each
        of the item's tags option are called.�tag�bindr)rN)�_bindr�)r��tagname�sequencer�s    r&�tag_bindzTreeview.tag_bind�s%��	
�
�
�D�G�G�U�F�G�4�h��a�
�Pr(c�X�|�d||<t|j||jdd|�S)aBQuery or modify the options for the specified tagname.

        If kw is not given, returns a dict of the option settings for tagname.
        If option is specified, returns the value for that option for the
        specified tagname. Otherwise, sets the options to the corresponding
        values for the given tagname.Nr�r]r+)r�r�r�rHs    r&�
tag_configurezTreeview.tag_configure�s5�����B�v�J��D�G�G�R����%����	r(c	��|�A|jj|jj|jdd|��S|jj	|jj|jdd||��S)z�If item is specified, returns 1 or 0 depending on whether the
        specified item has the given tagname. Otherwise, returns a list of
        all items which have the specified tag.

        * Availability: Tk 8.6r��has)r{rxr�r�r�)r�r�ras   r&�tag_haszTreeview.tag_has�sq���<��7�7�$�$������T�W�W�e�U�G�<�>�
>��7�7�%�%������T�W�W�e�U�G�T�B�D�
Dr(r�r�)&r�r�r�r�r�r�rerhrbrkrnrprrrur�r~r�r�r�r�r#rar��reattachr�r�r�r�r�r�r�r�r�r�rr�r�r�rAr(r&rr�s����;�.P�E�=�D�/�/�I�4�E�@B�*�
-�	-�.�D��.	@�;��H�3�5�3�+�E�
9�&�
&�
)�
)�
�Q�
�Dr(rc�d��eZdZdZdd�Z�fd�Zd�Zed��Zejd��Z�xZ
S)rz�A Ttk Scale widget with a Ttk Label widget indicating its
    current value.

    The Ttk Scale can be accessed through instance.scale, and Ttk Label
    can be accessed through instance.labelc�`�|jdd�dk(|_tj||fi|��|xst	j
|�|_|jj|�||_t|�|_
t||j||��|_|jjd|j�|jrdnd}|dk(rdnd}|jj|d��t|�}|j|��|j!�|jj#|dk(rd	nd
��|jj%d|j�|_|jd
|j�|jd|j�y)a�Construct a horizontal LabeledScale with parent master, a
        variable to be associated with the Ttk Scale widget and its range.
        If variable is not specified, a tkinter.IntVar is created.

        WIDGET-SPECIFIC OPTIONS

            compound: 'top' or 'bottom'
                Specifies how to display the label relative to the scale.
                Defaults to 'top'.
        �compound�top)�variablerJrKrL�bottomr�)�side�fill)r�r�re)�anchor�writez<Configure>z<Map>N)�pop�
_label_toprr�r��IntVar�	_variabler�_last_validr�labelr�scaler��_adjust�pack�lower�place�	trace_add�_LabeledScale__tracecb)	r�r�r�rJrKrH�
scale_side�
label_side�dummys	         r&r�zLabeledScale.__init__�sF���&�&��U�3�u�<���
���t�V�*�r�*�!�;�W�^�^�F�%;��������5�!� ����4�[��
��4�$�.�.��"�M��
��
�
���*�D�L�L�9�"&���X�e�
�(�H�4�U�(�
��
�
���Z�c��2��d���
�
�
�
�
�#�
���
��
�
���z�U�':����D����1�1�'�4�<�<�H����	�	�-����.��	�	�'�4�<�<�(r(c���	|jjd|j�|`t�|��d|_d|_y#t$rY�(wxYw)z9Destroy this widget and possibly its associated variable.r�N)r��trace_remover��AttributeError�super�destroyr�r��r��	__class__s �r&r�zLabeledScale.destroy�sS���	��N�N�'�'�����@���
������
���
��
�	��	�s�&A�	A�Ac�B���fd�}t�jd�}t�jd�}||kr||}}�jj�}||cxkr|ksn�j�_y|�_|�jd<�j|�y)z1Adjust the label position according to the scale.c����j��jj�\}}�jr6�jj	��j
j
�z
}n5�jj
��j
j
�z}�j
j||��y)N)r�r�)�update_idletasksr��coordsr��winfo_yr��winfo_reqheight�place_configure)r�r�r�s  �r&�adjust_labelz*LabeledScale._adjust.<locals>.adjust_labels�����!�!�#��:�:�$�$�&�D�A�q�����J�J�&�&�(�4�:�:�+E�+E�+G�G���J�J�.�.�0�4�:�:�3M�3M�3O�O���J�J�&�&��a�&�0r(rErKN�text)r�r�r�rar�r$r��
after_idle)r�rGr�rJrK�newvals`     r&r�zLabeledScale._adjusts����		1��4�:�:�f�-�.��
��
�
�4�(�
)��
��:��E�2�E����#�#�%����$�"�$��)�)�D�J��!���#��
�
�6������%r(c�6�|jj�S)zReturn current scale value.)r�rar�s r&r$zLabeledScale.values���~�~�!�!�#�#r(c�:�|jj|�y)zSet new scale value.N)r�r)r�r:s  r&r$zLabeledScale.value#s��	
�����3�r()NNr�
)r�r�r�r�r�r�r��propertyr$�setter�
__classcell__�r�s@r&rr�sD���.�#)�L
�&�6�$��$��\�\� �� r(rc�8��eZdZdZdd�Zd�Zdd�Z�fd�Z�xZS)rzmThemed OptionMenu, based after tkinter's OptionMenu, which allows
    the user to select a value from a menu.c	��||jdd�|jdd�d�}tj||fi|��tj|d��|d<||_|jdd�|_|r8tjd	tt|j���z��|j|g|���y)
a9Construct a themed OptionMenu widget with master as the parent,
        the resource textvariable set to variable, the initially selected
        value specified by the default parameter, the menu values given by
        *values and additional keywords.

        WIDGET-SPECIFIC OPTIONS

            style: stylename
                Menubutton style.
            direction: 'above', 'below', 'left', 'right', or 'flush'
                Menubutton direction.
            command: callback
                A callback that will be invoked after selecting an item.
        r�N�	direction)�textvariabler�r�F)�tearoff�menurtzunknown option -%s)r�r
r�r��Menur��	_callback�TclErrorr�ro�keys�set_menu)r�r�r�r��values�kwargsrHs       r&r�zOptionMenu.__init__-s���'����G�T�1J�!�:�:�k�4�8�:�����D�&�/�B�/��|�|�D�%�8��V��!������I�t�4�����"�"�#7��T�&�+�+�-�(�)�$+�,�
,�	��
�
�g�'��'r(c��|dk(r%|jtj||��Stj||�S)Nr�)�nametowidgetr
�__getitem__rds  r&r�zOptionMenu.__getitem__Js:���6�>��$�$�Z�%;�%;�D�$�%G�H�H��%�%�d�D�1�1r(c�����d}|jdd�|D]3}|j|�j�dn|f�fd�	�j���5|r�jj	|�yy)zUBuild a new menu of radiobuttons with *values and optionally
        a default value.r�r�endNc�&���j|�Sr�)r�)r:r�s �r&�<lambda>z%OptionMenu.set_menu.<locals>.<lambda>Zs�������)<r()r�rtr�)rk�add_radiobuttonr�r�r)r�r�r�r�r:s`    r&r�zOptionMenu.set_menuQsp����F�|�����A�u���C�� � �s� �N�N�2�D�$'�<����
!�
)����N�N���w�'�r(c�F��	|`t�|�
�y#t$rY�wxYw)z0Destroy this widget and its associated variable.N)r�r�r�r�r�s �r&r�zOptionMenu.destroybs-���	���	������	��	�s��	 � r�)	r�r�r�r�r�r�r�r�r�r�s@r&rr)s!���/�(�:2�(�"�r(r)F)FN)rrDr�)3r��__version__�
__author__�__all__r�rrrrr'r1r;r?rOrSrkrurzr�r�r�r�rr�objectrr�rrrrrrrr	r
rr
rrrrrrrr�XView�YViewrrrrAr(r&�<module>rs������
0�
�,���;�;��� �*�"#�J/%�b(�T�(�83� �
���	�a1�F�a1�H<Q�W�^�^�<Q�~/�V�/�0/�&�/�:'E�F�G�M�M�'E�T",�u�",�J8�F�8�$8�F�8�&=��=�$�
�=��=�&B@�v�B@�J6O�&�'�-�-�6O�p��'&�&�'&�T/�&�/�8%2�F�G�M�M�%2�P<���)�)�<�"<��<�$;�v�;�,�e�,�6CD�v�w�}�}�g�m�m�CD�P
] �5�] �@?��?r(__pycache__/dnd.cpython-312.opt-1.pyc000064400000037707151710635150013205 0ustar00�

T��h|-��z�dZddlZddgZd�ZGd�d�ZGd�d�ZGd	�d
�Zd�Zedk(re�yy)
aFDrag-and-drop support for Tkinter.

This is very preliminary.  I currently only support dnd *within* one
application, between different windows (or within the same window).

I am trying to make this as generic as possible -- not dependent on
the use of a particular widget or icon type, etc.  I also hope that
this will work with Pmw.

To enable an object to be dragged, you must create an event binding
for it that starts the drag-and-drop process. Typically, you should
bind <ButtonPress> to a callback function that you write. The function
should call Tkdnd.dnd_start(source, event), where 'source' is the
object to be dragged, and 'event' is the event that invoked the call
(the argument to your callback function).  Even though this is a class
instantiation, the returned instance should not be stored -- it will
be kept alive automatically for the duration of the drag-and-drop.

When a drag-and-drop is already in process for the Tk interpreter, the
call is *ignored*; this normally averts starting multiple simultaneous
dnd processes, e.g. because different button callbacks all
dnd_start().

The object is *not* necessarily a widget -- it can be any
application-specific object that is meaningful to potential
drag-and-drop targets.

Potential drag-and-drop targets are discovered as follows.  Whenever
the mouse moves, and at the start and end of a drag-and-drop move, the
Tk widget directly under the mouse is inspected.  This is the target
widget (not to be confused with the target object, yet to be
determined).  If there is no target widget, there is no dnd target
object.  If there is a target widget, and it has an attribute
dnd_accept, this should be a function (or any callable object).  The
function is called as dnd_accept(source, event), where 'source' is the
object being dragged (the object passed to dnd_start() above), and
'event' is the most recent event object (generally a <Motion> event;
it can also be <ButtonPress> or <ButtonRelease>).  If the dnd_accept()
function returns something other than None, this is the new dnd target
object.  If dnd_accept() returns None, or if the target widget has no
dnd_accept attribute, the target widget's parent is considered as the
target widget, and the search for a target object is repeated from
there.  If necessary, the search is repeated all the way up to the
root widget.  If none of the target widgets can produce a target
object, there is no target object (the target object is None).

The target object thus produced, if any, is called the new target
object.  It is compared with the old target object (or None, if there
was no old target widget).  There are several cases ('source' is the
source object, and 'event' is the most recent event object):

- Both the old and new target objects are None.  Nothing happens.

- The old and new target objects are the same object.  Its method
dnd_motion(source, event) is called.

- The old target object was None, and the new target object is not
None.  The new target object's method dnd_enter(source, event) is
called.

- The new target object is None, and the old target object is not
None.  The old target object's method dnd_leave(source, event) is
called.

- The old and new target objects differ and neither is None.  The old
target object's method dnd_leave(source, event), and then the new
target object's method dnd_enter(source, event) is called.

Once this is done, the new target object replaces the old one, and the
Tk mainloop proceeds.  The return value of the methods mentioned above
is ignored; if they raise an exception, the normal exception handling
mechanisms take over.

The drag-and-drop processes can end in two ways: a final target object
is selected, or no final target object is selected.  When a final
target object is selected, it will always have been notified of the
potential drop by a call to its dnd_enter() method, as described
above, and possibly one or more calls to its dnd_motion() method; its
dnd_leave() method has not been called since the last call to
dnd_enter().  The target is notified of the drop by a call to its
method dnd_commit(source, event).

If no final target object is selected, and there was an old target
object, its dnd_leave(source, event) method is called to complete the
dnd sequence.

Finally, the source object is notified that the drag-and-drop process
is over, by a call to source.dnd_end(target, event), specifying either
the selected target object, or None if no target object was selected.
The source object can use this to implement the commit action; this is
sometimes simpler than to do it in the target's dnd_commit().  The
target's dnd_commit() method could then simply be aliased to
dnd_leave().

At any time during a dnd sequence, the application can cancel the
sequence by calling the cancel() method on the object returned by
dnd_start().  This will call dnd_leave() if a target is currently
active; it will never call dnd_commit().

�N�	dnd_start�
DndHandlerc�8�t||�}|j�|Sy�N)r�root)�source�event�hs   �$/usr/lib64/python3.12/tkinter/dnd.pyrrms ���6�5�!�A��v�v�����c�8�eZdZdZd�Zd�Zd�Zd�Zdd�Zd	d�Z	y)
rNc���|jdkDry|jj�}	|jy#t$r||_||_YnwxYw||_d|_|jx|_}|jx|_	}d||fz|_
|dxsd|_|j|j|j�|jd|j�d|d<y)N�z<B%d-ButtonRelease-%d>�cursor��<Motion>�hand2)�num�widget�_root�_DndHandler__dnd�AttributeErrorrr�target�initial_button�initial_widget�release_pattern�save_cursor�bind�
on_release�	on_motion)�selfrr	r�buttonrs      r�__init__zDndHandler.__init__{s����9�9�q�=���|�|�!�!�#��	��J�J����	��D�J��D�I�	��������',�y�y�0���f�',�|�|�3���f�7�6�6�:J�J���!�(�+�1�r������D�(�(�$�/�/�:����J����/�"��x�s�9�A�Ac�T�|j}d|_|�	|`yy#t$rYywxYwr)rrr�r!rs  r�__del__zDndHandler.__del__�s;���y�y����	���
��J���"�
��
�s��	'�'c��|j|j}}|jj||�}|j}d}|�(	|j
}|||�}|�n|j}|��(|j}||ur|�|j||�yy|�d|_|j||�|�|j||�||_yy#t$rY�xwxYwr)�x_root�y_rootr�winfo_containingr�
dnd_acceptr�masterr�
dnd_motion�	dnd_leave�	dnd_enter)	r!r	�x�y�
target_widgetr�
new_target�attr�
old_targets	         rr zDndHandler.on_motion�s����|�|�U�\�\�1���+�+�<�<�Q��B�
������
��'�
�$�/�/��"�&�%�0�
��)��)�0�0�M��'��[�[�
���#��%��%�%�f�e�4�&��%�"����$�$�V�U�3��%��$�$�V�U�3�(���&��"�
��
�s�C�	C�Cc�(�|j|d�y)N���finish�r!r	s  rrzDndHandler.on_release�������E�1�rc�(�|j|d�y)Nrr8r:s  r�cancelzDndHandler.cancel�r;rc���|j}|j}|j}|j}	|`|jj|j�|jjd�|j|d<dx|_x|_x|_|_|�'|r|j||�n|j||�|j||�y#|j||�wxYw)Nrr)rrrrr�unbindrr�
dnd_commitr.�dnd_end)r!r	�commitrrrrs       rr9zDndHandler.finish�s������������$�$���y�y��	*��
����&�&�t�';�';�<����&�&�z�2�#�/�/�F�8��JN�N�D�K�N�$�+�N��(;�d�i��!���%�%�f�e�4��$�$�V�U�3��N�N�6�5�)��F�N�N�6�5�)�s�BC�C/r)r)
�__name__�
__module__�__qualname__rr#r&r rr=r9�rrrrws%���D�#�(�)�6��*rc�>�eZdZd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)�Iconc�<�||_dx|_x|_|_yr)�name�canvas�label�id)r!rJs  rr#z
Icon.__init__�s����	�-1�1���1�d�j�4�7rc��||jur(|jj|j||�y|j�|j�|�yt	j
||jdd��}|j|||d��}||_||_||_|jd|j�y)N��raised)�text�borderwidth�relief�nw)�window�anchorz
<ButtonPress>)rK�coordsrM�detach�tkinter�LabelrJ�
create_windowrLr�press)r!rKr0r1rLrMs      r�attachzIcon.attach�s����T�[�[� ��K�K���t�w�w��1�-���;�;�"��K�K�M��>���
�
�f�4�9�9�*+�H�>��
�
!�
!�!�Q�u�T�
!�
B�������
����
�
�
�?�D�J�J�/rc��|j}|�y|j}|j}dx|_x|_|_|j|�|j	�yr)rKrMrL�delete�destroy)r!rKrMrLs    rrXzIcon.detach�sO�������>��
�W�W���
�
��-1�1���1�d�j�4�7��
�
�b��
�
�
�rc���t||�rU|j|_|j|_|j
j
|j�\|_|_	yyr)
rr0�x_offr1�y_offrKrWrM�x_orig�y_origr:s  rr\z
Icon.press�sH���T�5�!����D�J����D�J�'+�{�{�'9�'9�$�'�'�'B�$�D�K���"rc��|j|j|�\}}|jj|j||�yr)�whererKrWrM)r!r	r0r1s    r�movez	Icon.move�s4���z�z�$�+�+�u�-���1������4�7�7�A�q�)rc�z�|jj|j|j|j�yr)rKrWrMrdre)r!s r�putbackzIcon.putback�s$�������4�7�7�D�K�K����=rc��|j�}|j�}|j|z
}|j|z
}||jz
||j
z
fSr)�winfo_rootx�winfo_rootyr(r)rbrc)r!rKr	�x_org�y_orgr0r1s       rrgz
Icon.where�sU���"�"�$���"�"�$���L�L�5� ���L�L�5� ���4�:�:�~�q�4�:�:�~�-�-rc��yrrF)r!rr	s   rrAzIcon.dnd_end	s��rN)�
rq)rCrDrEr#r]rXr\rhrjrgrArFrrrHrH�s+��2�0� �C�*�>�.�
rrHc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�Testerc��tj|�|_tj|jdd��|_|jjdd��|j|j_y)N�d)�width�height�bothr7)�fill�expand)rY�Toplevel�top�CanvasrK�packr+r%s  rr#zTester.__init__sS���#�#�D�)����n�n�T�X�X�S��E��������f�Q��/�!%������rc��|SrrF�r!rr	s   rr+zTester.dnd_accepts���rc�T�|jj�|j|j|�\}}|jj|j�\}}}}||z
||z
}
}	|jj||||	z||
z�|_|j||�yr)rK�	focus_setrg�bboxrM�create_rectangle�dndidr-)r!rr	r0r1�x1�y1�x2�y2�dx�dys           rr/zTester.dnd_enters����������|�|�D�K�K��/���1����+�+�F�I�I�6���B��B��B���2��B���[�[�1�1�!�Q��"��a��d�C��
������&rc���|j|j|�\}}|jj|j�\}}}}|jj	|j||z
||z
�yr)rgrKr�r�rh)	r!rr	r0r1r�r�r�r�s	         rr-zTester.dnd_motion s\���|�|�D�K�K��/���1����)�)�$�*�*�5���B��B���������Q�r�T�1�R�4�0rc��|jj�|jj|j�d|_yr)r|r�rKr_r�r�s   rr.zTester.dnd_leave%s/�������������4�:�:�&���
rc��|j||�|j|j|�\}}|j|j||�yr)r.rgrKr])r!rr	r0r1s     rr@zTester.dnd_commit*s<�����v�u�%��|�|�D�K�K��/���1��
�
�d�k�k�1�a�(rN)	rCrDrEr#r+r/r-r.r@rFrrrsrs
s ��1��'�1�
�
)rrsc��tj�}|jd�tj|jd��j�t
|�}|jjd�t
|�}|jjd�t
|�}|jjd�td�}td�}td	�}|j|j�|j|j�|j|j�|j�y)
Nz+1+1�Quit)�commandrQz+1+60z+120+60z+240+60�ICON1�ICON2�ICON3)rY�Tk�geometry�Button�quitr~rsr|rHr]rK�mainloop)r�t1�t2�t3�i1�i2�i3s       r�testr�0s����:�:�<�D��M�M�&���N�N�4�9�9�6�2�7�7�9�	���B��F�F�O�O�G��	���B��F�F�O�O�I��	���B��F�F�O�O�I��	
�g��B�	
�g��B�	
�g��B��I�I�b�i�i���I�I�b�i�i���I�I�b�i�i���M�M�Or�__main__)	�__doc__rY�__all__rrrHrsr�rCrFrr�<module>r�s\��c�J���
%��
�S*�S*�r:
�:
�z )� )�F�&�z���F�r__pycache__/dnd.cpython-312.opt-2.pyc000064400000026161151710635150013176 0ustar00�

T��h|-��x�	ddlZddgZd�ZGd�d�ZGd�d�ZGd�d	�Zd
�Zedk(re�yy)�N�	dnd_start�
DndHandlerc�8�t||�}|j�|Sy�N)r�root)�source�event�hs   �$/usr/lib64/python3.12/tkinter/dnd.pyrrms ���6�5�!�A��v�v�����c�8�eZdZdZd�Zd�Zd�Zd�Zdd�Zd	d�Z	y)
rNc���|jdkDry|jj�}	|jy#t$r||_||_YnwxYw||_d|_|jx|_}|jx|_	}d||fz|_
|dxsd|_|j|j|j�|jd|j�d|d<y)N�z<B%d-ButtonRelease-%d>�cursor��<Motion>�hand2)�num�widget�_root�_DndHandler__dnd�AttributeErrorrr�target�initial_button�initial_widget�release_pattern�save_cursor�bind�
on_release�	on_motion)�selfrr	r�buttonrs      r�__init__zDndHandler.__init__{s����9�9�q�=���|�|�!�!�#��	��J�J����	��D�J��D�I�	��������',�y�y�0���f�',�|�|�3���f�7�6�6�:J�J���!�(�+�1�r������D�(�(�$�/�/�:����J����/�"��x�s�9�A�Ac�T�|j}d|_|�	|`yy#t$rYywxYwr)rrr�r!rs  r�__del__zDndHandler.__del__�s;���y�y����	���
��J���"�
��
�s��	'�'c��|j|j}}|jj||�}|j}d}|�(	|j
}|||�}|�n|j}|��(|j}||ur|�|j||�yy|�d|_|j||�|�|j||�||_yy#t$rY�xwxYwr)�x_root�y_rootr�winfo_containingr�
dnd_acceptr�masterr�
dnd_motion�	dnd_leave�	dnd_enter)	r!r	�x�y�
target_widgetr�
new_target�attr�
old_targets	         rr zDndHandler.on_motion�s����|�|�U�\�\�1���+�+�<�<�Q��B�
������
��'�
�$�/�/��"�&�%�0�
��)��)�0�0�M��'��[�[�
���#��%��%�%�f�e�4�&��%�"����$�$�V�U�3��%��$�$�V�U�3�(���&��"�
��
�s�C�	C�Cc�(�|j|d�y)N���finish�r!r	s  rrzDndHandler.on_release�������E�1�rc�(�|j|d�y)Nrr8r:s  r�cancelzDndHandler.cancel�r;rc���|j}|j}|j}|j}	|`|jj|j�|jjd�|j|d<dx|_x|_x|_|_|�'|r|j||�n|j||�|j||�y#|j||�wxYw)Nrr)rrrrr�unbindrr�
dnd_commitr.�dnd_end)r!r	�commitrrrrs       rr9zDndHandler.finish�s������������$�$���y�y��	*��
����&�&�t�';�';�<����&�&�z�2�#�/�/�F�8��JN�N�D�K�N�$�+�N��(;�d�i��!���%�%�f�e�4��$�$�V�U�3��N�N�6�5�)��F�N�N�6�5�)�s�BC�C/r)r)
�__name__�
__module__�__qualname__rr#r&r rr=r9�rrrrws%���D�#�(�)�6��*rc�>�eZdZd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)�Iconc�<�||_dx|_x|_|_yr)�name�canvas�label�id)r!rJs  rr#z
Icon.__init__�s����	�-1�1���1�d�j�4�7rc��||jur(|jj|j||�y|j�|j�|�yt	j
||jdd��}|j|||d��}||_||_||_|jd|j�y)N��raised)�text�borderwidth�relief�nw)�window�anchorz
<ButtonPress>)rK�coordsrM�detach�tkinter�LabelrJ�
create_windowrLr�press)r!rKr0r1rLrMs      r�attachzIcon.attach�s����T�[�[� ��K�K���t�w�w��1�-���;�;�"��K�K�M��>���
�
�f�4�9�9�*+�H�>��
�
!�
!�!�Q�u�T�
!�
B�������
����
�
�
�?�D�J�J�/rc��|j}|�y|j}|j}dx|_x|_|_|j|�|j	�yr)rKrMrL�delete�destroy)r!rKrMrLs    rrXzIcon.detach�sO�������>��
�W�W���
�
��-1�1���1�d�j�4�7��
�
�b��
�
�
�rc���t||�rU|j|_|j|_|j
j
|j�\|_|_	yyr)
rr0�x_offr1�y_offrKrWrM�x_orig�y_origr:s  rr\z
Icon.press�sH���T�5�!����D�J����D�J�'+�{�{�'9�'9�$�'�'�'B�$�D�K���"rc��|j|j|�\}}|jj|j||�yr)�whererKrWrM)r!r	r0r1s    r�movez	Icon.move�s4���z�z�$�+�+�u�-���1������4�7�7�A�q�)rc�z�|jj|j|j|j�yr)rKrWrMrdre)r!s r�putbackzIcon.putback�s$�������4�7�7�D�K�K����=rc��|j�}|j�}|j|z
}|j|z
}||jz
||j
z
fSr)�winfo_rootx�winfo_rootyr(r)rbrc)r!rKr	�x_org�y_orgr0r1s       rrgz
Icon.where�sU���"�"�$���"�"�$���L�L�5� ���L�L�5� ���4�:�:�~�q�4�:�:�~�-�-rc��yrrF)r!rr	s   rrAzIcon.dnd_end	s��rN)�
rq)rCrDrEr#r]rXr\rhrjrgrArFrrrHrH�s+��2�0� �C�*�>�.�
rrHc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�Testerc��tj|�|_tj|jdd��|_|jjdd��|j|j_y)N�d)�width�height�bothr7)�fill�expand)rY�Toplevel�top�CanvasrK�packr+r%s  rr#zTester.__init__sS���#�#�D�)����n�n�T�X�X�S��E��������f�Q��/�!%������rc��|SrrF�r!rr	s   rr+zTester.dnd_accepts���rc�T�|jj�|j|j|�\}}|jj|j�\}}}}||z
||z
}
}	|jj||||	z||
z�|_|j||�yr)rK�	focus_setrg�bboxrM�create_rectangle�dndidr-)r!rr	r0r1�x1�y1�x2�y2�dx�dys           rr/zTester.dnd_enters����������|�|�D�K�K��/���1����+�+�F�I�I�6���B��B��B���2��B���[�[�1�1�!�Q��"��a��d�C��
������&rc���|j|j|�\}}|jj|j�\}}}}|jj	|j||z
||z
�yr)rgrKr�r�rh)	r!rr	r0r1r�r�r�r�s	         rr-zTester.dnd_motion s\���|�|�D�K�K��/���1����)�)�$�*�*�5���B��B���������Q�r�T�1�R�4�0rc��|jj�|jj|j�d|_yr)r|r�rKr_r�r�s   rr.zTester.dnd_leave%s/�������������4�:�:�&���
rc��|j||�|j|j|�\}}|j|j||�yr)r.rgrKr])r!rr	r0r1s     rr@zTester.dnd_commit*s<�����v�u�%��|�|�D�K�K��/���1��
�
�d�k�k�1�a�(rN)	rCrDrEr#r+r/r-r.r@rFrrrsrs
s ��1��'�1�
�
)rrsc��tj�}|jd�tj|jd��j�t
|�}|jjd�t
|�}|jjd�t
|�}|jjd�td�}td�}td	�}|j|j�|j|j�|j|j�|j�y)
Nz+1+1�Quit)�commandrQz+1+60z+120+60z+240+60�ICON1�ICON2�ICON3)rY�Tk�geometry�Button�quitr~rsr|rHr]rK�mainloop)r�t1�t2�t3�i1�i2�i3s       r�testr�0s����:�:�<�D��M�M�&���N�N�4�9�9�6�2�7�7�9�	���B��F�F�O�O�G��	���B��F�F�O�O�I��	���B��F�F�O�O�I��	
�g��B�	
�g��B�	
�g��B��I�I�b�i�i���I�I�b�i�i���I�I�b�i�i���M�M�Or�__main__)rY�__all__rrrHrsr�rCrFrr�<module>r�s\��c�J���
%��
�S*�S*�r:
�:
�z )� )�F�&�z���F�r__pycache__/dnd.cpython-312.pyc000064400000037707151710635150012246 0ustar00�

T��h|-��z�dZddlZddgZd�ZGd�d�ZGd�d�ZGd	�d
�Zd�Zedk(re�yy)
aFDrag-and-drop support for Tkinter.

This is very preliminary.  I currently only support dnd *within* one
application, between different windows (or within the same window).

I am trying to make this as generic as possible -- not dependent on
the use of a particular widget or icon type, etc.  I also hope that
this will work with Pmw.

To enable an object to be dragged, you must create an event binding
for it that starts the drag-and-drop process. Typically, you should
bind <ButtonPress> to a callback function that you write. The function
should call Tkdnd.dnd_start(source, event), where 'source' is the
object to be dragged, and 'event' is the event that invoked the call
(the argument to your callback function).  Even though this is a class
instantiation, the returned instance should not be stored -- it will
be kept alive automatically for the duration of the drag-and-drop.

When a drag-and-drop is already in process for the Tk interpreter, the
call is *ignored*; this normally averts starting multiple simultaneous
dnd processes, e.g. because different button callbacks all
dnd_start().

The object is *not* necessarily a widget -- it can be any
application-specific object that is meaningful to potential
drag-and-drop targets.

Potential drag-and-drop targets are discovered as follows.  Whenever
the mouse moves, and at the start and end of a drag-and-drop move, the
Tk widget directly under the mouse is inspected.  This is the target
widget (not to be confused with the target object, yet to be
determined).  If there is no target widget, there is no dnd target
object.  If there is a target widget, and it has an attribute
dnd_accept, this should be a function (or any callable object).  The
function is called as dnd_accept(source, event), where 'source' is the
object being dragged (the object passed to dnd_start() above), and
'event' is the most recent event object (generally a <Motion> event;
it can also be <ButtonPress> or <ButtonRelease>).  If the dnd_accept()
function returns something other than None, this is the new dnd target
object.  If dnd_accept() returns None, or if the target widget has no
dnd_accept attribute, the target widget's parent is considered as the
target widget, and the search for a target object is repeated from
there.  If necessary, the search is repeated all the way up to the
root widget.  If none of the target widgets can produce a target
object, there is no target object (the target object is None).

The target object thus produced, if any, is called the new target
object.  It is compared with the old target object (or None, if there
was no old target widget).  There are several cases ('source' is the
source object, and 'event' is the most recent event object):

- Both the old and new target objects are None.  Nothing happens.

- The old and new target objects are the same object.  Its method
dnd_motion(source, event) is called.

- The old target object was None, and the new target object is not
None.  The new target object's method dnd_enter(source, event) is
called.

- The new target object is None, and the old target object is not
None.  The old target object's method dnd_leave(source, event) is
called.

- The old and new target objects differ and neither is None.  The old
target object's method dnd_leave(source, event), and then the new
target object's method dnd_enter(source, event) is called.

Once this is done, the new target object replaces the old one, and the
Tk mainloop proceeds.  The return value of the methods mentioned above
is ignored; if they raise an exception, the normal exception handling
mechanisms take over.

The drag-and-drop processes can end in two ways: a final target object
is selected, or no final target object is selected.  When a final
target object is selected, it will always have been notified of the
potential drop by a call to its dnd_enter() method, as described
above, and possibly one or more calls to its dnd_motion() method; its
dnd_leave() method has not been called since the last call to
dnd_enter().  The target is notified of the drop by a call to its
method dnd_commit(source, event).

If no final target object is selected, and there was an old target
object, its dnd_leave(source, event) method is called to complete the
dnd sequence.

Finally, the source object is notified that the drag-and-drop process
is over, by a call to source.dnd_end(target, event), specifying either
the selected target object, or None if no target object was selected.
The source object can use this to implement the commit action; this is
sometimes simpler than to do it in the target's dnd_commit().  The
target's dnd_commit() method could then simply be aliased to
dnd_leave().

At any time during a dnd sequence, the application can cancel the
sequence by calling the cancel() method on the object returned by
dnd_start().  This will call dnd_leave() if a target is currently
active; it will never call dnd_commit().

�N�	dnd_start�
DndHandlerc�8�t||�}|j�|Sy�N)r�root)�source�event�hs   �$/usr/lib64/python3.12/tkinter/dnd.pyrrms ���6�5�!�A��v�v�����c�8�eZdZdZd�Zd�Zd�Zd�Zdd�Zd	d�Z	y)
rNc���|jdkDry|jj�}	|jy#t$r||_||_YnwxYw||_d|_|jx|_}|jx|_	}d||fz|_
|dxsd|_|j|j|j�|jd|j�d|d<y)N�z<B%d-ButtonRelease-%d>�cursor��<Motion>�hand2)�num�widget�_root�_DndHandler__dnd�AttributeErrorrr�target�initial_button�initial_widget�release_pattern�save_cursor�bind�
on_release�	on_motion)�selfrr	r�buttonrs      r�__init__zDndHandler.__init__{s����9�9�q�=���|�|�!�!�#��	��J�J����	��D�J��D�I�	��������',�y�y�0���f�',�|�|�3���f�7�6�6�:J�J���!�(�+�1�r������D�(�(�$�/�/�:����J����/�"��x�s�9�A�Ac�T�|j}d|_|�	|`yy#t$rYywxYwr)rrr�r!rs  r�__del__zDndHandler.__del__�s;���y�y����	���
��J���"�
��
�s��	'�'c��|j|j}}|jj||�}|j}d}|�(	|j
}|||�}|�n|j}|��(|j}||ur|�|j||�yy|�d|_|j||�|�|j||�||_yy#t$rY�xwxYwr)�x_root�y_rootr�winfo_containingr�
dnd_acceptr�masterr�
dnd_motion�	dnd_leave�	dnd_enter)	r!r	�x�y�
target_widgetr�
new_target�attr�
old_targets	         rr zDndHandler.on_motion�s����|�|�U�\�\�1���+�+�<�<�Q��B�
������
��'�
�$�/�/��"�&�%�0�
��)��)�0�0�M��'��[�[�
���#��%��%�%�f�e�4�&��%�"����$�$�V�U�3��%��$�$�V�U�3�(���&��"�
��
�s�C�	C�Cc�(�|j|d�y)N���finish�r!r	s  rrzDndHandler.on_release�������E�1�rc�(�|j|d�y)Nrr8r:s  r�cancelzDndHandler.cancel�r;rc���|j}|j}|j}|j}	|`|jj|j�|jjd�|j|d<dx|_x|_x|_|_|�'|r|j||�n|j||�|j||�y#|j||�wxYw)Nrr)rrrrr�unbindrr�
dnd_commitr.�dnd_end)r!r	�commitrrrrs       rr9zDndHandler.finish�s������������$�$���y�y��	*��
����&�&�t�';�';�<����&�&�z�2�#�/�/�F�8��JN�N�D�K�N�$�+�N��(;�d�i��!���%�%�f�e�4��$�$�V�U�3��N�N�6�5�)��F�N�N�6�5�)�s�BC�C/r)r)
�__name__�
__module__�__qualname__rr#r&r rr=r9�rrrrws%���D�#�(�)�6��*rc�>�eZdZd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)�Iconc�<�||_dx|_x|_|_yr)�name�canvas�label�id)r!rJs  rr#z
Icon.__init__�s����	�-1�1���1�d�j�4�7rc��||jur(|jj|j||�y|j�|j�|�yt	j
||jdd��}|j|||d��}||_||_||_|jd|j�y)N��raised)�text�borderwidth�relief�nw)�window�anchorz
<ButtonPress>)rK�coordsrM�detach�tkinter�LabelrJ�
create_windowrLr�press)r!rKr0r1rLrMs      r�attachzIcon.attach�s����T�[�[� ��K�K���t�w�w��1�-���;�;�"��K�K�M��>���
�
�f�4�9�9�*+�H�>��
�
!�
!�!�Q�u�T�
!�
B�������
����
�
�
�?�D�J�J�/rc��|j}|�y|j}|j}dx|_x|_|_|j|�|j	�yr)rKrMrL�delete�destroy)r!rKrMrLs    rrXzIcon.detach�sO�������>��
�W�W���
�
��-1�1���1�d�j�4�7��
�
�b��
�
�
�rc���t||�rU|j|_|j|_|j
j
|j�\|_|_	yyr)
rr0�x_offr1�y_offrKrWrM�x_orig�y_origr:s  rr\z
Icon.press�sH���T�5�!����D�J����D�J�'+�{�{�'9�'9�$�'�'�'B�$�D�K���"rc��|j|j|�\}}|jj|j||�yr)�whererKrWrM)r!r	r0r1s    r�movez	Icon.move�s4���z�z�$�+�+�u�-���1������4�7�7�A�q�)rc�z�|jj|j|j|j�yr)rKrWrMrdre)r!s r�putbackzIcon.putback�s$�������4�7�7�D�K�K����=rc��|j�}|j�}|j|z
}|j|z
}||jz
||j
z
fSr)�winfo_rootx�winfo_rootyr(r)rbrc)r!rKr	�x_org�y_orgr0r1s       rrgz
Icon.where�sU���"�"�$���"�"�$���L�L�5� ���L�L�5� ���4�:�:�~�q�4�:�:�~�-�-rc��yrrF)r!rr	s   rrAzIcon.dnd_end	s��rN)�
rq)rCrDrEr#r]rXr\rhrjrgrArFrrrHrH�s+��2�0� �C�*�>�.�
rrHc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�Testerc��tj|�|_tj|jdd��|_|jjdd��|j|j_y)N�d)�width�height�bothr7)�fill�expand)rY�Toplevel�top�CanvasrK�packr+r%s  rr#zTester.__init__sS���#�#�D�)����n�n�T�X�X�S��E��������f�Q��/�!%������rc��|SrrF�r!rr	s   rr+zTester.dnd_accepts���rc�T�|jj�|j|j|�\}}|jj|j�\}}}}||z
||z
}
}	|jj||||	z||
z�|_|j||�yr)rK�	focus_setrg�bboxrM�create_rectangle�dndidr-)r!rr	r0r1�x1�y1�x2�y2�dx�dys           rr/zTester.dnd_enters����������|�|�D�K�K��/���1����+�+�F�I�I�6���B��B��B���2��B���[�[�1�1�!�Q��"��a��d�C��
������&rc���|j|j|�\}}|jj|j�\}}}}|jj	|j||z
||z
�yr)rgrKr�r�rh)	r!rr	r0r1r�r�r�r�s	         rr-zTester.dnd_motion s\���|�|�D�K�K��/���1����)�)�$�*�*�5���B��B���������Q�r�T�1�R�4�0rc��|jj�|jj|j�d|_yr)r|r�rKr_r�r�s   rr.zTester.dnd_leave%s/�������������4�:�:�&���
rc��|j||�|j|j|�\}}|j|j||�yr)r.rgrKr])r!rr	r0r1s     rr@zTester.dnd_commit*s<�����v�u�%��|�|�D�K�K��/���1��
�
�d�k�k�1�a�(rN)	rCrDrEr#r+r/r-r.r@rFrrrsrs
s ��1��'�1�
�
)rrsc��tj�}|jd�tj|jd��j�t
|�}|jjd�t
|�}|jjd�t
|�}|jjd�td�}td�}td	�}|j|j�|j|j�|j|j�|j�y)
Nz+1+1�Quit)�commandrQz+1+60z+120+60z+240+60�ICON1�ICON2�ICON3)rY�Tk�geometry�Button�quitr~rsr|rHr]rK�mainloop)r�t1�t2�t3�i1�i2�i3s       r�testr�0s����:�:�<�D��M�M�&���N�N�4�9�9�6�2�7�7�9�	���B��F�F�O�O�G��	���B��F�F�O�O�I��	���B��F�F�O�O�I��	
�g��B�	
�g��B�	
�g��B��I�I�b�i�i���I�I�b�i�i���I�I�b�i�i���M�M�Or�__main__)	�__doc__rY�__all__rrrHrsr�rCrFrr�<module>r�s\��c�J���
%��
�S*�S*�r:
�:
�z )� )�F�&�z���F�r__pycache__/filedialog.cpython-312.opt-1.pyc000064400000054130151710635150014524 0ustar00�

T��h[:���dZgd�ZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZddlmZddlmZddlmZiZGd�d	�ZGd
�de�ZGd�d
e�ZGd�dej,�ZGd�de�ZGd�de�Z Gd�dej,�Z!d�Z"d�Z#d�Z$dd�Z%dd�Z&d d�Z'd�Z(d�Z)e*dk(re)�yy)!aUFile selection dialog classes.

Classes:

- FileDialog
- LoadFileDialog
- SaveFileDialog

This module also presents tk common file dialogues, it provides interfaces
to the native file dialogues available in Tk 4.2 and newer, and the
directory dialogue available in Tk 8.3 and newer.
These interfaces were written by Fredrik Lundh, May 1997.
)
�
FileDialog�LoadFileDialog�SaveFileDialog�Open�SaveAs�	Directory�askopenfilename�asksaveasfilename�askopenfilenames�askopenfile�askopenfiles�
asksaveasfile�askdirectory�N)�Frame�LEFT�YES�BOTTOM�Entry�TOP�Button�Tk�X�Toplevel�RIGHT�Y�END�Listbox�BOTH�	Scrollbar)�Dialog)�commondialog)�
_setup_dialogc��eZdZdZdZdd�Zejdddfd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zdd�Zd�Zd�Zdd�Zd�Zd�Zy)ra�Standard file selection dialog -- no checks on selected file.

    Usage:

        d = FileDialog(master)
        fname = d.go(dir_or_file, pattern, default, key)
        if fname is None: ...canceled...
        else: ...open file...

    All arguments to go() are optional.

    The 'key' argument specifies a key in the global dictionary
    'dialogstates', which keeps track of the values for the directory
    and pattern arguments, overriding the values passed in (it does
    not keep track of the default argument!).  If no key is specified,
    the dialog keeps no memory of previous state.  Note that memory is
    kept even when the dialog is canceled.  (All this emulates the
    behavior of the Macintosh file selection dialogs.)

    zFile Selection DialogNc�*�|�|j}||_d|_t|�|_|jj|�|jj|�t
|j�t|j�|_|jjtt��t|j�|_
|jjtt��|jjd|j�t|j�|_|j jt"t��|j jd|j$�t|j�|_|j&jt(t*��t-|j&�|_|j.jt0t2��t5|j&d|j.df��|_|j6jt0t(t*��|j6j9�}|j6j9|dd|ddz�|j6jd	|j:�|j6jd
|j<�|j.j?|j6df��t-|j&�|_ |j@jtBt2��t5|j&d|j@df��|_"|jDjtBt(t*��|j@j?|jDdf��|jDj9�}|jDj9|dd|ddz�|jDjd	|jF�|jDjd
|jH�tK|jd
|jL��|_'|jNjtB��tK|jd|j$��|_(|jPjtBt(��tK|jd|jR��|_*|jTjt0��|jjWd|jR�|jjd|jR�|jjd|jR�y)N)�side�fillz<Return>)�expandr&r�set)�exportselection�yscrollcommand)r%r'r&�z<ButtonRelease-1>z<Double-ButtonRelease-1>�yview)�command�OK)�textr-)r%�Filter)r%r'�Cancel�WM_DELETE_WINDOWz<Alt-w>z<Alt-W>),�title�master�	directoryr�top�iconnamer"r�botframe�packrrr�	selection�bind�ok_event�filterr�filter_command�midframerrr�filesbarrrr�files�bindtags�files_select_event�files_double_event�config�dirsbarr�dirs�dirs_select_event�dirs_double_eventr�
ok_command�	ok_button�
filter_button�cancel_command�
cancel_button�protocol)�selfr4r3�btagss    �+/usr/lib64/python3.12/tkinter/filedialog.py�__init__zFileDialog.__init__:s����=�$�*�*�%��������F�#��������u�������%� ��d�h�h���d�h�h���
��
�
����Q��/��t�x�x����������a��0������J��
�
�6��D�H�H�o��������c���*�������T�%8�%8�9��d�h�h���
��
�
���#�D��1�!�$�-�-�0��
��
�
����A��.��T�]�]�A�-1�]�]�E�,B�D��
��
�
���U�3�T��:��
�
�#�#�%���
�
���E�!�"�I��b�q�	�1�2��
�
���+�T�-D�-D�E��
�
���2�D�4K�4K�L��
�
���d�j�j�'�%:��;� ����/��������t�!��,��D�M�M�1�,0�L�L�%�+@�B��	��	�	���D��4��8������T�Y�Y��$8��9��	�	�"�"�$���	�	���5���9�u�R�a�y�0�1��	�	���*�D�,B�,B�C��	�	���1�4�3I�3I�J���
�
�&*�)-���:���	
�������&�#�D�M�M�)1�,0�,?�,?�A���	
�����T�#��6�#�D�M�M�)1�,0�,?�,?�A���	
�����U��+������,�d�.A�.A�B����
�
�i��!4�!4�5����
�
�i��!4�!4�5��*�c�b�|r|tvrt|\|_}nmtjj	|�}tjj|�r||_n'tjj
|�\|_}|j|j|�|j|�|j�|jj�|jj�|jj�d|_|j j#�|rS|j%�\}}|jr)tjj'|j�}||ft|<|jj)�|jS�N)�dialogstatesr5�os�path�
expanduser�isdir�split�
set_filter�
set_selectionr>r:�	focus_setr6�wait_visibility�grab_set�howr4�mainloop�
get_filter�dirname�destroy)rP�dir_or_file�pattern�default�keyr5s      rR�goz
FileDialog.gozs-���3�,�&�&2�3�&7�#�D�N�G��'�'�,�,�[�9�K��w�w�}�}�[�)�!,���*,�'�'�-�-��*D�'�����������0����7�#�������� � �"���� � �"�����������������!%���!2��I�w��x�x��G�G�O�O�D�H�H�5�	� )�7� 2�L����������x�x�rTc�F�||_|jj�yrX)rdr4�quit)rPrds  rRrozFileDialog.quit�s����������rTc�$�|j�yrX)r>�rP�events  rRrIzFileDialog.dirs_double_event�s�����rTc��|j�\}}|jjd�}tjjtjj
|j|��}|j||�y�N�active)	rfrG�getrZr[�normpath�joinr5r_)rPrr�dir�pat�subdirs     rRrHzFileDialog.dirs_select_event�sY���?�?�$���S������x�(���g�g���r�w�w�|�|�D�N�N�F�C�D������S�!rTc�$�|j�yrX�rJrqs  rRrDzFileDialog.files_double_event�������rTc�\�|jjd�}|j|�yrt)rArvr`)rPrr�files   rRrCzFileDialog.files_select_event�s"���z�z�~�~�h�'�����4� rTc�$�|j�yrXr}rqs  rRr<zFileDialog.ok_event�r~rTc�B�|j|j��yrX)ro�
get_selection�rPs rRrJzFileDialog.ok_command�s���	�	�$�$�$�&�'rTc���|j�\}}	tj|�}||_|j||�|j�tjg}g}|D]{}tjj||�}tjj|�r|j|��Ttj||�s�k|j|��}|jj!dt"�|D]"}|jj%t"|��$|j&j!dt"�|D]"}|j&j%t"|��$tjj)|j+��\}	}
|
tj,k(rd}
|j/|
�y#t$r|jj�YywxYw)NrrV)rfrZ�listdir�OSErrorr4�bellr5r_�sort�pardirr[rxr]�append�fnmatchrG�deleter�insertrAr^r��curdirr`)rPrrryrz�names�subdirs�
matchingfiles�name�fullname�head�tails           rRr>zFileDialog.filter_command�sq���?�?�$���S�	��J�J�s�O�E��������S�!�
�
�
���9�9�+���
��D��w�w�|�|�C��.�H��w�w�}�}�X�&����t�$�����s�+��$�$�T�*��	
�	�	����C� ��D��I�I���S�$�'���
�
���!�S�!�!�D��J�J���c�4�(�"��W�W�]�]�4�#5�#5�#7�8�
��d��2�9�9��R�d����4� ��-�	��K�K�����	�s�G�#G1�0G1c�\�|jj�}tjj	|�}|ddtj
k(stjj
|�r tjj|d�}tjj|�S)N���rU)	r=rvrZr[r\�sepr]rxr^)rPr=s  rRrfzFileDialog.get_filter�sn�������"�����#�#�F�+���"�#�;�"�&�&� �B�G�G�M�M�&�$9��W�W�\�\�&�#�.�F��w�w�}�}�V�$�$rTc�x�|jj�}tjj	|�}|SrX)r:rvrZr[r\�rPr�s  rRr�zFileDialog.get_selection�s-���~�~�!�!�#���w�w�!�!�$�'���rTc�$�|j�yrX)rorqs  rRrMzFileDialog.cancel_command�s���	�	�rTc��tjj|�sV	tj�}|r?tjj||�}tjj
|�}|jjdt�|jjttjj|xstj|xsd��y#t$rd}Y��wxYw)NrrU)rZr[�isabs�getcwdr�rxrwr=r�rr�r�)rPryrz�pwds    rRr_zFileDialog.set_filter�s����w�w�}�}�S�!�
��i�i�k����g�g�l�l�3��,���g�g�&�&�s�+�������1�c�"������3������S�-=�B�I�I�s�z�c� J�K��
�
���
�s�C+�+C9�8C9c���|jjdt�|jjttj
j
|j|��y)Nr)r:r�rr�rZr[rxr5r�s  rRr`zFileDialog.set_selection�s=�������a��%������c�2�7�7�<�<�����#E�FrTrX)�__name__�
__module__�__qualname__�__doc__r3rSrZr�rmrorIrHrDrCr<rJr>rfr�rMr_r`�rTrRrr!sk���*
$�E�>6�@ �Y�Y��R�T��2��"��!��(�!�8%��
�
L�GrTrc��eZdZdZdZd�Zy)rz8File selection dialog which checks that the file exists.zLoad File Selection Dialogc��|j�}tjj|�s|jj�y|j
|�yrX)r�rZr[�isfiler4r�ror�s  rRrJzLoadFileDialog.ok_command�s;���!�!�#���w�w�~�~�d�#��K�K�����I�I�d�OrTN�r�r�r�r�r3rJr�rTrRrr�s��B�(�E�rTrc��eZdZdZdZd�Zy)rz@File selection dialog which checks that the file may be created.zSave File Selection Dialogc��|j�}tjj|�ritjj	|�r|j
j
�yt|jdd|�d�ddd��}|jdk7r]ytjj|�\}}tjj	|�s|j
j
�y|j|�y)	Nz Overwrite Existing File QuestionzOverwrite existing file �?�	questheadr+)�Yesr1)r3r/�bitmaprk�stringsr)r�rZr[�existsr]r4r�r r6�numr^ro)rPr��dr�r�s     rRrJzSaveFileDialog.ok_command�s����!�!�#��
�7�7�>�>�$���w�w�}�}�T�"���� � �"���t�x�x�?�=A�C�)� �0�2�A��u�u��z�������t�,�J�D�$��7�7�=�=��&���� � �"���	�	�$�rTNr�r�rTrRrr�s��J�(�E�rTrc��eZdZd�Zd�Zy)�_Dialogc�n�	t|jd�|jd<y#t$rYywxYw)N�	filetypes)�tuple�options�KeyErrorr�s rR�_fixoptionsz_Dialog._fixoptions2s5��	�(-�d�l�l�;�.G�(H�D�L�L��%���	��	�s�%(�	4�4c���|rM	|j}tjj	|�\}}||j
d<||j
d<||_|S#t$rY�TwxYw)N�
initialdir�initialfile)�string�AttributeErrorrZr[r^r��filename)rP�widget�resultr[r�s     rR�
_fixresultz_Dialog._fixresult9sg���
����������v�.�J�D�$�)-�D�L�L��&�*.�D�L�L��'���
��
��"�
��
�s�A�	A%�$A%N)r�r�r�r�r�r�rTrRr�r�0s���
rTr�c��eZdZdZdZd�Zy)r�Ask for a filename to open�tk_getOpenFilec
��t|t�r\t|D�cgc]}t|d|���c}�}|r4tjj|d�\}}||jd<|S|jj�s9d|jvr+|j||jj|��Stj|||�Scc}w)Nr�rr��multiple)�
isinstancer��getattrrZr[r^r��tk�wantobjectsr��	splitlistr�)rPr�r��rr[r�s      rRr�zOpen._fixresultQs����f�e�$��V�D�V��G�A�x��3�V�D�E�F���W�W�]�]�6�!�9�5�
��d�-1����\�*��M��y�y�$�$�&�:����+E��?�?�6�6�9�9�+>�+>�v�+F�G�G��!�!�$���7�7��Es�CN�r�r�r�r�r-r�r�rTrRrrLs�� ��G�8rTrc��eZdZdZdZy)r�Ask for a filename to save as�tk_getSaveFileN)r�r�r�r�r-r�rTrRrr`s
��#��GrTrc��eZdZdZdZd�Zy)rzAsk for a directory�tk_chooseDirectoryc�n�|r	|j}||jd<||_|S#t$rY�#wxYw)Nr�)r�r�r�r5)rPr�r�s   rRr�zDirectory._fixresultlsC���
�����
*0�D�L�L��&�����
��
"�
��
�s�(�	4�4Nr�r�rTrRrrgs���"�G�rTrc�4�tdi|��j�S)r�r��r�show�r�s rRrr}s���?�'�?���!�!rTc�4�tdi|��j�S)r�r�)rr�r�s rRr	r	�s����G��!�!�#�#rTc�>�d|d<tdi|��j�S)ztAsk for multiple filenames to open

    Returns a list of filenames or empty list if
    cancel button selected
    r+r�r�r�r�s rRr
r
�s#���G�J���?�'�?���!�!rTc�R�tdi|��j�}|rt||�Sy)z8Ask for a filename to open, and returned the opened fileNr�)rr��open��moder�r�s   rRrr�s+����g��#�#�%�H���H�d�#�#�rTc�l�tdi|��}|r&g}|D]}|jt||���|}|S)z�Ask for multiple filenames and return the open file
    objects

    returns a list of open file objects or an empty list if
    cancel selected
    r�)r
r�r�)r�r�rA�ofilesr�s     rRrr�s@��
�'�w�'�E�����H��M�M�$�x��.�/�����LrTc�R�tdi|��j�}|rt||�Sy)z;Ask for a filename to save as, and returned the opened fileNr�)rr�r�r�s   rRr
r
�s-��� �� �%�%�'�H���H�d�#�#�rTc�4�tdi|��j�S)z-Ask for a directory, and return the file namer�)rr�r�s rRrr�s����w��$�$�&�&rTc��t�}|j�t|�}|jd��}t	|�}|jd��}t||�d}	ddl}|j|jd�|j|j�}tdg��}	t|d	�}|j�td|j#|��t%�}	td|	j#|��y#ttf$rY�|wxYw#t $r }td
�t|�Yd}~�zd}~wwxYw)
zSimple test program.�test)rlzutf-8rNrV)z	all filesrU)r�r�zCould not open File: r��saveas)r�withdrawrrmr�print�locale�	setlocale�LC_ALL�nl_langinfo�CODESET�ImportErrorr�rr��close�
BaseException�encoder	)
�root�fd�loadfile�savefile�encr��openfilename�fp�exc�saveasfilenames
          rRr�r��s#��
�4�D��M�M�O�	��	�B��u�u��u� �H�	��	�B��u�u��u� �H�	�(�H���C�
��������r�*�� � ����0��!�,>�+?�@�L����S�!��
���
�

�&�,�%�%�c�*�+�%�&�N�	�(�N�)�)�#�.�/��%
��(�
��
����
�%�&�
�c�
�
���s*�$;D
�-D�
D�D�	E�(E�E�__main__)r�)�w)+r��__all__r�rZ�tkinterrrrrrrrrrrrrrrrr�tkinter.dialogr r!�tkinter.simpledialogr"rYrrrr�rrrrr	r
rrr
rr�r�r�rTrR�<module>rs����K��
�	������"� �.���EG�EG�P�Z���Z��r�l�!�!��88�7�8�(�W����#�#��,"�$�"���"�'�(0�V�z���F�rT__pycache__/filedialog.cpython-312.opt-2.pyc000064400000050536151710635150014533 0ustar00�

T��h[:���	gd�ZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZddlmZddlmZiZGd�d�ZGd	�d
e�ZGd�de�ZGd
�dej*�ZGd�de�ZGd�de�ZGd�dej*�Z d�Z!d�Z"d�Z#dd�Z$dd�Z%dd�Z&d�Z'd�Z(e)dk(re(�yy) )
�
FileDialog�LoadFileDialog�SaveFileDialog�Open�SaveAs�	Directory�askopenfilename�asksaveasfilename�askopenfilenames�askopenfile�askopenfiles�
asksaveasfile�askdirectory�N)�Frame�LEFT�YES�BOTTOM�Entry�TOP�Button�Tk�X�Toplevel�RIGHT�Y�END�Listbox�BOTH�	Scrollbar)�Dialog)�commondialog)�
_setup_dialogc��eZdZ	dZdd�Zejdddfd�Zdd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zdd�Zd�Zd�Zdd�Zd�Zd�Zy)rzFile Selection DialogNc�*�|�|j}||_d|_t|�|_|jj|�|jj|�t
|j�t|j�|_|jjtt��t|j�|_
|jjtt��|jjd|j�t|j�|_|j jt"t��|j jd|j$�t|j�|_|j&jt(t*��t-|j&�|_|j.jt0t2��t5|j&d|j.df��|_|j6jt0t(t*��|j6j9�}|j6j9|dd|ddz�|j6jd	|j:�|j6jd
|j<�|j.j?|j6df��t-|j&�|_ |j@jtBt2��t5|j&d|j@df��|_"|jDjtBt(t*��|j@j?|jDdf��|jDj9�}|jDj9|dd|ddz�|jDjd	|jF�|jDjd
|jH�tK|jd
|jL��|_'|jNjtB��tK|jd|j$��|_(|jPjtBt(��tK|jd|jR��|_*|jTjt0��|jjWd|jR�|jjd|jR�|jjd|jR�y)N)�side�fillz<Return>)�expandr&r�set)�exportselection�yscrollcommand)r%r'r&�z<ButtonRelease-1>z<Double-ButtonRelease-1>�yview)�command�OK)�textr-)r%�Filter)r%r'�Cancel�WM_DELETE_WINDOWz<Alt-w>z<Alt-W>),�title�master�	directoryr�top�iconnamer"r�botframe�packrrr�	selection�bind�ok_event�filterr�filter_command�midframerrr�filesbarrrr�files�bindtags�files_select_event�files_double_event�config�dirsbarr�dirs�dirs_select_event�dirs_double_eventr�
ok_command�	ok_button�
filter_button�cancel_command�
cancel_button�protocol)�selfr4r3�btagss    �+/usr/lib64/python3.12/tkinter/filedialog.py�__init__zFileDialog.__init__:s����=�$�*�*�%��������F�#��������u�������%� ��d�h�h���d�h�h���
��
�
����Q��/��t�x�x����������a��0������J��
�
�6��D�H�H�o��������c���*�������T�%8�%8�9��d�h�h���
��
�
���#�D��1�!�$�-�-�0��
��
�
����A��.��T�]�]�A�-1�]�]�E�,B�D��
��
�
���U�3�T��:��
�
�#�#�%���
�
���E�!�"�I��b�q�	�1�2��
�
���+�T�-D�-D�E��
�
���2�D�4K�4K�L��
�
���d�j�j�'�%:��;� ����/��������t�!��,��D�M�M�1�,0�L�L�%�+@�B��	��	�	���D��4��8������T�Y�Y��$8��9��	�	�"�"�$���	�	���5���9�u�R�a�y�0�1��	�	���*�D�,B�,B�C��	�	���1�4�3I�3I�J���
�
�&*�)-���:���	
�������&�#�D�M�M�)1�,0�,?�,?�A���	
�����T�#��6�#�D�M�M�)1�,0�,?�,?�A���	
�����U��+������,�d�.A�.A�B����
�
�i��!4�!4�5����
�
�i��!4�!4�5��*�c�b�|r|tvrt|\|_}nmtjj	|�}tjj|�r||_n'tjj
|�\|_}|j|j|�|j|�|j�|jj�|jj�|jj�d|_|j j#�|rS|j%�\}}|jr)tjj'|j�}||ft|<|jj)�|jS�N)�dialogstatesr5�os�path�
expanduser�isdir�split�
set_filter�
set_selectionr>r:�	focus_setr6�wait_visibility�grab_set�howr4�mainloop�
get_filter�dirname�destroy)rP�dir_or_file�pattern�default�keyr5s      rR�goz
FileDialog.gozs-���3�,�&�&2�3�&7�#�D�N�G��'�'�,�,�[�9�K��w�w�}�}�[�)�!,���*,�'�'�-�-��*D�'�����������0����7�#�������� � �"���� � �"�����������������!%���!2��I�w��x�x��G�G�O�O�D�H�H�5�	� )�7� 2�L����������x�x�rTc�F�||_|jj�yrX)rdr4�quit)rPrds  rRrozFileDialog.quit�s����������rTc�$�|j�yrX)r>�rP�events  rRrIzFileDialog.dirs_double_event�s�����rTc��|j�\}}|jjd�}tjjtjj
|j|��}|j||�y�N�active)	rfrG�getrZr[�normpath�joinr5r_)rPrr�dir�pat�subdirs     rRrHzFileDialog.dirs_select_event�sY���?�?�$���S������x�(���g�g���r�w�w�|�|�D�N�N�F�C�D������S�!rTc�$�|j�yrX�rJrqs  rRrDzFileDialog.files_double_event�������rTc�\�|jjd�}|j|�yrt)rArvr`)rPrr�files   rRrCzFileDialog.files_select_event�s"���z�z�~�~�h�'�����4� rTc�$�|j�yrXr}rqs  rRr<zFileDialog.ok_event�r~rTc�B�|j|j��yrX)ro�
get_selection�rPs rRrJzFileDialog.ok_command�s���	�	�$�$�$�&�'rTc���|j�\}}	tj|�}||_|j||�|j�tjg}g}|D]{}tjj||�}tjj|�r|j|��Ttj||�s�k|j|��}|jj!dt"�|D]"}|jj%t"|��$|j&j!dt"�|D]"}|j&j%t"|��$tjj)|j+��\}	}
|
tj,k(rd}
|j/|
�y#t$r|jj�YywxYw)NrrV)rfrZ�listdir�OSErrorr4�bellr5r_�sort�pardirr[rxr]�append�fnmatchrG�deleter�insertrAr^r��curdirr`)rPrrryrz�names�subdirs�
matchingfiles�name�fullname�head�tails           rRr>zFileDialog.filter_command�sq���?�?�$���S�	��J�J�s�O�E��������S�!�
�
�
���9�9�+���
��D��w�w�|�|�C��.�H��w�w�}�}�X�&����t�$�����s�+��$�$�T�*��	
�	�	����C� ��D��I�I���S�$�'���
�
���!�S�!�!�D��J�J���c�4�(�"��W�W�]�]�4�#5�#5�#7�8�
��d��2�9�9��R�d����4� ��-�	��K�K�����	�s�G�#G1�0G1c�\�|jj�}tjj	|�}|ddtj
k(stjj
|�r tjj|d�}tjj|�S)N���rU)	r=rvrZr[r\�sepr]rxr^)rPr=s  rRrfzFileDialog.get_filter�sn�������"�����#�#�F�+���"�#�;�"�&�&� �B�G�G�M�M�&�$9��W�W�\�\�&�#�.�F��w�w�}�}�V�$�$rTc�x�|jj�}tjj	|�}|SrX)r:rvrZr[r\�rPr�s  rRr�zFileDialog.get_selection�s-���~�~�!�!�#���w�w�!�!�$�'���rTc�$�|j�yrX)rorqs  rRrMzFileDialog.cancel_command�s���	�	�rTc��tjj|�sV	tj�}|r?tjj||�}tjj
|�}|jjdt�|jjttjj|xstj|xsd��y#t$rd}Y��wxYw)NrrU)rZr[�isabs�getcwdr�rxrwr=r�rr�r�)rPryrz�pwds    rRr_zFileDialog.set_filter�s����w�w�}�}�S�!�
��i�i�k����g�g�l�l�3��,���g�g�&�&�s�+�������1�c�"������3������S�-=�B�I�I�s�z�c� J�K��
�
���
�s�C+�+C9�8C9c���|jjdt�|jjttj
j
|j|��y)Nr)r:r�rr�rZr[rxr5r�s  rRr`zFileDialog.set_selection�s=�������a��%������c�2�7�7�<�<�����#E�FrTrX)�__name__�
__module__�__qualname__r3rSrZr�rmrorIrHrDrCr<rJr>rfr�rMr_r`�rTrRrr!sk���*
$�E�>6�@ �Y�Y��R�T��2��"��!��(�!�8%��
�
L�GrTrc��eZdZ	dZd�Zy)rzLoad File Selection Dialogc��|j�}tjj|�s|jj�y|j
|�yrX)r�rZr[�isfiler4r�ror�s  rRrJzLoadFileDialog.ok_command�s;���!�!�#���w�w�~�~�d�#��K�K�����I�I�d�OrTN�r�r�r�r3rJr�rTrRrr�s��B�(�E�rTrc��eZdZ	dZd�Zy)rzSave File Selection Dialogc��|j�}tjj|�ritjj	|�r|j
j
�yt|jdd|�d�ddd��}|jdk7r]ytjj|�\}}tjj	|�s|j
j
�y|j|�y)	Nz Overwrite Existing File QuestionzOverwrite existing file �?�	questheadr+)�Yesr1)r3r/�bitmaprk�stringsr)r�rZr[�existsr]r4r�r r6�numr^ro)rPr��dr�r�s     rRrJzSaveFileDialog.ok_command�s����!�!�#��
�7�7�>�>�$���w�w�}�}�T�"���� � �"���t�x�x�?�=A�C�)� �0�2�A��u�u��z�������t�,�J�D�$��7�7�=�=��&���� � �"���	�	�$�rTNr�r�rTrRrr�s��J�(�E�rTrc��eZdZd�Zd�Zy)�_Dialogc�n�	t|jd�|jd<y#t$rYywxYw)N�	filetypes)�tuple�options�KeyErrorr�s rR�_fixoptionsz_Dialog._fixoptions2s5��	�(-�d�l�l�;�.G�(H�D�L�L��%���	��	�s�%(�	4�4c���|rM	|j}tjj	|�\}}||j
d<||j
d<||_|S#t$rY�TwxYw)N�
initialdir�initialfile)�string�AttributeErrorrZr[r^r��filename)rP�widget�resultr[r�s     rR�
_fixresultz_Dialog._fixresult9sg���
����������v�.�J�D�$�)-�D�L�L��&�*.�D�L�L��'���
��
��"�
��
�s�A�	A%�$A%N)r�r�r�r�r�r�rTrRr�r�0s���
rTr�c��eZdZ	dZd�Zy)r�tk_getOpenFilec
��t|t�r\t|D�cgc]}t|d|���c}�}|r4tjj|d�\}}||jd<|S|jj�s9d|jvr+|j||jj|��Stj|||�Scc}w)Nr�rr��multiple)�
isinstancer��getattrrZr[r^r��tk�wantobjectsr��	splitlistr�)rPr�r��rr[r�s      rRr�zOpen._fixresultQs����f�e�$��V�D�V��G�A�x��3�V�D�E�F���W�W�]�]�6�!�9�5�
��d�-1����\�*��M��y�y�$�$�&�:����+E��?�?�6�6�9�9�+>�+>�v�+F�G�G��!�!�$���7�7��Es�CN�r�r�r�r-r�r�rTrRrrLs�� ��G�8rTrc��eZdZ	dZy)r�tk_getSaveFileN)r�r�r�r-r�rTrRrr`s
��#��GrTrc��eZdZ	dZd�Zy)r�tk_chooseDirectoryc�n�|r	|j}||jd<||_|S#t$rY�#wxYw)Nr�)r�r�r�r5)rPr�r�s   rRr�zDirectory._fixresultlsC���
�����
*0�D�L�L��&�����
��
"�
��
�s�(�	4�4Nr�r�rTrRrrgs���"�G�rTrc�6�	tdi|��j�S�Nr��r�show�r�s rRrr}s�� ��?�'�?���!�!rTc�6�	tdi|��j�Sr�)rr�r�s rRr	r	�s��#���G��!�!�#�#rTc�@�	d|d<tdi|��j�S)Nr+r�r�r�r�s rRr
r
�s(���
�G�J���?�'�?���!�!rTc�T�	tdi|��j�}|rt||�Syr�)rr��open��moder�r�s   rRrr�s,��>���g��#�#�%�H���H�d�#�#�rTc�n�	tdi|��}|r&g}|D]}|jt||���|}|Sr�)r
r�r�)r�r�rA�ofilesr�s     rRrr�sE���
�'�w�'�E�����H��M�M�$�x��.�/�����LrTc�T�	tdi|��j�}|rt||�Syr�)rr�r�r�s   rRr
r
�s.��A�� �� �%�%�'�H���H�d�#�#�rTc�6�	tdi|��j�Sr�)rr�r�s rRrr�s��3���w��$�$�&�&rTc��	t�}|j�t|�}|jd��}t	|�}|jd��}t||�d}	ddl}|j|jd�|j|j�}tdg��}	t|d�}|j�td
|j#|��t%�}	td|	j#|��y#ttf$rY�|wxYw#t $r }td	�t|�Yd}~�zd}~wwxYw)N�test)rlzutf-8rrV)z	all filesrU)r�r�zCould not open File: r��saveas)r�withdrawrrmr�print�locale�	setlocale�LC_ALL�nl_langinfo�CODESET�ImportErrorr�rr��close�
BaseException�encoder	)
�root�fd�loadfile�savefile�encr��openfilename�fp�exc�saveasfilenames
          rRr�r��s&���
�4�D��M�M�O�	��	�B��u�u��u� �H�	��	�B��u�u��u� �H�	�(�H���C�
��������r�*�� � ����0��!�,>�+?�@�L����S�!��
���
�

�&�,�%�%�c�*�+�%�&�N�	�(�N�)�)�#�.�/��%
��(�
��
����
�%�&�
�c�
�
���s*�%;D�.D �D�D� 	E	�)E�E	�__main__)r�)�w)*�__all__r�rZ�tkinterrrrrrrrrrrrrrrrr�tkinter.dialogr r!�tkinter.simpledialogr"rYrrrr�rrrrr	r
rrr
rr�r�r�rTrR�<module>rs����K��
�	������"� �.���EG�EG�P�Z���Z��r�l�!�!��88�7�8�(�W����#�#��,"�$�"���"�'�(0�V�z���F�rT__pycache__/font.cpython-312.opt-1.pyc000064400000025170151710635150013375 0ustar00�

T��hX����ddlZddlZdZgd�ZdZdZdZdZdd�ZGd	�d
�Z	dd�Z
dd�Zed
k(�r�ej�Ze	dde��Zeej#��eej#d��eej#d��eej%��eej'd��eej'd��ee��eej)d�ej+d��eej+e���e	d��Zeej)d�ej+de���ej,ede��Zej1�ej2edej4��Zej1�e	ed��j7�Zej%e��ej%e��ej:�yy) �Nz0.9)�NORMAL�ROMAN�BOLD�ITALIC�
nametofont�Font�families�names�normal�roman�bold�italicc��t|d|��S)zFGiven the name of a tk named font, returns a Font representation.
    T)�name�exists�root)r)rrs  �%/usr/lib64/python3.12/tkinter/font.pyrrs���T�$�T�2�2�c��eZdZdZej
d�Zd�Zd�Zd�Z	dd�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zdd�Zd�Zd�ZeZdd�Zd�Zy)ra�Represents a named font.

    Constructor options are:

    font -- font specifier (name, system font, or (family, size, style)-tuple)
    name -- name to use for this font configuration (defaults to a unique name)
    exists -- does a named font by this name already exist?
       Creates a new named font if False, points to the existing font if True.
       Raises _tkinter.TclError if the assertion is false.

       the following are ignored if font is specified:

    family -- font 'family', e.g. Courier, Times, Helvetica
    size -- font size in points
    weight -- font thickness: NORMAL, BOLD
    slant -- font slant: ROMAN, ITALIC
    underline -- font underlining: false (0), true (1)
    overstrike -- font strikeout: false (0), true (1)

    �c��g}|j�D]3\}}|jd|z�|jt|���5t|�S�N�-)�items�append�str�tuple)�self�kw�options�k�vs     r�_setz	Font._set2sG�����H�H�J�D�A�q��N�N�3�q�5�!��N�N�3�q�6�"���W�~�rc�R�g}|D]}|jd|z��t|�Sr)rr)r�argsr r!s    r�_getz	Font._get9s+�����A��N�N�3�q�5�!���W�~�rc�b�i}tdt|�d�D]}||dz|||dd<�|S)Nr�r)�range�len)rr%r �is    r�_mkdictzFont._mkdict?s?�����q�#�d�)�Q�'�A�#'��!��9�G�D��G�A�B�K� �(��rNc��|�tjd�}t|d|�}|r#|j|j	dd|��}n|j|�}|s!dt
t|j��z}||_	|r�d|_
|j|j|j	dd��vr-tjjd|j�d���|rF|jdd	|jg|���n&|jdd
|jg|���d|_
||_
|j|_|j|_y)Nzuse font�tk�font�actualFr
znamed font z does not already exist�	configure�createT)�tkinter�_get_default_root�getattr�	splitlist�callr#r�next�counterr�delete_font�_tkinter�TclError�_tk�_split�_call)rrr/rrr r.s       r�__init__z
Font.__init__Es%���<��,�,�Z�8�D�
�T�4��
&����<�<������$� ?�@�D��9�9�W�%�D���C��T�\�\� 2�3�3�D���	��$�D���y�y����R�W�W�V�W�-E� F�F��&�&�/�/�>B�i�i�I�K�K��������T�Y�Y�>��>�
�B�G�G�F�H�d�i�i�7�$�7�#�D������l�l����g�g��
rc��|jS�N)r�rs r�__str__zFont.__str__ds���y�y�rc�~�d|jj�d|jj�d|j�d�S)N�<�.z object �>)�	__class__�
__module__�__qualname__rrCs r�__repr__z
Font.__repr__gs<���4�>�>�,�,�-�Q�t�~�~�/J�/J�.K��$�)�)��a�)�	)rc��t|t�stS|j|jk(xr|j|jk(SrB)�
isinstancer�NotImplementedrr=)r�others  r�__eq__zFont.__eq__ks7���%��&�!�!��y�y�E�J�J�&�@�4�8�8�u�y�y�+@�@rc�$�|j|�SrB)�cget)r�keys  r�__getitem__zFont.__getitem__ps���y�y��~�rc�,�|jdi||i��y)N�)r1)rrT�values   r�__setitem__zFont.__setitem__ss������&�#�u��&rc�x�	|jr|jdd|j�yy#t$rYywxYw)Nr/�delete)r:r?r�	ExceptionrCs r�__del__zFont.__del__vs;��	�����
�
�6�8�T�Y�Y�7� ���	��	�s�)-�	9�9c�J�t|jfi|j���S)z*Return a distinct copy of the current font)rr=r0rCs r�copyz	Font.copy}s���D�H�H�.����
�.�.rc	���d}|rd|f}|r(|d|zfz}|jdd|jg|���S|j|j|jdd|jg|�����S)zReturn actual font attributesrW�
-displayofrr/r0)r?rr,r>)r�option�	displayofr%s    rr0zFont.actual�s}����� �)�,�D���3��<�*�*�D��4�:�:�f�h��	�	�A�D�A�A��<�<����J�D�J�J�v�x����J�T�J�K�M�
Mrc�D�|jdd|jd|z�S)zGet font attributer/�configr)r?r)rrbs  rrSz	Font.cget�s���z�z�&�(�D�I�I�s�6�z�B�Brc	���|r/|jdd|jg|j|����y|j|j	|jdd|j���S)zModify font attributesr/reN)r?rr#r,r>)rr s  rrezFont.config�s`����D�J�J�v�x����
'��9�9�W�%�
'��<�<����D�J�J�v�x����C�D�F�
Frc��|f}|rd||f}|jj|jdd|jg|����S)zReturn text widthrar/�measure)r=�getintr?r)r�textrcr%s    rrhzFont.measure�sC���w��� �)�T�2�D��x�x���z�t�z�z�&�)�T�Y�Y�N��N�O�Orc��d}|jdd�}|rd|f}|rL||j|�z}|jj|jdd|j
g|����S|j
|jdd|j
g|����}i}tdt|�d�D],}|jj||d	z�|||d	d<�.|S)
z}Return font metrics.

        For best performance, create a dummy widget
        using this font before calling this method.rWrcNrar/�metricsrr(r)	�popr&r=rir?rr>r)r*)rr rr%rc�resr+s       rrlzFont.metrics�s���
���F�F�;��-�	�� �)�,�D���$�)�)�G�,�,�D��8�8�?�?���
�
�6�9�d�i�i�?�$�?�A�
A��+�+�j�d�j�j���D�I�I�M��M�N�C��G��1�c�#�h��*��&*�h�h�o�o�c�!�A�#�h�&?���A��q�r�
�#�+��Nr)NNNF�NNrB)�__name__rJrK�__doc__�	itertools�countr9r#r&r,r@rDrLrQrUrYr]r_r0rSrer1rhrlrWrrrrsu���*�i�o�o�a� �G�����>�)�A�
�'��/�
M�C�F��I�P�rrc��|�tjd�}d}|rd|f}|jj|jjddg|����S)zGet font families (as a tuple)zuse font.families()rWrar/r	�r3r4r.r6r7)rrcr%s   rr	r	�sU���|��(�(�)>�?��
�D���i�(���7�7���\�T�W�W�\�\�&�*�D�t�D�E�Erc��|�tjd�}|jj|jj	dd��S)z'Get names of defined fonts (as a tuple)zuse font.names()r/r
ru)rs rr
r
�s<���|��(�(�);�<���7�7���T�W�W�\�\�&�'�:�;�;r�__main__�times�)�family�size�weightrzr|�hello�	linespace)rc)�Courier�r
)r/zHello, world)rjr/zQuit!)rj�commandr/)r|rBro)rrr3�__version__�__all__rrrrrrr	r
rp�Tkr�f�printr0rerSrhrl�Label�w�pack�Button�destroyr_�fb�mainlooprWrr�<module>r�s�������6��
����	��	��3�[�[�|F�<��z���7�:�:�<�D�	
�G�"�V�4�A�	�!�(�(�*��	�!�(�(�8�
��	�!�(�(�8�
��	�!�(�(�*��	�!�&�&��
��	�!�&�&��
��	�%�'�N�	�!�)�)�G�
�a�i�i��4�5�	�!�)�)�d�)�
#�$��)�*�A�	�!�)�)�G�
�a�i�i��t�i�D�E���
�
�d��a�8�A��F�F�H�����t�'�4�<�<�@�A��F�F�H�	
�1�V�9�	�	"�	"�	$�B��I�I�T�I���H�H�"�H���G����Gr__pycache__/font.cpython-312.opt-2.pyc000064400000023020151710635150013366 0ustar00�

T��hX����ddlZddlZdZgd�ZdZdZdZdZdd�ZGd	�d
�Z	dd�Z
dd�Zed
k(�r�ej�Ze	dde��Zeej#��eej#d��eej#d��eej%��eej'd��eej'd��ee��eej)d�ej+d��eej+e���e	d��Zeej)d�ej+de���ej,ede��Zej1�ej2edej4��Zej1�e	ed��j7�Zej%e��ej%e��ej:�yy) �Nz0.9)�NORMAL�ROMAN�BOLD�ITALIC�
nametofont�Font�families�names�normal�roman�bold�italicc� �	t|d|��S)NT)�name�exists�root)r)rrs  �%/usr/lib64/python3.12/tkinter/font.pyrrs����T�$�T�2�2�c��eZdZ	ejd�Zd�Zd�Zd�Zdd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zdd�Zd�Zd�ZeZdd�Zd�Zy)r�c��g}|j�D]3\}}|jd|z�|jt|���5t|�S�N�-)�items�append�str�tuple)�self�kw�options�k�vs     r�_setz	Font._set2sG�����H�H�J�D�A�q��N�N�3�q�5�!��N�N�3�q�6�"���W�~�rc�R�g}|D]}|jd|z��t|�Sr)rr)r�argsr r!s    r�_getz	Font._get9s+�����A��N�N�3�q�5�!���W�~�rc�b�i}tdt|�d�D]}||dz|||dd<�|S)Nr�r)�range�len)rr%r �is    r�_mkdictzFont._mkdict?s?�����q�#�d�)�Q�'�A�#'��!��9�G�D��G�A�B�K� �(��rNc��|�tjd�}t|d|�}|r#|j|j	dd|��}n|j|�}|s!dt
t|j��z}||_	|r�d|_
|j|j|j	dd��vr-tjjd|j�d���|rF|jdd	|jg|���n&|jdd
|jg|���d|_
||_
|j|_|j|_y)Nzuse font�tk�font�actualFr
znamed font z does not already exist�	configure�createT)�tkinter�_get_default_root�getattr�	splitlist�callr#r�next�counterr�delete_font�_tkinter�TclError�_tk�_split�_call)rrr/rrr r.s       r�__init__z
Font.__init__Es%���<��,�,�Z�8�D�
�T�4��
&����<�<������$� ?�@�D��9�9�W�%�D���C��T�\�\� 2�3�3�D���	��$�D���y�y����R�W�W�V�W�-E� F�F��&�&�/�/�>B�i�i�I�K�K��������T�Y�Y�>��>�
�B�G�G�F�H�d�i�i�7�$�7�#�D������l�l����g�g��
rc��|jS�N)r�rs r�__str__zFont.__str__ds���y�y�rc�~�d|jj�d|jj�d|j�d�S)N�<�.z object �>)�	__class__�
__module__�__qualname__rrCs r�__repr__z
Font.__repr__gs<���4�>�>�,�,�-�Q�t�~�~�/J�/J�.K��$�)�)��a�)�	)rc��t|t�stS|j|jk(xr|j|jk(SrB)�
isinstancer�NotImplementedrr=)r�others  r�__eq__zFont.__eq__ks7���%��&�!�!��y�y�E�J�J�&�@�4�8�8�u�y�y�+@�@rc�$�|j|�SrB)�cget)r�keys  r�__getitem__zFont.__getitem__ps���y�y��~�rc�,�|jdi||i��y)N�)r1)rrT�values   r�__setitem__zFont.__setitem__ss������&�#�u��&rc�x�	|jr|jdd|j�yy#t$rYywxYw)Nr/�delete)r:r?r�	ExceptionrCs r�__del__zFont.__del__vs;��	�����
�
�6�8�T�Y�Y�7� ���	��	�s�)-�	9�9c�L�	t|jfi|j���SrB)rr=r0rCs r�copyz	Font.copy}s��4��D�H�H�.����
�.�.rc	���	d}|rd|f}|r(|d|zfz}|jdd|jg|���S|j|j|jdd|jg|�����S)NrW�
-displayofrr/r0)r?rr,r>)r�option�	displayofr%s    rr0zFont.actual�s���'���� �)�,�D���3��<�*�*�D��4�:�:�f�h��	�	�A�D�A�A��<�<����J�D�J�J�v�x����J�T�J�K�M�
Mrc�F�	|jdd|jd|z�S)Nr/�configr)r?r)rrbs  rrSz	Font.cget�s"����z�z�&�(�D�I�I�s�6�z�B�Brc	���	|r/|jdd|jg|j|����y|j|j	|jdd|j���S)Nr/re)r?rr#r,r>)rr s  rrezFont.config�sc�� ���D�J�J�v�x����
'��9�9�W�%�
'��<�<����D�J�J�v�x����C�D�F�
Frc��	|f}|rd||f}|jj|jdd|jg|����S)Nrar/�measure)r=�getintr?r)r�textrcr%s    rrhzFont.measure�sF����w��� �)�T�2�D��x�x���z�t�z�z�&�)�T�Y�Y�N��N�O�Orc���	d}|jdd�}|rd|f}|rL||j|�z}|jj|jdd|j
g|����S|j
|jdd|j
g|����}i}tdt|�d�D],}|jj||dz�|||dd<�.|S)	NrWrcrar/�metricsrr(r)	�popr&r=rir?rr>r)r*)rr rr%rc�resr+s       rrlzFont.metrics�s���	7����F�F�;��-�	�� �)�,�D���$�)�)�G�,�,�D��8�8�?�?���
�
�6�9�d�i�i�?�$�?�A�
A��+�+�j�d�j�j���D�I�I�M��M�N�C��G��1�c�#�h��*��&*�h�h�o�o�c�!�A�#�h�&?���A��q�r�
�#�+��Nr)NNNF�NNrB)�__name__rJrK�	itertools�countr9r#r&r,r@rDrLrQrUrYr]r_r0rSrer1rhrlrWrrrrsu���*�i�o�o�a� �G�����>�)�A�
�'��/�
M�C�F��I�P�rrc��	|�tjd�}d}|rd|f}|jj|jjddg|����S)Nzuse font.families()rWrar/r	�r3r4r.r6r7)rrcr%s   rr	r	�sX��$��|��(�(�)>�?��
�D���i�(���7�7���\�T�W�W�\�\�&�*�D�t�D�E�Erc��	|�tjd�}|jj|jj	dd��S)Nzuse font.names()r/r
rt)rs rr
r
�s?��-��|��(�(�);�<���7�7���T�W�W�\�\�&�'�:�;�;r�__main__�times�)�family�size�weightryr{�hello�	linespace)rc)�Courier�r
)r/zHello, world)rjr/zQuit!)rj�commandr/)r{rBro)rqr3�__version__�__all__rrrrrrr	r
rp�Tkr�f�printr0rerSrhrl�Label�w�pack�Button�destroyr_�fb�mainlooprWrr�<module>r�s�������6��
����	��	��3�[�[�|F�<��z���7�:�:�<�D�	
�G�"�V�4�A�	�!�(�(�*��	�!�(�(�8�
��	�!�(�(�8�
��	�!�(�(�*��	�!�&�&��
��	�!�&�&��
��	�%�'�N�	�!�)�)�G�
�a�i�i��4�5�	�!�)�)�d�)�
#�$��)�*�A�	�!�)�)�G�
�a�i�i��t�i�D�E���
�
�d��a�8�A��F�F�H�����t�'�4�<�<�@�A��F�F�H�	
�1�V�9�	�	"�	"�	$�B��I�I�T�I���H�H�"�H���G����Gr__pycache__/font.cpython-312.pyc000064400000025170151710635150012436 0ustar00�

T��hX����ddlZddlZdZgd�ZdZdZdZdZdd�ZGd	�d
�Z	dd�Z
dd�Zed
k(�r�ej�Ze	dde��Zeej#��eej#d��eej#d��eej%��eej'd��eej'd��ee��eej)d�ej+d��eej+e���e	d��Zeej)d�ej+de���ej,ede��Zej1�ej2edej4��Zej1�e	ed��j7�Zej%e��ej%e��ej:�yy) �Nz0.9)�NORMAL�ROMAN�BOLD�ITALIC�
nametofont�Font�families�names�normal�roman�bold�italicc��t|d|��S)zFGiven the name of a tk named font, returns a Font representation.
    T)�name�exists�root)r)rrs  �%/usr/lib64/python3.12/tkinter/font.pyrrs���T�$�T�2�2�c��eZdZdZej
d�Zd�Zd�Zd�Z	dd�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zdd�Zd�Zd�ZeZdd�Zd�Zy)ra�Represents a named font.

    Constructor options are:

    font -- font specifier (name, system font, or (family, size, style)-tuple)
    name -- name to use for this font configuration (defaults to a unique name)
    exists -- does a named font by this name already exist?
       Creates a new named font if False, points to the existing font if True.
       Raises _tkinter.TclError if the assertion is false.

       the following are ignored if font is specified:

    family -- font 'family', e.g. Courier, Times, Helvetica
    size -- font size in points
    weight -- font thickness: NORMAL, BOLD
    slant -- font slant: ROMAN, ITALIC
    underline -- font underlining: false (0), true (1)
    overstrike -- font strikeout: false (0), true (1)

    �c��g}|j�D]3\}}|jd|z�|jt|���5t|�S�N�-)�items�append�str�tuple)�self�kw�options�k�vs     r�_setz	Font._set2sG�����H�H�J�D�A�q��N�N�3�q�5�!��N�N�3�q�6�"���W�~�rc�R�g}|D]}|jd|z��t|�Sr)rr)r�argsr r!s    r�_getz	Font._get9s+�����A��N�N�3�q�5�!���W�~�rc�b�i}tdt|�d�D]}||dz|||dd<�|S)Nr�r)�range�len)rr%r �is    r�_mkdictzFont._mkdict?s?�����q�#�d�)�Q�'�A�#'��!��9�G�D��G�A�B�K� �(��rNc��|�tjd�}t|d|�}|r#|j|j	dd|��}n|j|�}|s!dt
t|j��z}||_	|r�d|_
|j|j|j	dd��vr-tjjd|j�d���|rF|jdd	|jg|���n&|jdd
|jg|���d|_
||_
|j|_|j|_y)Nzuse font�tk�font�actualFr
znamed font z does not already exist�	configure�createT)�tkinter�_get_default_root�getattr�	splitlist�callr#r�next�counterr�delete_font�_tkinter�TclError�_tk�_split�_call)rrr/rrr r.s       r�__init__z
Font.__init__Es%���<��,�,�Z�8�D�
�T�4��
&����<�<������$� ?�@�D��9�9�W�%�D���C��T�\�\� 2�3�3�D���	��$�D���y�y����R�W�W�V�W�-E� F�F��&�&�/�/�>B�i�i�I�K�K��������T�Y�Y�>��>�
�B�G�G�F�H�d�i�i�7�$�7�#�D������l�l����g�g��
rc��|jS�N)r�rs r�__str__zFont.__str__ds���y�y�rc�~�d|jj�d|jj�d|j�d�S)N�<�.z object �>)�	__class__�
__module__�__qualname__rrCs r�__repr__z
Font.__repr__gs<���4�>�>�,�,�-�Q�t�~�~�/J�/J�.K��$�)�)��a�)�	)rc��t|t�stS|j|jk(xr|j|jk(SrB)�
isinstancer�NotImplementedrr=)r�others  r�__eq__zFont.__eq__ks7���%��&�!�!��y�y�E�J�J�&�@�4�8�8�u�y�y�+@�@rc�$�|j|�SrB)�cget)r�keys  r�__getitem__zFont.__getitem__ps���y�y��~�rc�,�|jdi||i��y)N�)r1)rrT�values   r�__setitem__zFont.__setitem__ss������&�#�u��&rc�x�	|jr|jdd|j�yy#t$rYywxYw)Nr/�delete)r:r?r�	ExceptionrCs r�__del__zFont.__del__vs;��	�����
�
�6�8�T�Y�Y�7� ���	��	�s�)-�	9�9c�J�t|jfi|j���S)z*Return a distinct copy of the current font)rr=r0rCs r�copyz	Font.copy}s���D�H�H�.����
�.�.rc	���d}|rd|f}|r(|d|zfz}|jdd|jg|���S|j|j|jdd|jg|�����S)zReturn actual font attributesrW�
-displayofrr/r0)r?rr,r>)r�option�	displayofr%s    rr0zFont.actual�s}����� �)�,�D���3��<�*�*�D��4�:�:�f�h��	�	�A�D�A�A��<�<����J�D�J�J�v�x����J�T�J�K�M�
Mrc�D�|jdd|jd|z�S)zGet font attributer/�configr)r?r)rrbs  rrSz	Font.cget�s���z�z�&�(�D�I�I�s�6�z�B�Brc	���|r/|jdd|jg|j|����y|j|j	|jdd|j���S)zModify font attributesr/reN)r?rr#r,r>)rr s  rrezFont.config�s`����D�J�J�v�x����
'��9�9�W�%�
'��<�<����D�J�J�v�x����C�D�F�
Frc��|f}|rd||f}|jj|jdd|jg|����S)zReturn text widthrar/�measure)r=�getintr?r)r�textrcr%s    rrhzFont.measure�sC���w��� �)�T�2�D��x�x���z�t�z�z�&�)�T�Y�Y�N��N�O�Orc��d}|jdd�}|rd|f}|rL||j|�z}|jj|jdd|j
g|����S|j
|jdd|j
g|����}i}tdt|�d�D],}|jj||d	z�|||d	d<�.|S)
z}Return font metrics.

        For best performance, create a dummy widget
        using this font before calling this method.rWrcNrar/�metricsrr(r)	�popr&r=rir?rr>r)r*)rr rr%rc�resr+s       rrlzFont.metrics�s���
���F�F�;��-�	�� �)�,�D���$�)�)�G�,�,�D��8�8�?�?���
�
�6�9�d�i�i�?�$�?�A�
A��+�+�j�d�j�j���D�I�I�M��M�N�C��G��1�c�#�h��*��&*�h�h�o�o�c�!�A�#�h�&?���A��q�r�
�#�+��Nr)NNNF�NNrB)�__name__rJrK�__doc__�	itertools�countr9r#r&r,r@rDrLrQrUrYr]r_r0rSrer1rhrlrWrrrrsu���*�i�o�o�a� �G�����>�)�A�
�'��/�
M�C�F��I�P�rrc��|�tjd�}d}|rd|f}|jj|jjddg|����S)zGet font families (as a tuple)zuse font.families()rWrar/r	�r3r4r.r6r7)rrcr%s   rr	r	�sU���|��(�(�)>�?��
�D���i�(���7�7���\�T�W�W�\�\�&�*�D�t�D�E�Erc��|�tjd�}|jj|jj	dd��S)z'Get names of defined fonts (as a tuple)zuse font.names()r/r
ru)rs rr
r
�s<���|��(�(�);�<���7�7���T�W�W�\�\�&�'�:�;�;r�__main__�times�)�family�size�weightrzr|�hello�	linespace)rc)�Courier�r
)r/zHello, world)rjr/zQuit!)rj�commandr/)r|rBro)rrr3�__version__�__all__rrrrrrr	r
rp�Tkr�f�printr0rerSrhrl�Label�w�pack�Button�destroyr_�fb�mainlooprWrr�<module>r�s�������6��
����	��	��3�[�[�|F�<��z���7�:�:�<�D�	
�G�"�V�4�A�	�!�(�(�*��	�!�(�(�8�
��	�!�(�(�8�
��	�!�(�(�*��	�!�&�&��
��	�!�&�&��
��	�%�'�N�	�!�)�)�G�
�a�i�i��4�5�	�!�)�)�d�)�
#�$��)�*�A�	�!�)�)�G�
�a�i�i��t�i�D�E���
�
�d��a�8�A��F�F�H�����t�'�4�<�<�@�A��F�F�H�	
�1�V�9�	�	"�	"�	$�B��I�I�T�I���H�H�"�H���G����Gr__pycache__/messagebox.cpython-312.opt-1.pyc000064400000010006151710635150014554 0ustar00�

T��h����ddlmZgd�ZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZGd�de�Zd-d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zedk(r�eded d!��eded d"��eded d#��eded d$��ed%ed d&��ed'ed d(��ed)ed d*��ed+ed d,��yy)/�)�Dialog)�showinfo�showwarning�	showerror�askquestion�askokcancel�askyesno�askyesnocancel�askretrycancel�error�info�question�warning�abortretryignore�ok�okcancel�retrycancel�yesno�yesnocancel�abort�retry�ignore�cancel�yes�noc��eZdZdZdZy)�Messagez
A message box�
tk_messageBoxN)�__name__�
__module__�__qualname__�__doc__�command���+/usr/lib64/python3.12/tkinter/messagebox.pyrr=s
����Gr%rNc���|r	d|vr||d<|r	d|vr||d<|r||d<|r||d<tdi|��j�}t|t�r|rtSt
St
|�S)N�icon�type�title�messager$)r�show�
isinstance�bool�YES�NO�str)r*r+�_icon�_type�options�ress      r&�_showr6Gst����w�&�U�7�6�?���w�&�U�7�6�?��5��� ��W��	�"�
�
�G�
�
!�
!�
#�C��#�t����J��	��s�8�Or%c�0�t||ttfi|��S)zShow an info message)r6�INFO�OK�r*r+r4s   r&rrVs������r�5�W�5�5r%c�0�t||ttfi|��S)zShow a warning message)r6�WARNINGr9r:s   r&rr[s������"�8��8�8r%c�0�t||ttfi|��S)zShow an error message)r6�ERRORr9r:s   r&rr`s�������6�g�6�6r%c�0�t||ttfi|��S)zAsk a question)r6�QUESTION�YESNOr:s   r&rres������5�<�G�<�<r%c�B�t||ttfi|��}|tk(S)z@Ask if operation should proceed; return true if the answer is ok)r6r@�OKCANCELr9�r*r+r4�ss    r&rrjs ��
�e�W�h��<�G�<�A���7�Nr%c�B�t||ttfi|��}|tk(S)z0Ask a question; return true if the answer is yes)r6r@rAr/rDs    r&r	r	ps ��
�e�W�h��9��9�A���8�Or%c�l�t||ttfi|��}t|�}|tk(ry|t
k(S)zDAsk a question; return true if the answer is yes, None if cancelled.N)r6r@�YESNOCANCELr1�CANCELr/rDs    r&r
r
vs3��
�e�W�h��?�w�?�A��A��A��F�{����8�Or%c�B�t||ttfi|��}|tk(S)zDAsk if operation should be retried; return true if the answer is yes)r6r<�RETRYCANCEL�RETRYrDs    r&rr�s!��
�e�W�g�{�>�g�>�A���:�r%�__main__�SpamzEgg InformationzEgg Warningz	Egg Alertz	Question?�proceedzProceed?zyes/nozGot it?z
yes/no/cancelzWant it?z	try againz
Try again?)NNNN)NN)�tkinter.commondialogr�__all__r>r8r@r<�ABORTRETRYIGNOREr9rCrKrArH�ABORTrL�IGNORErIr/r0rr6rrrrrr	r
rr�printr$r%r&�<module>rVs>��2(�/��	��
����
��&��	����������	����	��	��	����	���f���6�
9�
7�
=�
�����z��	�&�(�6�#4�5�6�	�)�[���7�8�	�'�9�V�[�1�2�	�*�k�&�+�6�7�	�)�[���4�5�	�(�H�V�Y�/�0�	�/�>�&�*�=�>�	�+�~�f�l�;�<�r%__pycache__/messagebox.cpython-312.opt-2.pyc000064400000007324151710635150014566 0ustar00�

T��h����ddlmZgd�ZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZGd�de�Zd-d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zedk(r�eded d!��eded d"��eded d#��eded d$��ed%ed d&��ed'ed d(��ed)ed d*��ed+ed d,��yy)/�)�Dialog)�showinfo�showwarning�	showerror�askquestion�askokcancel�askyesno�askyesnocancel�askretrycancel�error�info�question�warning�abortretryignore�ok�okcancel�retrycancel�yesno�yesnocancel�abort�retry�ignore�cancel�yes�noc��eZdZ	dZy)�Message�
tk_messageBoxN)�__name__�
__module__�__qualname__�command���+/usr/lib64/python3.12/tkinter/messagebox.pyrr=s
����Gr$rNc���|r	d|vr||d<|r	d|vr||d<|r||d<|r||d<tdi|��j�}t|t�r|rtSt
St
|�S)N�icon�type�title�messager#)r�show�
isinstance�bool�YES�NO�str)r)r*�_icon�_type�options�ress      r%�_showr5Gst����w�&�U�7�6�?���w�&�U�7�6�?��5��� ��W��	�"�
�
�G�
�
!�
!�
#�C��#�t����J��	��s�8�Or$c�2�	t||ttfi|��S�N)r5�INFO�OK�r)r*r3s   r%rrVs�������r�5�W�5�5r$c�2�	t||ttfi|��Sr7)r5�WARNINGr9r:s   r%rr[s�������"�8��8�8r$c�2�	t||ttfi|��Sr7)r5�ERRORr9r:s   r%rr`s��������6�g�6�6r$c�2�	t||ttfi|��Sr7)r5�QUESTION�YESNOr:s   r%rres�������5�<�G�<�<r$c�D�	t||ttfi|��}|tk(Sr7)r5r@�OKCANCELr9�r)r*r3�ss    r%rrjs#��F�
�e�W�h��<�G�<�A���7�Nr$c�D�	t||ttfi|��}|tk(Sr7)r5r@rAr.rDs    r%r	r	ps#��6�
�e�W�h��9��9�A���8�Or$c�n�	t||ttfi|��}t|�}|tk(ry|t
k(Sr7)r5r@�YESNOCANCELr0�CANCELr.rDs    r%r
r
vs6��J�
�e�W�h��?�w�?�A��A��A��F�{����8�Or$c�D�	t||ttfi|��}|tk(Sr7)r5r<�RETRYCANCEL�RETRYrDs    r%rr�s$��J�
�e�W�g�{�>�g�>�A���:�r$�__main__�SpamzEgg InformationzEgg Warningz	Egg Alertz	Question?�proceedzProceed?zyes/nozGot it?z
yes/no/cancelzWant it?z	try againz
Try again?)NNNN)NN)�tkinter.commondialogr�__all__r>r8r@r<�ABORTRETRYIGNOREr9rCrKrArH�ABORTrL�IGNORErIr.r/rr5rrrrrr	r
rr�printr#r$r%�<module>rVs>��2(�/��	��
����
��&��	����������	����	��	��	����	���f���6�
9�
7�
=�
�����z��	�&�(�6�#4�5�6�	�)�[���7�8�	�'�9�V�[�1�2�	�*�k�&�+�6�7�	�)�[���4�5�	�(�H�V�Y�/�0�	�/�>�&�*�=�>�	�+�~�f�l�;�<�r$__pycache__/messagebox.cpython-312.pyc000064400000010006151710635150013615 0ustar00�

T��h����ddlmZgd�ZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZGd�de�Zd-d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zd.d�Zedk(r�eded d!��eded d"��eded d#��eded d$��ed%ed d&��ed'ed d(��ed)ed d*��ed+ed d,��yy)/�)�Dialog)�showinfo�showwarning�	showerror�askquestion�askokcancel�askyesno�askyesnocancel�askretrycancel�error�info�question�warning�abortretryignore�ok�okcancel�retrycancel�yesno�yesnocancel�abort�retry�ignore�cancel�yes�noc��eZdZdZdZy)�Messagez
A message box�
tk_messageBoxN)�__name__�
__module__�__qualname__�__doc__�command���+/usr/lib64/python3.12/tkinter/messagebox.pyrr=s
����Gr%rNc���|r	d|vr||d<|r	d|vr||d<|r||d<|r||d<tdi|��j�}t|t�r|rtSt
St
|�S)N�icon�type�title�messager$)r�show�
isinstance�bool�YES�NO�str)r*r+�_icon�_type�options�ress      r&�_showr6Gst����w�&�U�7�6�?���w�&�U�7�6�?��5��� ��W��	�"�
�
�G�
�
!�
!�
#�C��#�t����J��	��s�8�Or%c�0�t||ttfi|��S)zShow an info message)r6�INFO�OK�r*r+r4s   r&rrVs������r�5�W�5�5r%c�0�t||ttfi|��S)zShow a warning message)r6�WARNINGr9r:s   r&rr[s������"�8��8�8r%c�0�t||ttfi|��S)zShow an error message)r6�ERRORr9r:s   r&rr`s�������6�g�6�6r%c�0�t||ttfi|��S)zAsk a question)r6�QUESTION�YESNOr:s   r&rres������5�<�G�<�<r%c�B�t||ttfi|��}|tk(S)z@Ask if operation should proceed; return true if the answer is ok)r6r@�OKCANCELr9�r*r+r4�ss    r&rrjs ��
�e�W�h��<�G�<�A���7�Nr%c�B�t||ttfi|��}|tk(S)z0Ask a question; return true if the answer is yes)r6r@rAr/rDs    r&r	r	ps ��
�e�W�h��9��9�A���8�Or%c�l�t||ttfi|��}t|�}|tk(ry|t
k(S)zDAsk a question; return true if the answer is yes, None if cancelled.N)r6r@�YESNOCANCELr1�CANCELr/rDs    r&r
r
vs3��
�e�W�h��?�w�?�A��A��A��F�{����8�Or%c�B�t||ttfi|��}|tk(S)zDAsk if operation should be retried; return true if the answer is yes)r6r<�RETRYCANCEL�RETRYrDs    r&rr�s!��
�e�W�g�{�>�g�>�A���:�r%�__main__�SpamzEgg InformationzEgg Warningz	Egg Alertz	Question?�proceedzProceed?zyes/nozGot it?z
yes/no/cancelzWant it?z	try againz
Try again?)NNNN)NN)�tkinter.commondialogr�__all__r>r8r@r<�ABORTRETRYIGNOREr9rCrKrArH�ABORTrL�IGNORErIr/r0rr6rrrrrr	r
rr�printr$r%r&�<module>rVs>��2(�/��	��
����
��&��	����������	����	��	��	����	���f���6�
9�
7�
=�
�����z��	�&�(�6�#4�5�6�	�)�[���7�8�	�'�9�V�[�1�2�	�*�k�&�+�6�7�	�)�[���4�5�	�(�H�V�Y�/�0�	�/�>�&�*�=�>�	�+�~�f�l�;�<�r%__pycache__/scrolledtext.cpython-312.opt-1.pyc000064400000006376151710635150015152 0ustar00�

T��h��|�dZddlmZmZmZmZmZmZddlm	Z	m
Z
mZmZdgZ
Gd�de�Zd�Zedk(re�yy)	aA ScrolledText widget feels like a text widget but also has a
vertical scroll bar on its right.  (Later, options may be added to
add a horizontal bar as well, to make the bars disappear
automatically when not needed, to move them to the other side of the
window, etc.)

Configuration options are passed to the Text widget.
A Frame widget is inserted between the master and the text, to hold
the Scrollbar widget.
Most methods calls are inherited from the Text widget; Pack, Grid and
Place methods are redirected to the Frame widget however.
�)�Frame�Text�	Scrollbar�Pack�Grid�Place)�RIGHT�LEFT�Y�BOTH�ScrolledTextc��eZdZdd�Zd�Zy)r
Nc	�$�t|�|_t|j�|_|jj	t
t��|jd|jji�tj||jfi|��|j	ttd��|j|jd<tt�j�}tt �j�tt"�j�ztt$�j�z}|j'|�}|D]8}|ddk7s�|dk7s�|d	k7s�t)||t+|j|���:y)
N)�side�fill�yscrollcommandT)rr�expand�commandr�_�config�	configure)r�framer�vbar�packr	r�update�setr�__init__r
r�yview�vars�keysrrr�
difference�setattr�getattr)�self�master�kw�
text_meths�methods�ms      �-/usr/lib64/python3.12/tkinter/scrolledtext.pyrzScrolledText.__init__s���6�]��
��d�j�j�)��	��	�	���E���*�
�	�	�#�T�Y�Y�]�]�3�4��
�
�d�D�J�J�-�"�-��	�	�t�$�t�	�4�#�z�z��	�	�)���$�Z�_�_�&�
��t�*�/�/�#�d�4�j�o�o�&7�7�$�u�+�:J�:J�:L�L���$�$�Z�0���A���t�s�{�q�H�}��k�1A���a�����Q�!7�8��c�,�t|j�S�N)�strr)r$s r*�__str__zScrolledText.__str__)s���4�:�:��r+r-)�__name__�
__module__�__qualname__rr/�r+r*r
r
s��9�(r+c���ddlm}tdd��}|j|t�|jttd��|j�|j�y)Nr)�END�white�
)�bg�heightT)rrr)
�tkinter.constantsr5r
�insert�__doc__rrr
�	focus_set�mainloop)r5�stexts  r*�exampler@-sE��%��G�B�/�E�	�L�L��g��	�J�J�D�t�D�J�1�	�O�O��	�N�N�r+�__main__N)r<�tkinterrrrrrrr:r	r
rr�__all__r
r@r0r3r+r*�<module>rDsE���>�=�2�2��
���4��2��z���I�r+__pycache__/scrolledtext.cpython-312.opt-2.pyc000064400000005325151710635150015144 0ustar00�

T��h��z�	ddlmZmZmZmZmZmZddlmZm	Z	m
Z
mZdgZGd�de�Z
d�Zedk(re�yy)�)�Frame�Text�	Scrollbar�Pack�Grid�Place)�RIGHT�LEFT�Y�BOTH�ScrolledTextc��eZdZdd�Zd�Zy)r
Nc	�$�t|�|_t|j�|_|jj	t
t��|jd|jji�tj||jfi|��|j	ttd��|j|jd<tt�j�}tt �j�tt"�j�ztt$�j�z}|j'|�}|D]8}|ddk7s�|dk7s�|d	k7s�t)||t+|j|���:y)
N)�side�fill�yscrollcommandT)rr�expand�commandr�_�config�	configure)r�framer�vbar�packr	r�update�setr�__init__r
r�yview�vars�keysrrr�
difference�setattr�getattr)�self�master�kw�
text_meths�methods�ms      �-/usr/lib64/python3.12/tkinter/scrolledtext.pyrzScrolledText.__init__s���6�]��
��d�j�j�)��	��	�	���E���*�
�	�	�#�T�Y�Y�]�]�3�4��
�
�d�D�J�J�-�"�-��	�	�t�$�t�	�4�#�z�z��	�	�)���$�Z�_�_�&�
��t�*�/�/�#�d�4�j�o�o�&7�7�$�u�+�:J�:J�:L�L���$�$�Z�0���A���t�s�{�q�H�}��k�1A���a�����Q�!7�8��c�,�t|j�S�N)�strr)r$s r*�__str__zScrolledText.__str__)s���4�:�:��r+r-)�__name__�
__module__�__qualname__rr/�r+r*r
r
s��9�(r+c���ddlm}tdd��}|j|t�|jttd��|j�|j�y)Nr)�END�white�
)�bg�heightT)rrr)
�tkinter.constantsr5r
�insert�__doc__rrr
�	focus_set�mainloop)r5�stexts  r*�exampler@-sE��%��G�B�/�E�	�L�L��g��	�J�J�D�t�D�J�1�	�O�O��	�N�N�r+�__main__N)�tkinterrrrrrrr:r	r
rr�__all__r
r@r0r3r+r*�<module>rDsE���>�=�2�2��
���4��2��z���I�r+__pycache__/simpledialog.cpython-312.opt-1.pyc000064400000042202151710635150015073 0ustar00�

T��h�-����dZddl�ddlmZmZddlmZGd�d�ZGd�de�Zdd
�Zd�Z	Gd�d
e�Z
Gd�de
�Zd�ZGd�de
�Z
d�ZGd�de
�Zd�Zedk(rd�Ze�y	y	)a&This modules handles dialog boxes.

It contains the following public symbols:

SimpleDialog -- A simple but flexible modal dialog box

Dialog -- a base class for dialogs

askinteger -- get an integer from the user

askfloat -- get a float from the user

askstring -- get a string from the user
�)�*)�_get_temp_root�_destroy_temp_root)�
messageboxc�8�eZdZdgddddfd�Zd�Zd�Zd�Zd�Zy)�SimpleDialog�Nc���|rt||��|_nt|�|_|r6|jj|�|jj|�t	|j�t|j|d��|_|jjdt��t|j�|_
|jj�||_||_||_
|jjd|j�t!t#|��D][}||}	t%|j|	||fd���}
||k(r|
j't(d	�
�|
jt*td���]|jj-d|j.�|jj1|�t3|j|�y)
N)�class_i�)�text�aspect�)�expand�fill�<Return>c�$�|j|�S�N)�done��self�nums  �-/usr/lib64/python3.12/tkinter/simpledialog.py�<lambda>z'SimpleDialog.__init__.<locals>.<lambda>9s��4�9�9�S�>��r�command�)�relief�borderwidth)�siderr�WM_DELETE_WINDOW)�Toplevel�root�title�iconname�
_setup_dialog�Message�message�pack�BOTH�Frame�framer�cancel�default�bind�return_event�range�len�Button�config�RIDGE�LEFT�protocol�wm_delete_window�	transient�
_place_window)r�masterr�buttonsr.r-r$rr�s�bs           r�__init__zSimpleDialog.__init__!se��� ���7�D�I� ��(�D�I���I�I�O�O�E�"��I�I���u�%��d�i�i� ��t�y�y�t�C�@�����������.��4�9�9�%��
��
�
��������������	�	���z�4�#4�#4�5���W��&�C����A��t�z�z��,0�c� I�L�A��g�~�����1��5�
�F�F��4��F�2�
'�	
�	�	���-�t�/D�/D�E��	�	���F�#��d�i�i��(rc���|jj�|jj�|jj�|jj	�|j
Sr)r#�wait_visibility�grab_set�mainloop�destroyr�rs r�gozSimpleDialog.goAsK���	�	�!�!�#��	�	�����	�	�����	�	�����x�x�rc��|j�|jj�y|j|j�yr)r.r#�bellr�r�events  rr0zSimpleDialog.return_eventHs*���<�<���I�I�N�N���I�I�d�l�l�#rc��|j�|jj�y|j|j�yr)r-r#rHrrEs rr8zSimpleDialog.wm_delete_windowNs*���;�;���I�I�N�N���I�I�d�k�k�"rc�F�||_|jj�yr)rr#�quitrs  rrzSimpleDialog.doneTs������	�	���r)�__name__�
__module__�__qualname__r?rFr0r8r�rrrrs,���"�d�4��D�)�@�$�#�rrc�F�eZdZdZdd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zy)�DialogzZClass to open dialogs.

    This class is intended as a base class for custom dialogs
    Nc��|}|�
t�}tj||�|j�|�!|j	�r|j|�|r|j
|�t|�||_d|_	t|�}|j|�|_|jdd��|j�|j�||_|jd|j �t#||�|jj%�|j'�|j)�|j+|�y)z�Initialize a dialog.

        Arguments:

            parent -- a parent window (the application window)

            title -- the dialog title
        N�)�padx�padyr!)rr"r?�withdraw�winfo_viewabler9r$r&�parent�resultr+�body�
initial_focusr)�	buttonboxr7r-r:�	focus_setrArB�wait_window)rrZr$r;r\s     rr?zDialog.__init__`s�����>�#�%�F����$��'��
�
����&�"7�"7�"9��N�N�6�"���J�J�u���d���������T�{��!�Y�Y�t�_����	�	�q�q�	�!��������%�!%�D���
�
�(�$�+�+�6��d�F�#����$�$�&�	
�����
�
������rc�f�d|_tj|�t|j�y)zDestroy the windowN)r]r"rDrr;rEs rrDzDialog.destroy�s$��!���������4�;�;�'rc��y)z�create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        NrQ)rr;s  rr\zDialog.body����	
rc�x�t|�}t|dd|jt��}|j	t
dd��t|dd|j��}|j	t
dd��|jd|j�|jd	|j�|j	�y
)z[add standard button box.

        override if you do not want the standard buttons
        �OK�
)r�widthrr.rU)r rVrW�Cancel)rrgrrz<Escape>N)r+r3�ok�ACTIVEr)r6r-r/)r�box�ws   rr^zDialog.buttonbox�s����D�k���3�T��T�W�W�f�M��	���D�q�q��)��3�X�R����E��	���D�q�q��)��	�	�*�d�g�g�&��	�	�*�d�k�k�*����
rc��|j�s|jj�y|j�|j	�	|j�|j
�y#|j
�wxYwr)�validater]r_rX�update_idletasks�applyr-rIs  rriz	Dialog.ok�sV���}�}�����(�(�*���
�
������	��J�J�L��K�K�M��D�K�K�M�s�
A.�.Bc�p�|j�|jj�|j�yr)rZr_rDrIs  rr-z
Dialog.cancel�s'���;�;�"��K�K�!�!�#����rc��y)z�validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        rrQrEs rrnzDialog.validate�s��rc��y)z�process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        NrQrEs rrpzDialog.apply�rcrr)rNrOrP�__doc__r?rDr\r^rir-rnrprQrrrSrSYs0���
1�f(�
��*���
rrSNc�<�|j�|j�|j�}|j�}|j	�}|j�}|��|j
�r�|j�|j�|z
dzz}|j�|j�|z
dzz}|j�}|j�}	t|||z|z
�}t||�}t||	|z|z
�}t||	�}|jdk(r9t|d�}n,|j!�|z
dz}|j#�|z
dz}|j%||�|j'd||fz�|j)�y)N��aqua�z+%d+%d)�wm_withdrawro�winfo_reqwidth�winfo_reqheight�winfo_vrootwidth�winfo_vrootheight�winfo_ismapped�winfo_rootx�winfo_width�winfo_rooty�winfo_height�winfo_vrootx�winfo_vrooty�min�max�_windowingsystem�winfo_screenwidth�winfo_screenheight�
wm_maxsize�wm_geometry�wm_deiconify)
rlrZ�minwidth�	minheight�maxwidth�	maxheight�x�y�vrootx�vrootys
          rr:r:�s|���M�M�O��������!�H��!�!�#�I��!�!�#�H��#�#�%�I�
��f�3�3�5���� �F�$6�$6�$8�8�$C��#I�I����� �F�$7�$7�$9�I�$E�!�#K�K�����!�����!����6�H�$�x�/�0����6�N����6�I�%�	�1�2����6�N������'��A�r�
�A�
�
 �
 �
"�X�
-�!�3��
�
!�
!�
#�i�
/�A�5���L�L��9�%��M�M�(�a��V�#�$��N�N�rc��|jdk(r |jjdd|dd�y|jdk(r|jdd�yy)	Nrwz!::tk::unsupported::MacWindowStyle�style�
moveableModalr	�x11z-type�dialog)r��tk�call�
wm_attributes)rls rr&r&sM�����V�#�	���	�	�5�w��_�b�	*�	
�	�	�u�	$�	�����*�
%rc�,�eZdZ			dd�Zd�Zd�Zd�Zy)�_QueryDialogNc�j�||_||_||_||_tj|||�yr)�prompt�minvalue�maxvalue�initialvaluerSr?)rr$r�r�r�r�rZs       rr?z_QueryDialog.__init__s1��
��� ��
� ��
�(�������f�e�,rc�<�d|_tj|�yr)�entryrSrDrEs rrDz_QueryDialog.destroys����
����t�rc��t||jt��}|jddt��t|d��|_|jjddttz��|j�F|jjd|j�|jjdt�|jS)N)r�justifyrrU)�rowrV�stickyr�)�namer)�Labelr�r6�grid�W�Entryr��Er��insert�select_range�END)rr;rls   rr\z_QueryDialog.body!s����&�t�{�{�D�9��	���1�1�Q��'��6��0��
��
�
���A�A�a��c��2����(��J�J���a��!2�!2�3��J�J�#�#�A�s�+��z�z�rc��	|j�}|j
�5||j
kr&tjdd|j
z|��y|j�5||jkDr&tjdd|jz|��y||_y	#t$r(tjd|jdz|��YywxYw)
Nz
Illegal valuez
Please try again)rZrz	Too smallz2The allowed minimum value is %s. Please try again.z	Too largez2The allowed maximum value is %s. Please try again.r)�	getresult�
ValueErrorr�showwarning�errormessager�r�r[)rr[s  rrnz_QueryDialog.validate/s���	��^�^�%�F��=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
���=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
�������9�	��"�"���!�!�$8�8��
�
�
	�s�B�.C
�C
)NNNN)rNrOrPr?rDr\rnrQrrr�r�s!��#�-1��-���rr�c��eZdZdZd�Zy)�
_QueryIntegerzNot an integer.c�T�|j|jj��Sr)�getintr��getrEs rr�z_QueryInteger.getresultTs���{�{�4�:�:�>�>�+�,�,rN�rNrOrPr�r�rQrrr�r�Qs��$�L�-rr�c�4�t||fi|��}|jS)z�get an integer from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is an integer
    )r�r[�r$r��kw�ds    r�
askintegerr�Xs��	�e�V�*�r�*�A��8�8�Orc��eZdZdZd�Zy)�_QueryFloatzNot a floating-point value.c�T�|j|jj��Sr)�	getdoubler�r�rEs rr�z_QueryFloat.getresultjs���~�~�d�j�j�n�n�.�/�/rNr�rQrrr�r�gs��0�L�0rr�c�4�t||fi|��}|jS)z�get a float from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a float
    )r�r[r�s    r�askfloatr�ns��	�E�6�(�R�(�A��8�8�Orc��eZdZd�Zd�Zd�Zy)�_QueryStringc�h�d|vr|d|_|d=nd|_tj|g|��i|��y)N�show)�_QueryString__showr�r?)r�argsr�s   rr?z_QueryString.__init__~s:���R�<��V�*�D�K��6�
��D�K����d�0�T�0�R�0rc��tj||�}|j�|j|j��|S)N)r�)r�r\r��	configure)rr;r�s   rr\z_QueryString.body�s5���!�!�$��/���;�;�"��O�O����O�-��rc�6�|jj�Sr)r�r�rEs rr�z_QueryString.getresult�s���z�z�~�~��rN)rNrOrPr?r\r�rQrrr�r�}s��1�� rr�c�4�t||fi|��}|jS)z�get a string from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a string
    )r�r[r�s    r�	askstringr��s��	�U�F�)�b�)�A��8�8�Or�__main__c���t�}|fd�}t|d|��}|j�t|d|j��}|j�|j	�y)Nc���t|dgd�ddd��}t|j��ttddd	�
��tt	dddd
���ttdd��y)Nz�This is a test dialog.  Would this have been an actual dialog, the buttons below would have been glowing in soft pink light.
Do you believe this?)�Yes�NorhrrvzTest Dialog)rr<r.r-r$�Spamz	Egg count�)r�zEgg weight
(in tons)r�d)r�r�z	Egg label)r�printrFr�r�r�)r#r�s  r�doitztest.<locals>.doit�si���T�5�
"9�!"� !�,�	.�A�
�!�$�$�&�M��*�V�[�u�E�F��(�6�#:�Q�$'�)�
*��)�F�K�0�1r�Testr�Quit)�Tkr3r)rMrC)r#r��t�qs    r�testr��sN���t���	2� 
�4�f�d�3��	�����4�f�a�f�f�5��	����	�
�
�rr)rt�tkinterrrrrr"rSr:r&r�r�r�r�r�r�r�rNr�rQrr�<module>r�s���
��6��7�7�tI
�X�I
�\�:+�@�6�@�F-�L�-��0�,�0�� �<� �&��z���0	�F�5r__pycache__/simpledialog.cpython-312.opt-2.pyc000064400000037010151710635150015075 0ustar00�

T��h�-����	ddl�ddlmZmZddlmZGd�d�ZGd�de�Zdd	�Zd
�ZGd�de�Z	Gd
�de	�Z
d�ZGd�de	�Zd�Z
Gd�de	�Zd�Zedk(rd�Ze�yy)�)�*)�_get_temp_root�_destroy_temp_root)�
messageboxc�8�eZdZdgddddfd�Zd�Zd�Zd�Zd�Zy)�SimpleDialog�Nc���|rt||��|_nt|�|_|r6|jj|�|jj|�t	|j�t|j|d��|_|jjdt��t|j�|_
|jj�||_||_||_
|jjd|j�t!t#|��D][}||}	t%|j|	||fd���}
||k(r|
j't(d	�
�|
jt*td���]|jj-d|j.�|jj1|�t3|j|�y)
N)�class_i�)�text�aspect�)�expand�fill�<Return>c�$�|j|�S�N)�done��self�nums  �-/usr/lib64/python3.12/tkinter/simpledialog.py�<lambda>z'SimpleDialog.__init__.<locals>.<lambda>9s��4�9�9�S�>��r�command�)�relief�borderwidth)�siderr�WM_DELETE_WINDOW)�Toplevel�root�title�iconname�
_setup_dialog�Message�message�pack�BOTH�Frame�framer�cancel�default�bind�return_event�range�len�Button�config�RIDGE�LEFT�protocol�wm_delete_window�	transient�
_place_window)r�masterr�buttonsr.r-r$rr�s�bs           r�__init__zSimpleDialog.__init__!se��� ���7�D�I� ��(�D�I���I�I�O�O�E�"��I�I���u�%��d�i�i� ��t�y�y�t�C�@�����������.��4�9�9�%��
��
�
��������������	�	���z�4�#4�#4�5���W��&�C����A��t�z�z��,0�c� I�L�A��g�~�����1��5�
�F�F��4��F�2�
'�	
�	�	���-�t�/D�/D�E��	�	���F�#��d�i�i��(rc���|jj�|jj�|jj�|jj	�|j
Sr)r#�wait_visibility�grab_set�mainloop�destroyr�rs r�gozSimpleDialog.goAsK���	�	�!�!�#��	�	�����	�	�����	�	�����x�x�rc��|j�|jj�y|j|j�yr)r.r#�bellr�r�events  rr0zSimpleDialog.return_eventHs*���<�<���I�I�N�N���I�I�d�l�l�#rc��|j�|jj�y|j|j�yr)r-r#rHrrEs rr8zSimpleDialog.wm_delete_windowNs*���;�;���I�I�N�N���I�I�d�k�k�"rc�F�||_|jj�yr)rr#�quitrs  rrzSimpleDialog.doneTs������	�	���r)�__name__�
__module__�__qualname__r?rFr0r8r�rrrrs,���"�d�4��D�)�@�$�#�rrc�D�eZdZ	d
d�Zd�Zd�Zd�Zd
d�Zd
d�Zd�Z	d	�Z
y)�DialogNc��	|}|�
t�}tj||�|j�|�!|j	�r|j|�|r|j
|�t|�||_d|_	t|�}|j|�|_|jdd��|j�|j�||_|jd|j �t#||�|jj%�|j'�|j)�|j+|�y)N�)�padx�padyr!)rr"r?�withdraw�winfo_viewabler9r$r&�parent�resultr+�body�
initial_focusr)�	buttonboxr7r-r:�	focus_setrArB�wait_window)rrZr$r;r\s     rr?zDialog.__init__`s��	����>�#�%�F����$��'��
�
����&�"7�"7�"9��N�N�6�"���J�J�u���d���������T�{��!�Y�Y�t�_����	�	�q�q�	�!��������%�!%�D���
�
�(�$�+�+�6��d�F�#����$�$�&�	
�����
�
������rc�h�	d|_tj|�t|j�yr)r]r"rDrr;rEs rrDzDialog.destroy�s'�� �!���������4�;�;�'rc��	yrrQ)rr;s  rr\zDialog.body�s��	�	
rc�z�	t|�}t|dd|jt��}|j	t
dd��t|dd|j��}|j	t
dd��|jd|j�|jd	|j�|j	�y)
N�OK�
)r�widthrr.rU)r rVrW�Cancel)rrfrrz<Escape>)r+r3�ok�ACTIVEr)r6r-r/)r�box�ws   rr^zDialog.buttonbox�s���	�
�D�k���3�T��T�W�W�f�M��	���D�q�q��)��3�X�R����E��	���D�q�q��)��	�	�*�d�g�g�&��	�	�*�d�k�k�*����
rc��|j�s|jj�y|j�|j	�	|j�|j
�y#|j
�wxYwr)�validater]r_rX�update_idletasks�applyr-rIs  rrhz	Dialog.ok�sV���}�}�����(�(�*���
�
������	��J�J�L��K�K�M��D�K�K�M�s�
A.�.Bc�p�|j�|jj�|j�yr)rZr_rDrIs  rr-z
Dialog.cancel�s'���;�;�"��K�K�!�!�#����rc��	y)NrrQrEs rrmzDialog.validate�s��	�rc��	yrrQrEs rrozDialog.apply�s��	�	
rr)rNrOrPr?rDr\r^rhr-rmrorQrrrSrSYs0���
1�f(�
��*���
rrSNc�<�|j�|j�|j�}|j�}|j	�}|j�}|��|j
�r�|j�|j�|z
dzz}|j�|j�|z
dzz}|j�}|j�}	t|||z|z
�}t||�}t||	|z|z
�}t||	�}|jdk(r9t|d�}n,|j!�|z
dz}|j#�|z
dz}|j%||�|j'd||fz�|j)�y)N��aqua�z+%d+%d)�wm_withdrawrn�winfo_reqwidth�winfo_reqheight�winfo_vrootwidth�winfo_vrootheight�winfo_ismapped�winfo_rootx�winfo_width�winfo_rooty�winfo_height�winfo_vrootx�winfo_vrooty�min�max�_windowingsystem�winfo_screenwidth�winfo_screenheight�
wm_maxsize�wm_geometry�wm_deiconify)
rkrZ�minwidth�	minheight�maxwidth�	maxheight�x�y�vrootx�vrootys
          rr:r:�s|���M�M�O��������!�H��!�!�#�I��!�!�#�H��#�#�%�I�
��f�3�3�5���� �F�$6�$6�$8�8�$C��#I�I����� �F�$7�$7�$9�I�$E�!�#K�K�����!�����!����6�H�$�x�/�0����6�N����6�I�%�	�1�2����6�N������'��A�r�
�A�
�
 �
 �
"�X�
-�!�3��
�
!�
!�
#�i�
/�A�5���L�L��9�%��M�M�(�a��V�#�$��N�N�rc��|jdk(r |jjdd|dd�y|jdk(r|jdd�yy)	Nruz!::tk::unsupported::MacWindowStyle�style�
moveableModalr	�x11z-type�dialog)r��tk�call�
wm_attributes)rks rr&r&sM�����V�#�	���	�	�5�w��_�b�	*�	
�	�	�u�	$�	�����*�
%rc�,�eZdZ			dd�Zd�Zd�Zd�Zy)�_QueryDialogNc�j�||_||_||_||_tj|||�yr)�prompt�minvalue�maxvalue�initialvaluerSr?)rr$r�r�r�r�rZs       rr?z_QueryDialog.__init__s1��
��� ��
� ��
�(�������f�e�,rc�<�d|_tj|�yr)�entryrSrDrEs rrDz_QueryDialog.destroys����
����t�rc��t||jt��}|jddt��t|d��|_|jjddttz��|j�F|jjd|j�|jjdt�|jS)N)r�justifyrrU)�rowrV�stickyr�)�namer)�Labelr�r6�grid�W�Entryr��Er��insert�select_range�END)rr;rks   rr\z_QueryDialog.body!s����&�t�{�{�D�9��	���1�1�Q��'��6��0��
��
�
���A�A�a��c��2����(��J�J���a��!2�!2�3��J�J�#�#�A�s�+��z�z�rc��	|j�}|j
�5||j
kr&tjdd|j
z|��y|j�5||jkDr&tjdd|jz|��y||_y	#t$r(tjd|jdz|��YywxYw)
Nz
Illegal valuez
Please try again)rZrz	Too smallz2The allowed minimum value is %s. Please try again.z	Too largez2The allowed maximum value is %s. Please try again.r)�	getresult�
ValueErrorr�showwarning�errormessager�r�r[)rr[s  rrmz_QueryDialog.validate/s���	��^�^�%�F��=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
���=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
�������9�	��"�"���!�!�$8�8��
�
�
	�s�B�.C
�C
)NNNN)rNrOrPr?rDr\rmrQrrr�r�s!��#�-1��-���rr�c��eZdZdZd�Zy)�
_QueryIntegerzNot an integer.c�T�|j|jj��Sr)�getintr��getrEs rr�z_QueryInteger.getresultTs���{�{�4�:�:�>�>�+�,�,rN�rNrOrPr�r�rQrrr�r�Qs��$�L�-rr�c�6�	t||fi|��}|jSr)r�r[�r$r��kw�ds    r�
askintegerr�Xs#��	�	�e�V�*�r�*�A��8�8�Orc��eZdZdZd�Zy)�_QueryFloatzNot a floating-point value.c�T�|j|jj��Sr)�	getdoubler�r�rEs rr�z_QueryFloat.getresultjs���~�~�d�j�j�n�n�.�/�/rNr�rQrrr�r�gs��0�L�0rr�c�6�	t||fi|��}|jSr)r�r[r�s    r�askfloatr�ns#��	�	�E�6�(�R�(�A��8�8�Orc��eZdZd�Zd�Zd�Zy)�_QueryStringc�h�d|vr|d|_|d=nd|_tj|g|��i|��y)N�show)�_QueryString__showr�r?)r�argsr�s   rr?z_QueryString.__init__~s:���R�<��V�*�D�K��6�
��D�K����d�0�T�0�R�0rc��tj||�}|j�|j|j��|S)N)r�)r�r\r��	configure)rr;r�s   rr\z_QueryString.body�s5���!�!�$��/���;�;�"��O�O����O�-��rc�6�|jj�Sr)r�r�rEs rr�z_QueryString.getresult�s���z�z�~�~��rN)rNrOrPr?r\r�rQrrr�r�}s��1�� rr�c�6�	t||fi|��}|jSr)r�r[r�s    r�	askstringr��s#��	�	�U�F�)�b�)�A��8�8�Or�__main__c���t�}|fd�}t|d|��}|j�t|d|j��}|j�|j	�y)Nc���t|dgd�ddd��}t|j��ttddd	�
��tt	dddd
���ttdd��y)Nz�This is a test dialog.  Would this have been an actual dialog, the buttons below would have been glowing in soft pink light.
Do you believe this?)�Yes�NorgrrtzTest Dialog)rr<r.r-r$�Spamz	Egg count�)r�zEgg weight
(in tons)r�d)r�r�z	Egg label)r�printrFr�r�r�)r#r�s  r�doitztest.<locals>.doit�si���T�5�
"9�!"� !�,�	.�A�
�!�$�$�&�M��*�V�[�u�E�F��(�6�#:�Q�$'�)�
*��)�F�K�0�1r�Testr�Quit)�Tkr3r)rMrC)r#r��t�qs    r�testr��sN���t���	2� 
�4�f�d�3��	�����4�f�a�f�f�5��	����	�
�
�rr)�tkinterrrrrr"rSr:r&r�r�r�r�r�r�r�rNr�rQrr�<module>r�s���
��6��7�7�tI
�X�I
�\�:+�@�6�@�F-�L�-��0�,�0�� �<� �&��z���0	�F�5r__pycache__/simpledialog.cpython-312.pyc000064400000042202151710635150014134 0ustar00�

T��h�-����dZddl�ddlmZmZddlmZGd�d�ZGd�de�Zdd
�Zd�Z	Gd�d
e�Z
Gd�de
�Zd�ZGd�de
�Z
d�ZGd�de
�Zd�Zedk(rd�Ze�y	y	)a&This modules handles dialog boxes.

It contains the following public symbols:

SimpleDialog -- A simple but flexible modal dialog box

Dialog -- a base class for dialogs

askinteger -- get an integer from the user

askfloat -- get a float from the user

askstring -- get a string from the user
�)�*)�_get_temp_root�_destroy_temp_root)�
messageboxc�8�eZdZdgddddfd�Zd�Zd�Zd�Zd�Zy)�SimpleDialog�Nc���|rt||��|_nt|�|_|r6|jj|�|jj|�t	|j�t|j|d��|_|jjdt��t|j�|_
|jj�||_||_||_
|jjd|j�t!t#|��D][}||}	t%|j|	||fd���}
||k(r|
j't(d	�
�|
jt*td���]|jj-d|j.�|jj1|�t3|j|�y)
N)�class_i�)�text�aspect�)�expand�fill�<Return>c�$�|j|�S�N)�done��self�nums  �-/usr/lib64/python3.12/tkinter/simpledialog.py�<lambda>z'SimpleDialog.__init__.<locals>.<lambda>9s��4�9�9�S�>��r�command�)�relief�borderwidth)�siderr�WM_DELETE_WINDOW)�Toplevel�root�title�iconname�
_setup_dialog�Message�message�pack�BOTH�Frame�framer�cancel�default�bind�return_event�range�len�Button�config�RIDGE�LEFT�protocol�wm_delete_window�	transient�
_place_window)r�masterr�buttonsr.r-r$rr�s�bs           r�__init__zSimpleDialog.__init__!se��� ���7�D�I� ��(�D�I���I�I�O�O�E�"��I�I���u�%��d�i�i� ��t�y�y�t�C�@�����������.��4�9�9�%��
��
�
��������������	�	���z�4�#4�#4�5���W��&�C����A��t�z�z��,0�c� I�L�A��g�~�����1��5�
�F�F��4��F�2�
'�	
�	�	���-�t�/D�/D�E��	�	���F�#��d�i�i��(rc���|jj�|jj�|jj�|jj	�|j
Sr)r#�wait_visibility�grab_set�mainloop�destroyr�rs r�gozSimpleDialog.goAsK���	�	�!�!�#��	�	�����	�	�����	�	�����x�x�rc��|j�|jj�y|j|j�yr)r.r#�bellr�r�events  rr0zSimpleDialog.return_eventHs*���<�<���I�I�N�N���I�I�d�l�l�#rc��|j�|jj�y|j|j�yr)r-r#rHrrEs rr8zSimpleDialog.wm_delete_windowNs*���;�;���I�I�N�N���I�I�d�k�k�"rc�F�||_|jj�yr)rr#�quitrs  rrzSimpleDialog.doneTs������	�	���r)�__name__�
__module__�__qualname__r?rFr0r8r�rrrrs,���"�d�4��D�)�@�$�#�rrc�F�eZdZdZdd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zy)�DialogzZClass to open dialogs.

    This class is intended as a base class for custom dialogs
    Nc��|}|�
t�}tj||�|j�|�!|j	�r|j|�|r|j
|�t|�||_d|_	t|�}|j|�|_|jdd��|j�|j�||_|jd|j �t#||�|jj%�|j'�|j)�|j+|�y)z�Initialize a dialog.

        Arguments:

            parent -- a parent window (the application window)

            title -- the dialog title
        N�)�padx�padyr!)rr"r?�withdraw�winfo_viewabler9r$r&�parent�resultr+�body�
initial_focusr)�	buttonboxr7r-r:�	focus_setrArB�wait_window)rrZr$r;r\s     rr?zDialog.__init__`s�����>�#�%�F����$��'��
�
����&�"7�"7�"9��N�N�6�"���J�J�u���d���������T�{��!�Y�Y�t�_����	�	�q�q�	�!��������%�!%�D���
�
�(�$�+�+�6��d�F�#����$�$�&�	
�����
�
������rc�f�d|_tj|�t|j�y)zDestroy the windowN)r]r"rDrr;rEs rrDzDialog.destroy�s$��!���������4�;�;�'rc��y)z�create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        NrQ)rr;s  rr\zDialog.body����	
rc�x�t|�}t|dd|jt��}|j	t
dd��t|dd|j��}|j	t
dd��|jd|j�|jd	|j�|j	�y
)z[add standard button box.

        override if you do not want the standard buttons
        �OK�
)r�widthrr.rU)r rVrW�Cancel)rrgrrz<Escape>N)r+r3�ok�ACTIVEr)r6r-r/)r�box�ws   rr^zDialog.buttonbox�s����D�k���3�T��T�W�W�f�M��	���D�q�q��)��3�X�R����E��	���D�q�q��)��	�	�*�d�g�g�&��	�	�*�d�k�k�*����
rc��|j�s|jj�y|j�|j	�	|j�|j
�y#|j
�wxYwr)�validater]r_rX�update_idletasks�applyr-rIs  rriz	Dialog.ok�sV���}�}�����(�(�*���
�
������	��J�J�L��K�K�M��D�K�K�M�s�
A.�.Bc�p�|j�|jj�|j�yr)rZr_rDrIs  rr-z
Dialog.cancel�s'���;�;�"��K�K�!�!�#����rc��y)z�validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        rrQrEs rrnzDialog.validate�s��rc��y)z�process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        NrQrEs rrpzDialog.apply�rcrr)rNrOrP�__doc__r?rDr\r^rir-rnrprQrrrSrSYs0���
1�f(�
��*���
rrSNc�<�|j�|j�|j�}|j�}|j	�}|j�}|��|j
�r�|j�|j�|z
dzz}|j�|j�|z
dzz}|j�}|j�}	t|||z|z
�}t||�}t||	|z|z
�}t||	�}|jdk(r9t|d�}n,|j!�|z
dz}|j#�|z
dz}|j%||�|j'd||fz�|j)�y)N��aqua�z+%d+%d)�wm_withdrawro�winfo_reqwidth�winfo_reqheight�winfo_vrootwidth�winfo_vrootheight�winfo_ismapped�winfo_rootx�winfo_width�winfo_rooty�winfo_height�winfo_vrootx�winfo_vrooty�min�max�_windowingsystem�winfo_screenwidth�winfo_screenheight�
wm_maxsize�wm_geometry�wm_deiconify)
rlrZ�minwidth�	minheight�maxwidth�	maxheight�x�y�vrootx�vrootys
          rr:r:�s|���M�M�O��������!�H��!�!�#�I��!�!�#�H��#�#�%�I�
��f�3�3�5���� �F�$6�$6�$8�8�$C��#I�I����� �F�$7�$7�$9�I�$E�!�#K�K�����!�����!����6�H�$�x�/�0����6�N����6�I�%�	�1�2����6�N������'��A�r�
�A�
�
 �
 �
"�X�
-�!�3��
�
!�
!�
#�i�
/�A�5���L�L��9�%��M�M�(�a��V�#�$��N�N�rc��|jdk(r |jjdd|dd�y|jdk(r|jdd�yy)	Nrwz!::tk::unsupported::MacWindowStyle�style�
moveableModalr	�x11z-type�dialog)r��tk�call�
wm_attributes)rls rr&r&sM�����V�#�	���	�	�5�w��_�b�	*�	
�	�	�u�	$�	�����*�
%rc�,�eZdZ			dd�Zd�Zd�Zd�Zy)�_QueryDialogNc�j�||_||_||_||_tj|||�yr)�prompt�minvalue�maxvalue�initialvaluerSr?)rr$r�r�r�r�rZs       rr?z_QueryDialog.__init__s1��
��� ��
� ��
�(�������f�e�,rc�<�d|_tj|�yr)�entryrSrDrEs rrDz_QueryDialog.destroys����
����t�rc��t||jt��}|jddt��t|d��|_|jjddttz��|j�F|jjd|j�|jjdt�|jS)N)r�justifyrrU)�rowrV�stickyr�)�namer)�Labelr�r6�grid�W�Entryr��Er��insert�select_range�END)rr;rls   rr\z_QueryDialog.body!s����&�t�{�{�D�9��	���1�1�Q��'��6��0��
��
�
���A�A�a��c��2����(��J�J���a��!2�!2�3��J�J�#�#�A�s�+��z�z�rc��	|j�}|j
�5||j
kr&tjdd|j
z|��y|j�5||jkDr&tjdd|jz|��y||_y	#t$r(tjd|jdz|��YywxYw)
Nz
Illegal valuez
Please try again)rZrz	Too smallz2The allowed minimum value is %s. Please try again.z	Too largez2The allowed maximum value is %s. Please try again.r)�	getresult�
ValueErrorr�showwarning�errormessager�r�r[)rr[s  rrnz_QueryDialog.validate/s���	��^�^�%�F��=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
���=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��	
�������9�	��"�"���!�!�$8�8��
�
�
	�s�B�.C
�C
)NNNN)rNrOrPr?rDr\rnrQrrr�r�s!��#�-1��-���rr�c��eZdZdZd�Zy)�
_QueryIntegerzNot an integer.c�T�|j|jj��Sr)�getintr��getrEs rr�z_QueryInteger.getresultTs���{�{�4�:�:�>�>�+�,�,rN�rNrOrPr�r�rQrrr�r�Qs��$�L�-rr�c�4�t||fi|��}|jS)z�get an integer from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is an integer
    )r�r[�r$r��kw�ds    r�
askintegerr�Xs��	�e�V�*�r�*�A��8�8�Orc��eZdZdZd�Zy)�_QueryFloatzNot a floating-point value.c�T�|j|jj��Sr)�	getdoubler�r�rEs rr�z_QueryFloat.getresultjs���~�~�d�j�j�n�n�.�/�/rNr�rQrrr�r�gs��0�L�0rr�c�4�t||fi|��}|jS)z�get a float from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a float
    )r�r[r�s    r�askfloatr�ns��	�E�6�(�R�(�A��8�8�Orc��eZdZd�Zd�Zd�Zy)�_QueryStringc�h�d|vr|d|_|d=nd|_tj|g|��i|��y)N�show)�_QueryString__showr�r?)r�argsr�s   rr?z_QueryString.__init__~s:���R�<��V�*�D�K��6�
��D�K����d�0�T�0�R�0rc��tj||�}|j�|j|j��|S)N)r�)r�r\r��	configure)rr;r�s   rr\z_QueryString.body�s5���!�!�$��/���;�;�"��O�O����O�-��rc�6�|jj�Sr)r�r�rEs rr�z_QueryString.getresult�s���z�z�~�~��rN)rNrOrPr?r\r�rQrrr�r�}s��1�� rr�c�4�t||fi|��}|jS)z�get a string from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a string
    )r�r[r�s    r�	askstringr��s��	�U�F�)�b�)�A��8�8�Or�__main__c���t�}|fd�}t|d|��}|j�t|d|j��}|j�|j	�y)Nc���t|dgd�ddd��}t|j��ttddd	�
��tt	dddd
���ttdd��y)Nz�This is a test dialog.  Would this have been an actual dialog, the buttons below would have been glowing in soft pink light.
Do you believe this?)�Yes�NorhrrvzTest Dialog)rr<r.r-r$�Spamz	Egg count�)r�zEgg weight
(in tons)r�d)r�r�z	Egg label)r�printrFr�r�r�)r#r�s  r�doitztest.<locals>.doit�si���T�5�
"9�!"� !�,�	.�A�
�!�$�$�&�M��*�V�[�u�E�F��(�6�#:�Q�$'�)�
*��)�F�K�0�1r�Testr�Quit)�Tkr3r)rMrC)r#r��t�qs    r�testr��sN���t���	2� 
�4�f�d�3��	�����4�f�a�f�f�5��	����	�
�
�rr)rt�tkinterrrrrr"rSr:r&r�r�r�r�r�r�r�rNr�rQrr�<module>r�s���
��6��7�7�tI
�X�I
�\�:+�@�6�@�F-�L�-��0�,�0�� �<� �&��z���0	�F�5r__pycache__/tix.cpython-312.opt-1.pyc000064400000332250151710635150013233 0ustar00�

T��h�,��v�ddlZddlZddlZddl�ddlmZejded��dZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z dZ!Gd!�d"�Z"Gd#�d$ejFe"�Z#Gd%�d&�Z$ejJjLe$fzejJ_&Gd'�d(ejJ�Z'Gd)�d*e'�Z(Gd+�d,�Z)Gd-�d.e'�Z*Gd/�d0e'�Z+Gd1�d2e'�Z,Gd3�d4e'�Z-Gd5�d6e'�Z.Gd7�d8e'�Z/Gd9�d:e'�Z0Gd;�d<e'�Z1Gd=�d>e'�Z2Gd?�d@e'�Z3GdA�dBe'�Z4GdC�dDe'�Z5GdE�dFe'�Z6GdG�dHe'e7e8�Z9GdI�dJe'�Z:GdK�dLe'�Z;GdM�dNe'�Z<GdO�dPe'�Z=GdQ�dRe'�Z>GdS�dTe'�Z?GdU�dVe'�Z@GdW�dXe'�ZAGdY�dZe'�ZBGd[�d\e'�ZCGd]�d^e'�ZDGd_�d`e'�ZEGda�dbe'�ZFGdc�dde'�ZGGde�dfe'�ZHGdg�dhe'�ZIGdi�dje'�ZJGdk�dle'�ZKGdm�dne'�ZLGdo�dpe'�ZMGdq�dre'e7e8�ZNGds�dte'�ZOGdu�dve'�ZPGdw�dxeQe(�ZRGdy�dzeSe(�ZTGd{�d|eUe(�ZVGd}�d~eWe(�ZXGd�d�eYe(�ZZGd��d�e[e(�Z\Gd��d�e]e(�Z^Gd��d�e_e(�Z`Gd��d�eae(�ZbGd��d�ece(�ZdGd��d�eFe(�ZeGd��d�e9e(�ZfGd��d�eEe(�ZgGd��d�eNe(�ZhGd��d�e,e(�ZiGd��d�e.e(�ZjGd��d�e0e(�ZkGd��d�e1e(�ZlGd��d�e4e(�ZmGd��d�e,e(�ZnGd��d�eMe(�ZoGd��d�e@e(�ZpGd��d�eBe(�Zqd��Zrd��ZsGd��d�e'�ZtGd��d�e'e7e8�ZuGd��d�eu�Zvy)��N)�*)�	_cnfmergeznThe Tix Tk extension is unmaintained, and the tkinter.tix wrapper module is deprecated in favor of tkinter.ttk�)�
stacklevel�window�text�status�	immediate�image�	imagetext�balloon�auto�	acrosstop�ascii�cell�column�
decreasing�
increasing�integer�main�max�real�rowzs-regionzx-regionzy-region���� c�F�eZdZdZd�Zd�Zdd�Zdd�Zd�Zd�Z	d	�Z
dd
�Zy)�
tixCommanda�The tix commands provide access to miscellaneous  elements
    of  Tix's  internal state and the Tix application context.
    Most of the information manipulated by these  commands pertains
    to  the  application  as a whole, or to a screen or
    display, rather than to a particular window.

    This is a mixin class, assumed to be mixed to Tkinter.Tk
    that supports the self.tk.call method.
    c�<�|jjdd|�S)a�Tix maintains a list of directories under which
        the  tix_getimage  and tix_getbitmap commands will
        search for image files. The standard bitmap  directory
        is $TIX_LIBRARY/bitmaps. The addbitmapdir command
        adds directory into this list. By  using  this
        command, the  image  files  of an applications can
        also be located using the tix_getimage or tix_getbitmap
        command.
        �tix�addbitmapdir��tk�call)�self�	directorys  �$/usr/lib64/python3.12/tkinter/tix.py�tix_addbitmapdirztixCommand.tix_addbitmapdirYs���w�w�|�|�E�>�9�=�=�c�<�|jjdd|�S)z�Returns  the  current  value  of the configuration
        option given by option. Option may be  any  of  the
        options described in the CONFIGURATION OPTIONS section.
        r!�cgetr#�r&�options  r(�tix_cgetztixCommand.tix_cgetes��
�w�w�|�|�E�6�6�2�2r*Nc�
�|rt||f�}n
|rt|�}|�|jdd�St|t�r|j	ddd|z�S|j
j
d|j|�z�S)a�Query or modify the configuration options of the Tix application
        context. If no option is specified, returns a dictionary all of the
        available options.  If option is specified with no value, then the
        command returns a list describing the one named option (this list
        will be identical to the corresponding sublist of the value
        returned if no option is specified).  If one or more option-value
        pairs are specified, then the command modifies the given option(s)
        to have the given value(s); in this case the command returns an
        empty string. Option may be any of the configuration options.
        r!�	configure�-)r!r1)r�
_getconfigure�
isinstance�str�_getconfigure1r$r%�_options�r&�cnf�kws   r(�
tix_configureztixCommand.tix_configurels~����S�"�I�&�C�
��C�.�C��;��%�%�e�[�9�9��c�3���&�&�u�k�3�s�7�C�C��w�w�|�|�0�4�=�=��3E�E�F�Fr*c�x�|�|jjdd|�S|jjdd�S)a�Returns the file selection dialog that may be shared among
        different calls from this application.  This command will create a
        file selection dialog widget when it is called the first time. This
        dialog will be returned by all subsequent calls to tix_filedialog.
        An optional dlgclass parameter can be passed to specified what type
        of file selection dialog widget is desired. Possible options are
        tix FileSelectDialog or tixExFileSelectDialog.
        r!�
filedialogr#)r&�dlgclasss  r(�tix_filedialogztixCommand.tix_filedialog�s6�����7�7�<�<��|�X�>�>��7�7�<�<��|�4�4r*c�<�|jjdd|�S)a�Locates a bitmap file of the name name.xpm or name in one of the
        bitmap directories (see the tix_addbitmapdir command above).  By
        using tix_getbitmap, you can avoid hard coding the pathnames of the
        bitmap files in your application. When successful, it returns the
        complete pathname of the bitmap file, prefixed with the character
        '@'.  The returned value can be used to configure the -bitmap
        option of the TK and Tix widgets.
        r!�	getbitmapr#�r&�names  r(�
tix_getbitmapztixCommand.tix_getbitmap�s���w�w�|�|�E�;��5�5r*c�<�|jjdd|�S)a�Locates an image file of the name name.xpm, name.xbm or name.ppm
        in one of the bitmap directories (see the addbitmapdir command
        above). If more than one file with the same name (but different
        extensions) exist, then the image type is chosen according to the
        depth of the X display: xbm images are chosen on monochrome
        displays and color images are chosen on color displays. By using
        tix_ getimage, you can avoid hard coding the pathnames of the
        image files in your application. When successful, this command
        returns the name of the newly created image, which can be used to
        configure the -image option of the Tk and Tix widgets.
        r!�getimager#rBs  r(�tix_getimageztixCommand.tix_getimage�s���w�w�|�|�E�:�t�4�4r*c�>�|jjddd|�S)a@Gets  the options  maintained  by  the  Tix
        scheme mechanism. Available options include:

            active_bg       active_fg      bg
            bold_font       dark1_bg       dark1_fg
            dark2_bg        dark2_fg       disabled_fg
            fg              fixed_font     font
            inactive_bg     inactive_fg    input1_bg
            input2_bg       italic_font    light1_bg
            light1_fg       light2_bg      light2_fg
            menu_font       output1_bg     output2_bg
            select_bg       select_fg      selector
            r!r.�getr#rBs  r(�tix_option_getztixCommand.tix_option_get�s���w�w�|�|�E�8�U�D�9�9r*c��|�|jjdd|||�S|jjdd||�S)a�Resets the scheme and fontset of the Tix application to
        newScheme and newFontSet, respectively.  This affects only those
        widgets created after this call. Therefore, it is best to call the
        resetoptions command before the creation of any widgets in a Tix
        application.

        The optional parameter newScmPrio can be given to reset the
        priority level of the Tk options set by the Tix schemes.

        Because of the way Tk handles the X option database, after Tix has
        been has imported and inited, it is not possible to reset the color
        schemes and font sets using the tix config command.  Instead, the
        tix_resetoptions command must be used.
        r!�resetoptionsr#)r&�	newScheme�
newFontSet�
newScmPrios    r(�tix_resetoptionsztixCommand.tix_resetoptions�s>���!��7�7�<�<��~�y�*�j�Y�Y��7�7�<�<��~�y�*�M�Mr*�N)�__name__�
__module__�__qualname__�__doc__r)r/r;r?rDrGrJrP�r*r(rrNs1���
>�3�G�,5�	6�5�:�"Nr*rc��eZdZdZdd�Zd�Zy)�Tkz{Toplevel widget of Tix which represents mostly the main window
    of an application. It has an associated Tcl interpreter.Nc�n�tjj||||�tjjd�}|jjd�|�<|jjd|z�|jjd|z�|jjd�y)N�TIX_LIBRARYz<global auto_path; lappend auto_path [file dir [info nameof]]z(global auto_path; lappend auto_path {%s}z,global tcl_pkgPath; lappend tcl_pkgPath {%s}zpackage require Tix)�tkinterrX�__init__�os�environrIr$�eval)r&�
screenName�baseName�	className�tixlibs     r(r\zTk.__init__�s����
�
���D�*�h�	�B������
�.�������S�T����G�G�L�L�C�f�L�M��G�G�L�L�G�&�P�Q�	
�����*�+r*c�f�|jdd�tjj|�y)N�WM_DELETE_WINDOW�)�protocolr[rX�destroy�r&s r(rhz
Tk.destroy�s#���
�
�(�"�-��
�
���4� r*)NN�Tix�rRrSrTrUr\rhrVr*r(rXrX�s��@�,�!r*rXc�F�eZdZdZifd�ZeZd�Zd�Zd�Zd
d�Z	dd�Z
d	�Zy)�Formz�The Tix Form geometry manager

    Widgets can be arranged by specifying attachments to other widgets.
    See Tix documentation for complete detailsc�t�|jjd|jg|j||����y)N�tixForm�r$r%�_wr7r8s   r(�configzForm.config�s*��������Y����A�$�-�-��R�*@�Ar*c�4�tj|||i�yrQ)rm�form�r&�key�values   r(�__setitem__zForm.__setitem__�s���	�	�$��e��%r*c�P�|jjdd|j�S)Nro�check�r$r%rqris r(rzz
Form.check�s���w�w�|�|�I�w����8�8r*c�R�|jjdd|j�y)Nro�forgetr{ris r(r}zForm.forget�s�������Y��$�'�'�2r*c�4�|sn|sl|jjdd|j�}|jj|�}d}|D]!}||jj	|�fz}�#|S|jjdd|j||�S)Nro�gridrV)r$r%rq�	splitlist�getint)r&�xsize�ysize�x�y�zs      r(rz	Form.grid�s����������Y�����8�A����!�!�!�$�A��A����������*�,�,����H��w�w�|�|�I�v�t�w�w��u�E�Er*Nc��|s'|jjdd|j�S|ddk7rd|z}|jjdd|j|�S)Nro�inforr2r{r-s  r(r�z	Form.infosR����7�7�<�<�	�6�4�7�7�;�;��!�9����6�\�F��w�w�|�|�I�v�t�w�w��?�?r*c���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)Nro�slaves)r$r�r%rq�
_nametowidget�r&r�s  r(r�zForm.slaves
s`�����!�!��w�w�|�|� �(�D�G�G�5�6�7�6�+,��"�"�1�%�6�7�	7��7s�A)rrrQ)rRrSrTrUrrrtrxrzr}rr�r�rVr*r(rmrm�s9��2�
�B��D�&�9�3�F�@�7r*rmc�^�eZdZdZdddiifd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zidfd�Zd�Z
y)
�	TixWidgetaQA TixWidget class is used to package all (or most) Tix widgets.

    Widget initialization is extended in two ways:
       1) It is possible to give a list of options which must be part of
       the creation command (so called Tix 'static' options). These cannot be
       given as a 'config' command later.
       2) It is possible to give the name of an existing TK widget. These are
       child widgets created automatically by a Tix mega-widget. The Tk call
       to create these widgets is therefore bypassed in TixWidget.__init__

    Both options are for use by subclasses only.
    Nc��|rt||f�}nt|�}d}|r|jd�ndg}t|j��D]\}}||vs�|d|z|fz}||=�||_|j||�|r(|jj||jg|���|rtj||�i|_y)NrV�optionsr2)r�append�list�items�
widgetName�_setupr$r%rq�Widgetrr�subwidget_list)	r&�masterr��static_optionsr9r:�extra�k�vs	         r(r\zTixWidget.__init__!s�����S�"�I�&�C��C�.�C�����!�!�)�,�'�[�N���	�	��$�C�A�a��N�"���q��!��,����F�%�
%������F�C� ���D�G�G�L�L��T�W�W�5�u�5���M�M�$��$�
!��r*c�R�||jvr|j|St|��rQ)r��AttributeErrorrBs  r(�__getattr__zTixWidget.__getattr__Ns,���4�&�&�&��&�&�t�,�,��T�"�"r*c�R�|jjd|j|�y)z1Set a variable without calling its action routine�tixSetSilentNr{)r&rws  r(�
set_silentzTixWidget.set_silentSs�������^�T�W�W�e�4r*c��|j|�}|std|zdz|jz��|t|j�dzd}|j|�S)zSReturn the named subwidget (which must have been created by
        the sub-class).z
Subwidget z not child of �N)�_subwidget_name�TclError�_name�lenrqr�)r&rC�ns   r(�	subwidgetzTixWidget.subwidgetWs_��
� � ��&����<�$�.�1A�A�D�J�J�N�O�O�
�c�$�'�'�l�1�n�o����!�!�!�$�$r*c���|j�}|sgSg}|D]>}|t|j�dzd}	|j|j	|���@|S#Y�GxYw)zReturn all subwidgets.r�N)�_subwidget_namesr�rqr�r�)r&�names�retlistrCs    r(�subwidgets_allzTixWidget.subwidgets_allasl���%�%�'����I����D���D�G�G��Q���(�D�
����t�1�1�$�7�8�����
��s� A�A c�p�	|jj|jd|�S#t$rYywxYw)z7Get a subwidget name (returns a String, not a Widget !)r�N)r$r%rqr�rBs  r(r�zTixWidget._subwidget_nameps4��	��7�7�<�<�����d�;�;���	��	�s�&)�	5�5c��	|jj|jdd�}|jj|�S#t$rYywxYw)z"Return the name of all subwidgets.�
subwidgetsz-allN)r$r%rqr�r�r�s  r(r�zTixWidget._subwidget_nameswsH��	������T�W�W�l�F�;�A��7�7�$�$�Q�'�'���	��	�s�AA�	A�Ac���|dk(ryt|t�st|�}t|t�st|�}|j�}|D]#}|jj|dd|z|��%y)z8Set configuration options for all subwidgets (and self).rfNr1r2)r4r5�reprr�r$r%)r&r.rwr�rCs     r(�
config_allzTixWidget.config_allsd���R�<���F�C�(��&�\�F��%��%���K�E��%�%�'���D��G�G�L�L��{�C�&�L�%�@�r*c��|�|}|r|rt||f�}n|r|}d}|j�D]+\}}t|�r|j|�}|d|z|fz}�-|jjdd|f|z�S)NrVr2r�create)rr��callable�	_registerr$r%)r&�imgtyper9r�r:r�r�r�s        r(�image_createzTixWidget.image_create�s����>��F�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���{��N�N�1�%����Q���
�*�G� ��y�y�~�~�w��'�;�g�E�F�Fr*c�^�	|jjdd|�y#t$rYywxYw)Nr�delete)r$r%r�)r&�imgnames  r(�image_deletezTixWidget.image_delete�s-��	��G�G�L�L��(�G�4���	��	�s� �	,�,)rRrSrTrUr\r�r�r�r�r�r�r�r�r�rVr*r(r�r�sQ��� $��#���&!�Z#�
5�%�
���
A�)+�4�
G�r*r�c� �eZdZdZ	dd�Zd�Zy)�TixSubWidgetz�Subwidget class.

    This is used to mirror child widgets automatically created
    by Tix/Tk as part of a mega-widget in Python (which is not informed
    of this)c��|r>|j|�}	|t|j�dzd}|jd�}|s#tj||ddd|i�||_y|}t
t�dz
�D]-}dj|d|dz�}		|j|	�}
|
}�/|r|d}tj||ddd|i�||_y#g}Y��xYw#t$rt|||dd��}Y��wxYw)Nr��.rCr)�destroy_physically�check_intermediate���)r�r�rq�splitr�r\�range�joinr��KeyErrorr�r�)r&r�rCr�r��path�plist�parent�ir��ws           r(r\zTixSubWidget.__init__�s"����)�)�$�/�D�
��C��	�	�N�1�,�-�.���
�
�3���"����t�V�T�4�&�4��I�$#5����F��3�u�:��>�*���H�H�U�4�A�a�C�[�)��@��,�,�Q�/�A��F�	+���R�y�����t�V�T�4�&�4��I�"4����/
���� �@�)�&�%��(�=>�=>�@�F�@�s�,C�C"�C�"D�?Dc���t|jj��D]}|j��|j|j
jvr!|j
j|j=|j|j
jvr!|j
j|j=|jr'|jjd|j�yy)Nrh)r��children�valuesrhr�r�r�r�r$r%rq�r&�cs  r(rhzTixSubWidget.destroy�s���
�d�m�m�*�*�,�-�A�q�y�y�{�-��:�:����-�-�-����$�$�T�Z�Z�0��:�:����3�3�3����*�*�4�:�:�6��"�"��G�G�L�L��D�G�G�,�#r*N)r�r�rkrVr*r(r�r��s���9:�5�@-r*r�c�H�eZdZdZifdd�d�Zd�Zd�Zd�Zd�Zifd	�Z	d
�Z
y)�DisplayStylezRDisplayStyle - handle configuration options shared by
    (multiple) Display ItemsN)r�c���|�)d|vr|d}nd|vr|d}ntjd�}|j|_|jjd|g|j	||����|_y)N�	refwindowzcreate display style�tixDisplayStyle)r[�_get_default_rootr$r%r7�	stylename)r&�itemtyper9r�r:s     r(r\zDisplayStyle.__init__�st���>��b� ��K�����#��[�)�� �2�2�3I�J���)�)���%������&7��5�!�]�]�3�r�2�5��r*c��|jSrQ)r�ris r(�__str__zDisplayStyle.__str__�s���~�~�r*c�z�|r|rt||f�}n|r|}d}|j�D]\}}|d|z|fz}�|S)NrVr2)rr�)r&r9r:�optsr�r�s      r(r7zDisplayStyle._options�sM��
�#��S�"�I�&�C�
��C����I�I�K�D�A�q��3�q�5�!�*�$�D� ��r*c�P�|jj|jd�y�Nr��r$r%r�ris r(r�zDisplayStyle.delete�s�������T�^�^�X�.r*c�Z�|jj|jdd|z|�y)Nr1�-%sr�rus   r(rxzDisplayStyle.__setitem__�s �������T�^�^�[�%��)�U�Cr*c�^�|j|jdg|j||����S)Nr1)r3r�r7r8s   r(rrzDisplayStyle.config�s6��!�t�!�!��N�N�K�A�*.�-�-��B�*?�A�	Ar*c�V�|jj|jdd|z�S)Nr,r�r�)r&rvs  r(�__getitem__zDisplayStyle.__getitem__�s!���w�w�|�|�D�N�N�F�E�#�I�>�>r*)rRrSrTrUr\r�r7r�rxrrr�rVr*r(r�r��s=�� �&(�
5�4�
5���/�D��A�?r*r�c�,�eZdZdZdifd�Zifd�Zd�Zy)�BalloonzBalloon help widget.

    Subwidget       Class
    ---------       -----
    label           Label
    message         MessageNc��gd�}tj||d|||�t|dd��|jd<t|dd��|jd<y)N)r��installcolormap�initwait�	statusbar�cursor�
tixBalloon�labelr�r��message�r�r\�_dummyLabelr��r&r�r9r:�statics     r(r\zBalloon.__init__s[�������4���v�s�B�G�'2�4��FG�(I����G�$�)4�T�9�HI�*K����I�&r*c��|jj|jd|jg|j||����y)zkBind balloon widget to another.
        One balloon widget may be bound to several widgets at the same time�bindNrp)r&�widgetr9r:s    r(�bind_widgetzBalloon.bind_widgets2��	������T�W�W�f�f�i�i�I�$�-�-��R�2H�Ir*c�f�|jj|jd|j�y�N�unbindr{�r&r�s  r(�
unbind_widgetzBalloon.unbind_widget��������T�W�W�h��	�	�2r*)rRrSrTrUr\r�rrVr*r(r�r�s$���#��K�')�J�
3r*r�c�,�eZdZdZdifd�Zifd�Zd�Zy)�	ButtonBoxzgButtonBox - A container for pushbuttons.
    Subwidgets are the buttons added with the add method.
    Nc�<�tj||dddg||�y)N�tixButtonBox�orientationr��r�r\�r&r�r9r:s    r(r\zButtonBox.__init__&s#�����4���)�9�5�s�B�	@r*c��|jj|jd|g|j||����}t	||�|j
|<|S)z$Add a button with given name to box.�add�r$r%rqr7�_dummyButtonr�)r&rCr9r:�btns     r(r
z
ButtonBox.add*sL���d�g�g�l�l�4�7�7�E�4�I�$�-�-��R�2H�I��$0��t�$<����D�!��
r*c�p�||jvr(|jj|jd|�yy�N�invoke�r�r$r%rqrBs  r(rzButtonBox.invoke1�-���4�&�&�&��G�G�L�L����(�D�1�'r*�rRrSrTrUr\r
rrVr*r(rr"s#���#��@���2r*rc�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�ComboBoxa�ComboBox - an Entry field with a dropdown menu. The user can select a
    choice by either typing in the entry subwidget or selecting from the
    listbox subwidget.

    Subwidget       Class
    ---------       -----
    entry       Entry
    arrow       Button
    slistbox    ScrolledListBox
    tick        Button
    cross       Button : present if created with the fancy optionNc��tj||dgd�||�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)	N�tixComboBox)�editable�dropdown�fancyr�r��entry�arrow�slistbox�tick�cross)r�r\r�r��_dummyEntryr�_dummyScrolledListBox�	TypeErrorrs    r(r\zComboBox.__init__Cs������4���G���	$�(3�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B5�5	C�Cc�R�|jj|jd|�y)N�
addhistoryr{�r&r5s  r(�add_historyzComboBox.add_historyUs�������T�W�W�l�C�0r*c�R�|jj|jd|�y)N�
appendhistoryr{r%s  r(�append_historyzComboBox.append_historyXs�������T�W�W�o�s�3r*c�T�|jj|jd||�y�N�insertr{)r&�indexr5s   r(r,zComboBox.insert[s�������T�W�W�h��s�3r*c�R�|jj|jd|�y)N�pickr{�r&r-s  r(r/z
ComboBox.pick^s�������T�W�W�f�e�,r*)	rRrSrTrUr\r&r)r,r/rVr*r(rr5s(��
E� $���$1�4�4�-r*rc�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�Controla�Control - An entry field with value change arrows.  The user can
    adjust the value by pressing the two arrow buttons or by entering
    the value directly into the entry. The new value will be checked
    against the user-defined upper and lower limits.

    Subwidget       Class
    ---------       -----
    incr       Button
    decr       Button
    entry       Entry
    label       LabelNc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<y)N�
tixControlr��incr�decrr�r)r�r\rr�r�r rs    r(r\zControl.__init__osx�����4���	�{�C��L�&2�4��&@����F�#�&2�4��&@����F�#�'2�4��'A����G�$�'2�4��'A����G�$r*c�P�|jj|jd�y)Nr6r{ris r(�	decrementzControl.decrementv��������T�W�W�f�%r*c�P�|jj|jd�y)Nr5r{ris r(�	incrementzControl.incrementyr9r*c�P�|jj|jd�yrr{ris r(rzControl.invoke|��������T�W�W�h�'r*c�P�|jj|jd�y)N�updater{ris r(r?zControl.updater=r*)	rRrSrTrUr\r8r;rr?rVr*r(r2r2as(��
� $��B�&�&�(�(r*r2c� �eZdZdZifd�Zd�Zy)�DirListaRDirList - displays a list view of a directory, its previous
    directories and its sub-directories. The user can choose one of
    the directories displayed in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist       HList
    hsb              Scrollbar
    vsb              Scrollbarc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirListr��hlist�vsb�hsb�r�r\�_dummyHListr��_dummyScrollbarrs    r(r\zDirList.__init__��a�����4���	�{�C��L�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�R�|jj|jd|�y�N�chdirr{�r&�dirs  r(rMz
DirList.chdir���������T�W�W�g�s�+r*N�rRrSrTrUr\rMrVr*r(rArA�s��"�$&�B�,r*rAc� �eZdZdZifd�Zd�Zy)�DirTreea�DirTree - Directory Listing in a hierarchical view.
    Displays a tree view of a directory, its previous directories and its
    sub-directories. The user can choose one of the directories displayed
    in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist           HList
    hsb             Scrollbar
    vsb             Scrollbarc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirTreer�rDrErFrGrs    r(r\zDirTree.__init__�rJr*c�R�|jj|jd|�yrLr{rNs  r(rMz
DirTree.chdir�rPr*NrQrVr*r(rSrS�s��	!�$&�B�,r*rSc��eZdZdZifd�Zy)�DirSelectBoxa�DirSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBoxc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixDirSelectBoxr��dirlist�dircbx)r�r\�
_dummyDirListr��_dummyFileComboBoxrs    r(r\zDirSelectBox.__init__�sK�����4��):�Y�K��b�Q�)6�t�Y�)G����I�&�(:�4��(J����H�%r*N�rRrSrTrUr\rVr*r(rXrX�s��'�$&�Kr*rXc�&�eZdZdZifd�Zd�Zd�Zy)�ExFileSelectBoxa�ExFileSelectBox - MS Windows style file select box.
    It provides a convenient method for the user to select files.

    Subwidget       Class
    ---------       -----
    cancel       Button
    ok              Button
    hidden       Checkbutton
    types       ComboBox
    dir              ComboBox
    file       ComboBox
    dirlist       ScrolledListBox
    filelist       ScrolledListBoxc���tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d	�|jd	<t|d
�|jd
<y)N�tixExFileSelectBoxr��cancel�ok�hidden�typesrOr[�file�filelist)r�r\rr��_dummyCheckbutton�_dummyComboBoxr]r!rs    r(r\zExFileSelectBox.__init__�s������4��)=�	�{�C�QS�T�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)6�t�Y�)G����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*c�P�|jj|jd�y�N�filterr{ris r(rnzExFileSelectBox.filter�r=r*c�P�|jj|jd�yrr{ris r(rzExFileSelectBox.invoke�r=r*N)rRrSrTrUr\rnrrVr*r(rara�s��&�$&�	R�(�(r*rac�&�eZdZdZifd�Zd�Zd�Zy)�DirSelectDialoga#The DirSelectDialog widget presents the directories in the file
    system in a dialog window. The user can use this dialog window to
    navigate through the file system to select the desired directory.

    Subwidgets       Class
    ----------       -----
    dirbox       DirSelectDialogc�l�tj||ddg||�t|d�|jd<y)N�tixDirSelectDialogr��dirbox)r�r\�_dummyDirSelectBoxr�rs    r(r\zDirSelectDialog.__init__�s7�����4��)=�%�;��R�	1�(:�4��(J����H�%r*c�P�|jj|jd�y�N�popupr{ris r(rxzDirSelectDialog.popup���������T�W�W�g�&r*c�P�|jj|jd�y�N�popdownr{ris r(r|zDirSelectDialog.popdown���������T�W�W�i�(r*N�rRrSrTrUr\rxr|rVr*r(rqrq�s��$�$&�K�'�)r*rqc�&�eZdZdZifd�Zd�Zd�Zy)�ExFileSelectDialogz�ExFileSelectDialog - MS Windows style file select dialog.
    It provides a convenient method for the user to select files.

    Subwidgets       Class
    ----------       -----
    fsbox       ExFileSelectBoxc�l�tj||ddg||�t|d�|jd<y)N�tixExFileSelectDialogr��fsbox)r�r\�_dummyExFileSelectBoxr�rs    r(r\zExFileSelectDialog.__init__s7�����4��)@�%�;��R�	1�'<�T�7�'K����G�$r*c�P�|jj|jd�yrwr{ris r(rxzExFileSelectDialog.popupryr*c�P�|jj|jd�yr{r{ris r(r|zExFileSelectDialog.popdownr}r*Nr~rVr*r(r�r��s��#�$&�L�
'�)r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�
FileSelectBoxa�ExFileSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBoxc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixFileSelectBoxr�r[rirn�	selection)r�r\r!r�rkrs    r(r\zFileSelectBox.__init__sy�����4��);�i�[�#�r�R�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*c�P�|jj|jd�yrmr{ris r(�apply_filterzFileSelectBox.apply_filter#r=r*c�P�|jj|jd�yrr{ris r(rzFileSelectBox.invoke&r=r*N)rRrSrTrUr\r�rrVr*r(r�r�s��'�$&�M�(�(r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�FileSelectDialogz�FileSelectDialog - Motif style file select dialog.

    Subwidgets       Class
    ----------       -----
    btns       StdButtonBox
    fsbox       FileSelectBoxc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixFileSelectDialogr��btnsr�)r�r\�_dummyStdButtonBoxr��_dummyFileSelectBoxrs    r(r\zFileSelectDialog.__init__3sN�����4��)>�%�;��R�	1�&8��v�&F����F�#�':�4��'I����G�$r*c�P�|jj|jd�yrwr{ris r(rxzFileSelectDialog.popup9ryr*c�P�|jj|jd�yr{r{ris r(r|zFileSelectDialog.popdown<r}r*Nr~rVr*r(r�r�*s��!�$&�J�'�)r*r�c�&�eZdZdZifd�Zd�Zd�Zy)�	FileEntrya_FileEntry - Entry field with button that invokes a FileSelectDialog.
    The user can type in the filename manually. Alternatively, the user can
    press the button widget that sits next to the entry, which will bring
    up a file selection dialog.

    Subwidgets       Class
    ----------       -----
    button       Button
    entry       Entryc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�tixFileEntry�
dialogtyper��buttonr)r�r\rr�r rs    r(r\zFileEntry.__init__KsP�����4���(�)�4�c�2�	?�(4�T�8�(D����H�%�'2�4��'A����G�$r*c�P�|jj|jd�yrr{ris r(rzFileEntry.invokeQr=r*c��yrQrVris r(�file_dialogzFileEntry.file_dialogTs��r*N)rRrSrTrUr\rr�rVr*r(r�r�?s���$&�B�(�
r*r�c��eZdZdZdifd�Zifd�Zdifd�Zd�Zd�Zd7d�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zifd�Zifd�Zd�Zd�ZeZd�Zd�Zd�Zifd�Zifd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d8d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,ifd+�Z-ifd,�Z.d-�Z/d.�Z0d/�Z1ifd0�Z2d1�Z3d2�Z4ifd3�Z5d4�Z6d8d5�Z7d6�Z8y)9�HListaHList - Hierarchy display  widget can be used to display any data
    that have a hierarchical structure, for example, file system directory
    trees. The list entries are indented and connected by branch lines
    according to their places in the hierarchy.

    Subwidgets - NoneNc�<�tj||dddg||�y)N�tixHList�columnsr�rrs    r(r\zHList.__init__`s"�����4���%�y�1�3��	<r*c�t�|jj|jd|g|j||����S�Nr
rp�r&rr9r:s    r(r
z	HList.addds/���t�w�w�|�|�D�G�G�U�E�K�D�M�M�#�r�4J�K�Kr*c�|�|�d}|jj|jd|g|j||����S)Nrf�addchildrp)r&r�r9r:s    r(�	add_childzHList.add_childgsD���>��F��t�w�w�|�|��W�W�j�&�K�37�=�=��b�3I�K�	Kr*c�T�|jj|jdd|�y�N�anchor�setr{�r&rs  r(�
anchor_setzHList.anchor_setm��������T�W�W�h��u�5r*c�R�|jj|jdd�y�Nr��clearr{ris r(�anchor_clearzHList.anchor_clearp��������T�W�W�h��0r*c��|s)|jj|jdd||�S|jj|jdd|d|�S)Nr�widthz-charr{)r&�colr��charss    r(�column_widthzHList.column_widthssJ����7�7�<�<�����7�C��G�G��7�7�<�<�����7�C� '��0�
0r*c�R�|jj|jdd�y)Nr��allr{ris r(�
delete_allzHList.delete_allzs�������T�W�W�h��.r*c�T�|jj|jdd|�y)Nr�rr{r�s  r(�delete_entryzHList.delete_entry}s�������T�W�W�h���7r*c�T�|jj|jdd|�y)Nr��
offspringsr{r�s  r(�delete_offspringszHList.delete_offsprings�s�������T�W�W�h��e�<r*c�T�|jj|jdd|�y)Nr��siblingsr{r�s  r(�delete_siblingszHList.delete_siblings�s�������T�W�W�h�
�E�:r*c�T�|jj|jdd|�y�N�dragsiter�r{r0s  r(�dragsite_setzHList.dragsite_set���������T�W�W�j�%��7r*c�R�|jj|jdd�y�Nr�r�r{ris r(�dragsite_clearzHList.dragsite_clear���������T�W�W�j�'�2r*c�T�|jj|jdd|�y�N�dropsiter�r{r0s  r(�dropsite_setzHList.dropsite_set�r�r*c�R�|jj|jdd�y�Nr�r�r{ris r(�dropsite_clearzHList.dropsite_clear�r�r*c�x�|jj|jdd|g|j||����y)N�headerr�rp�r&r�r9r:s    r(�
header_createzHList.header_create�s.��������T�W�W�h��#�O��
�
�c�2�8N�Or*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1�r3rqr$r%r7r�s    r(�header_configurezHList.header_configure�sS���;��%�%�d�g�g�x��c�J�J�������T�W�W�h��S�	.��m�m�C��,�	.r*c�T�|jj|jdd||�S)Nr�r,r{)r&r��opts   r(�header_cgetzHList.header_cget�s!���w�w�|�|�D�G�G�X�v�s�C�@�@r*c��|jj|jj|jdd|��S)Nr��exist)r$�
getbooleanr%rq�r&r�s  r(�
header_existszHList.header_exists�s0���w�w�!�!�$�'�'�,�,�t�w�w��'�3�"O�P�Pr*c�T�|jj|jdd|�y)Nr�r�r{r�s  r(�
header_deletezHList.header_delete�s�������T�W�W�h��#�6r*c�R�|jj|jdd|�S)Nr��sizer{r�s  r(�header_sizezHList.header_size�s���w�w�|�|�D�G�G�X�v�s�;�;r*c�T�|jj|jdd|�y)N�hiderr{r�s  r(�
hide_entryzHList.hide_entry�s�������T�W�W�f�g�u�5r*c�x�|jj|jdd|g|j||����y)N�	indicatorr�rpr�s    r(�indicator_createzHList.indicator_create�s6���������g�g�{�H�e�	N�6:�m�m�C��6L�	Nr*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1r�r�s    r(�indicator_configurezHList.indicator_configure�s[���;��%�%�����k�5�:�
:��������g�g�{�K��	Q�9=���s�B�9O�	Qr*c�T�|jj|jdd||�S)Nr�r,r{�r&rr�s   r(�indicator_cgetzHList.indicator_cget�s!���w�w�|�|�D�G�G�[�&�%��E�Er*c�R�|jj|jdd|�S)Nr��existsr{r�s  r(�indicator_existszHList.indicator_exists�s���w�w�|�|�T�W�W�k�8�U�C�Cr*c�T�|jj|jdd|�y)Nr�r�r{r�s  r(�indicator_deletezHList.indicator_delete�s�������T�W�W�k�8�U�;r*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�indicator_sizezHList.indicator_size�s���w�w�|�|�D�G�G�[�&�%�@�@r*c�P�|jj|jdd�S�Nr�r�r{ris r(�info_anchorzHList.info_anchor�����w�w�|�|�D�G�G�V�X�6�6r*c�x�|j|jj|jdd|��xsdS�Nr��bbox)�_getintsr$r%rqr�s  r(�	info_bboxzHList.info_bbox�s7���}�}������T�W�W�f�f�e�<�>�F�AE�	Fr*c��|jj|jdd|�}|jj|�S)Nr�r��r$r%rqr�)r&rr�s   r(�
info_childrenzHList.info_children�s3���G�G�L�L����&�*�e�<���w�w� � ��#�#r*c�R�|jj|jdd|�S)Nr��datar{r�s  r(�	info_datazHList.info_data�����w�w�|�|�D�G�G�V�V�U�;�;r*c�P�|jj|jdd�S)Nr�r�r{ris r(�
info_dragsitezHList.info_dragsite�����w�w�|�|�D�G�G�V�Z�8�8r*c�P�|jj|jdd�S)Nr�r�r{ris r(�
info_dropsitezHList.info_dropsite�rr*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�info_existszHList.info_exists�����w�w�|�|�D�G�G�V�X�u�=�=r*c�R�|jj|jdd|�S)Nr�rfr{r�s  r(�info_hiddenzHList.info_hidden�rr*c�R�|jj|jdd|�S)Nr��nextr{r�s  r(�	info_nextzHList.info_next�r
r*c�R�|jj|jdd|�S)Nr�r�r{r�s  r(�info_parentzHList.info_parent�rr*c�R�|jj|jdd|�S)Nr��prevr{r�s  r(�	info_prevzHList.info_prev�r
r*c��|jj|jdd�}|jj|�S�Nr�r�rr�s  r(�info_selectionzHList.info_selection��1���G�G�L�L����&�+�6���w�w� � ��#�#r*c�V�|jj|jdd|||�S)N�itemr,r{)r&rr�r�s    r(�	item_cgetzHList.item_cget�s#���w�w�|�|�D�G�G�V�V�U�C��E�Er*c��|�|j|jdd||�S|jj|jdd||g|j	||����y)Nr%r1r��r&rr�r9r:s     r(�item_configurezHList.item_configure�sW���;��%�%�d�g�g�v�{�E�3�O�O�������T�W�W�f�k�5�#�	'��}�}�S�"�%�	'r*c�z�|jj|jdd||g|j||����y)Nr%r�rpr(s     r(�item_createzHList.item_create�s8���������g�g�v�x���	N�6:�m�m�C��6L�	Nr*c�T�|jj|jdd||�S)Nr%r�r{�r&rr�s   r(�item_existszHList.item_exists�s!���w�w�|�|�D�G�G�V�X�u�c�B�Br*c�V�|jj|jdd||�y)Nr%r�r{r-s   r(�item_deletezHList.item_delete�s�������T�W�W�f�h��s�;r*c�R�|jj|jd||�S)N�	entrycgetr{r�s   r(r2zHList.entrycget�s���w�w�|�|�D�G�G�[�%��=�=r*c��|�|j|jd|�S|jj|jd|g|j	||����y�N�entryconfigurer�r�s    r(r5zHList.entryconfiguresQ���;��%�%�d�g�g�/?��G�G�������T�W�W�.��	'��}�}�S�"�%�	'r*c�P�|jj|jd|�S�N�nearestr{)r&r�s  r(r8z
HList.nearests���w�w�|�|�D�G�G�Y��2�2r*c�R�|jj|jd|�y�N�seer{r�s  r(r;z	HList.see��������T�W�W�e�U�+r*c�v�|jj|jddg|j||����y�Nr�r�rpr8s   r(�selection_clearzHList.selection_clear�,��������T�W�W�k�7�L�T�]�]�3��5K�Lr*c�R�|jj|jdd|�S�Nr��includesr{r�s  r(�selection_includeszHList.selection_includes����w�w�|�|�D�G�G�[�*�e�D�Dr*c�V�|jj|jdd||�y�Nr�r�r{�r&�first�lasts   r(�
selection_setzHList.selection_set��������T�W�W�k�5�%��>r*c�R�|jj|jdd|�S)N�showrr{r�s  r(�
show_entryzHList.show_entry����w�w�|�|�D�G�G�V�W�e�<�<r*)rNNrQ)9rRrSrTrUr\r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��header_existr�r�r�r�r�r�r�r�r�rrr	rrrrrrrrr"r&r)r+r.r0r2r5r8r;r?rDrKrOrVr*r(r�r�Xs]���#�r�<� �L� $��K�6�1�0�/�8�=�;�8�3�8�3�&(�P�)+�.�A�Q�
!�L�7�<�6�+-�N�.0�Q�F�D�<�A�7�F�$�<�9�9�>�>�<�>�<�$�F�.0�'�+-�N�C�<�>�)+�'�3�,�#%�M�E�?�=r*r�c��eZdZdZdifd�Zy)�	InputOnlyz?InputOnly - Invisible widget. Unix only.

    Subwidgets - NoneNc�8�tj||dd||�y)N�tixInputOnlyrrs    r(r\zInputOnly.__init__s�����4����s�B�Gr*r_rVr*r(rSrSs���#�r�Hr*rSc��eZdZdZdifd�Zy)�
LabelEntryaLabelEntry - Entry field with label. Packages an entry widget
    and a label into one mega widget. It can be used to simplify the creation
    of ``entry-form'' type of interface.

    Subwidgets       Class
    ----------       -----
    label       Label
    entry       EntryNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelEntry�	labelsider�r�r)r�r\r�r�r rs    r(r\zLabelEntry.__init__,�P�����4���'�	�2�C��	=�'2�4��'A����G�$�'2�4��'A����G�$r*r_rVr*r(rWrW"s���#�r�Br*rWc��eZdZdZdifd�Zy)�
LabelFrameaeLabelFrame - Labelled Frame container. Packages a frame widget
    and a label into one mega widget. To create widgets inside a
    LabelFrame widget, one creates the new widgets relative to the
    frame subwidget and manage them inside the frame subwidget.

    Subwidgets       Class
    ----------       -----
    label       Label
    frame       FrameNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelFramerZr�r��frame)r�r\r�r��_dummyFramers    r(r\zLabelFrame.__init__=r[r*r_rVr*r(r]r]2s���#�r�Br*r]c�6�eZdZdZifd�Zifd�Zd�Zd�Zd�Zy)�ListNoteBookaA ListNoteBook widget is very similar to the TixNoteBook widget:
    it can be used to display many windows in a limited space using a
    notebook metaphor. The notebook is divided into a stack of pages
    (windows). At one time only one of these pages can be shown.
    The user can navigate through these pages by
    choosing the name of the desired page in the hlist subwidget.c���tj||ddg||�t|dd��|jd<t	|d�|jd<t|d�|jd<y)N�tixListNoteBookr��panerr�rD�shlist)r�r\�_dummyPanedWindowr�rH�_dummyScrolledHListrs    r(r\zListNoteBook.__init__Lsh�����4��):�Y�K��b�Q�&7��f�KL�'N����F�#�'2�4��'A����G�$�(;�D�(�(K����H�%r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr��r$r%rqr7r�r��r&rCr9r:s    r(r
zListNoteBook.addT�T��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�$<����D�!��"�"�4�(�(r*c�$�|j|�SrQ�r�rBs  r(�pagezListNoteBook.pageY����~�~�d�#�#r*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|S�N�pages�r$r�r%rqr�r��r&r��retr�s    r(rtzListNoteBook.pages\�R�����!�!�$�'�'�,�,�t�w�w��"@�A�����A��J�J�t�~�~�a�(�)���
r*c�R�|jj|jd|�y�N�raiser{rBs  r(�
raise_pagezListNoteBook.raise_paged��������T�W�W�g�t�,r*N)	rRrSrTrUr\r
rprtr|rVr*r(rcrcDs,��E�$&�L��)�
$��-r*rcc��eZdZdZdifd�Zy)�MeterzuThe Meter widget can be used to show the progress of a background
    job which may take a long time to execute.
    Nc�:�tj||ddg||�y)N�tixMeterr�rrs    r(r\zMeter.__init__ls�����4���%�;��R�	1r*r_rVr*r(rrgs���#��1r*rc�D�eZdZdZdifd�Zifd�Zd�Zd�Zd�Zd�Z	d	�Z
y)
�NoteBookz�NoteBook - Multi-page container widget (tabbed notebook metaphor).

    Subwidgets       Class
    ----------       -----
    nbframe       NoteBookFrame
    <pages>       page widgets added dynamically with the add methodNc�p�tj||ddg||�t|dd��|jd<y)N�tixNoteBookr��nbframerr�)r�r\r�r�rs    r(r\zNoteBook.__init__xs9�����4��}�y�k�3��K�)5�d�I�IJ�*L����I�&r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr�rkrls    r(r
zNoteBook.add}rmr*c��|jj|jd|�|j|j	�|j|=yr��r$r%rqr�rhrBs  r(r�zNoteBook.delete��?�������T�W�W�h��-����D�!�)�)�+�����%r*c�$�|j|�SrQrorBs  r(rpz
NoteBook.page�rqr*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|Srsrurvs    r(rtzNoteBook.pages�rxr*c�R�|jj|jd|�yrzr{rBs  r(r|zNoteBook.raise_page�r}r*c�N�|jj|jd�S)N�raisedr{ris r(r�zNoteBook.raised�s���w�w�|�|�D�G�G�X�.�.r*)rRrSrTrUr\r
r�rprtr|r�rVr*r(r�r�ps8��H�#�r�L�
�)�
&�
$��-�/r*r�c��eZdZy)�
NoteBookFrameN)rRrSrTrVr*r(r�r��s��r*r�c�@�eZdZdZifd�Zifd�Zifd�Zd�Zd�Zd�Z	y)	�
OptionMenuz�OptionMenu - creates a menu button of options.

    Subwidget       Class
    ---------       -----
    menubutton      Menubutton
    menu            Menuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�
tixOptionMenur��
menubutton�menu�r�r\�_dummyMenubuttonr��
_dummyMenurs    r(r\zOptionMenu.__init__�sJ�����4���9�+�s�B�O�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�x�|jj|jdd|g|j||����y)Nr
�commandrprls    r(�add_commandzOptionMenu.add_command�s.��������T�W�W�e�Y��N�t�}�}�S�"�7M�Nr*c�x�|jj|jdd|g|j||����y)Nr
�	separatorrprls    r(�
add_separatorzOptionMenu.add_separator�s.��������T�W�W�e�[�$�P����s�B�9O�Pr*c�R�|jj|jd|�yr�r{rBs  r(r�zOptionMenu.delete���������T�W�W�h��-r*c�R�|jj|jd|�y)N�disabler{rBs  r(r�zOptionMenu.disable�s�������T�W�W�i��.r*c�R�|jj|jd|�y)N�enabler{rBs  r(r�zOptionMenu.enable�r�r*N)
rRrSrTrUr\r�r�r�r�r�rVr*r(r�r��s6���$&�?�
%'�O�')�Q�.�/�.r*r�c�F�eZdZdZifd�Zifd�Zd�Zd�Zd�Zifd�Z	d�Z
y	)
�PanedWindowa�PanedWindow - Multi-pane container widget
    allows the user to interactively manipulate the sizes of several
    panes. The panes can be arranged either vertically or horizontally.The
    user changes the sizes of the panes by dragging the resize handle
    between two panes.

    Subwidgets       Class
    ----------       -----
    <panes>       g/p widgets added dynamically with the add method.c�<�tj||dddg||�y)N�tixPanedWindowrr�rrs    r(r\zPanedWindow.__init__�s"�����4��)9�M�9�;U�WZ�\^�_r*c���|jj|jd|g|j||����t	||d��|j
|<|j
|S)Nr
r)r�rkrls    r(r
zPanedWindow.add�sZ��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�DE�%G����D�!��"�"�4�(�(r*c��|jj|jd|�|j|j	�|j|=yr�r�rBs  r(r�zPanedWindow.delete�r�r*c�R�|jj|jd|�y)Nr}r{rBs  r(r}zPanedWindow.forget�r�r*c�R�|jj|jd||�S)N�panecgetr{r�s   r(r�zPanedWindow.panecget�s���w�w�|�|�D�G�G�Z���<�<r*c��|�|j|jd|�S|jj|jd|g|j	||����y)N�
paneconfigurer�r�s    r(r�zPanedWindow.paneconfigure�sJ���;��%�%�d�g�g���F�F�������T�W�W�o�u�N�t�}�}�S�"�7M�Nr*c���|jj|jj|jd��}|D�cgc]}|j	|���c}Scc}w)N�panes)r$r�r%rqr�)r&r�r�s   r(r�zPanedWindow.panes�sJ�����!�!�$�'�'�,�,�t�w�w��"@�A��+0�1�5�a����q�!�5�1�1��1s�AN)rRrSrTrUr\r
r�r}r�r�r�rVr*r(r�r��s<��H�$&�`��)�&�
.�=�(*�O�
2r*r�c�,�eZdZdZifd�Zd�Zd�Zd�Zy)�	PopupMenuaPopupMenu widget can be used as a replacement of the tk_popup command.
    The advantage of the Tix PopupMenu widget is it requires less application
    code to manipulate.


    Subwidgets       Class
    ----------       -----
    menubutton       Menubutton
    menu       Menuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixPopupMenur�r�r�r�rs    r(r\zPopupMenu.__init__�sJ�����4���)��c�2�N�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�f�|jj|jd|j�y)Nr�r{r�s  r(r�zPopupMenu.bind_widget���������T�W�W�f�f�i�i�0r*c�f�|jj|jd|j�yr�r{r�s  r(rzPopupMenu.unbind_widget�rr*c�j�|jj|jd|j||�y)N�postr{)r&r�r�r�s    r(�post_widgetzPopupMenu.post_widget�s"�������T�W�W�f�f�i�i��A�6r*N)rRrSrTrUr\r�rr�rVr*r(r�r��s ���$&�?�
1�3�7r*r�c�2�eZdZdZifd�Zd�Zd�Zd�Zd�Zy)�ResizeHandlez;Internal widget to draw resize handles on Scrolled widgets.c�@�gd�}tj||d|||�y)N)	r�r��cursorfg�cursorbg�
handlesize�	hintcolor�	hintwidthr�r��tixResizeHandler)r&r�r9r:�flagss     r(r\zResizeHandle.__init__�s'����	���4��):� �#�r�	+r*c�f�|jj|jd|j�y)N�attachwidgetr{r�s  r(�
attach_widgetzResizeHandle.attach_widget��������T�W�W�n�f�i�i�8r*c�f�|jj|jd|j�y)N�detachwidgetr{r�s  r(�
detach_widgetzResizeHandle.detach_widget
r�r*c�f�|jj|jd|j�y)Nr�r{r�s  r(r�zResizeHandle.hide
r�r*c�f�|jj|jd|j�y)NrNr{r�s  r(rNzResizeHandle.showr�r*N)	rRrSrTrUr\r�r�r�rNrVr*r(r�r��s!��E�#%�+�9�9�1�1r*r�c��eZdZdZifd�Zy)�
ScrolledHListz0ScrolledHList - HList with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledHListr�rDrErFrGrs    r(r\zScrolledHList.__init__�e�����4��);�i�[���	$�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r����:�$&�Br*r�c��eZdZdZifd�Zy)�ScrolledListBoxz4ScrolledListBox - Listbox with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledListBoxr��listboxrErF)r�r\�
_dummyListboxr�rIrs    r(r\zScrolledListBox.__init__"sc�����4��)=�	�{�C�QS�T�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�s��>�$&�Br*r�c��eZdZdZifd�Zy)�ScrolledTextz.ScrolledText - Text with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTextr�rrErF)r�r\�
_dummyTextr�rIrs    r(r\zScrolledText.__init__,sb�����4��):�Y�K��b�Q�&0��v�&>����F�#�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�(s��8�$&�Br*r�c��eZdZdZifd�Zy)�
ScrolledTListz0ScrolledTList - TList with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTListr��tlistrErF)r�r\�_dummyTListr�rIrs    r(r\zScrolledTList.__init__6r�r*Nr_rVr*r(r�r�2r�r*r�c��eZdZdZifd�Zy)�ScrolledWindowz2ScrolledWindow - Window with automatic scrollbars.c���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledWindowr�rrErF)r�r\rar�rIrs    r(r\zScrolledWindow.__init__Asc�����4��)<�y�k�3�PR�S�(3�D�(�(C����H�%�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr_rVr*r(r�r�=s��<�$&�Br*r�c�*�eZdZdZifd�Zifd�Zd�Zy)�Selectz�Select - Container of button subwidgets. It can be used to provide
    radio-box or check-box style of selection options for the user.

    Subwidgets are buttons added dynamically using the add method.c�n�tj||dgd�||�t|d�|jd<y)N�	tixSelect)�	allowzero�radiorrZr�r�r�rs    r(r\zSelect.__init__Ns9�����4���'���	$�(3�4��'A����G�$r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr�rrls    r(r
z
Select.addUrmr*c�R�|jj|jd|�yrr{rBs  r(rz
Select.invokeZr�r*NrrVr*r(r�r�Gs"��F�$&�B��)�
.r*r�c��eZdZdZdifd�Zy)�Shellz'Toplevel window.

    Subwidgets - NoneNc�<�tj||dddg||�y)N�tixShellr��titlerrs    r(r\zShell.__init__bs �����4���i��5I�3�PR�Sr*r_rVr*r(r�r�]s���#�r�Tr*r�c�.�eZdZdZdifd�Zd�Zd�Zd�Zy)�DialogShellz�Toplevel window, with popup popdown and center methods.
    It tells the window manager that it is a dialog window and should be
    treated specially. The exact treatment depends on the treatment of
    the window manager.

    Subwidgets - NoneNc�<�tj||dgd�||�y)N�tixDialogShell)r�r��mapped�	minheight�minwidthr��	transientrrs    r(r\zDialogShell.__init__ns!�����4��+�3�47��		=r*c�P�|jj|jd�yr{r{ris r(r|zDialogShell.popdownur}r*c�P�|jj|jd�yrwr{ris r(rxzDialogShell.popupxryr*c�P�|jj|jd�y)N�centerr{ris r(rzDialogShell.center{r=r*)rRrSrTrUr\r|rxrrVr*r(r�r�es"���#�r�=�)�'�(r*r�c�"�eZdZdZdifd�Zd�Zy)�StdButtonBoxz@StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) Nc��tj||dddg||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)N�tixStdButtonBoxrr�re�applyrd�help)r�r\rr�rs    r(r\zStdButtonBox.__init__�s������4��):�)�9�5�s�B�	@�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*c�p�||jvr(|jj|jd|�yyrrrBs  r(rzStdButtonBox.invoke�rr*)rRrSrTrUr\rrVr*r(rr~s��J�"��A�2r*rc��eZdZdZdifd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
ifd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Zdd�Zy)�TLista�TList - Hierarchy display widget which can be
    used to display data in a tabular format. The list entries of a TList
    widget are similar to the entries in the Tk listbox widget. The main
    differences are (1) the TList widget can display the list entries in a
    two dimensional format and (2) you can use graphical images as well as
    multiple colors and fonts for the list entries.

    Subwidgets - NoneNc�:�tj||ddg||�y)N�tixTListr�rrs    r(r\zTList.__init__�s�����4���i�[�#�r�Jr*c�T�|jj|jdd|�y)N�activer�r{r0s  r(�
active_setzTList.active_set�r�r*c�R�|jj|jdd�y)Nrr�r{ris r(�active_clearzTList.active_clear�r�r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.anchor_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.anchor_clear�r�r*c�T�|jj|jd||�yr�r{�r&�from_�tos   r(r�zTList.delete�s�������T�W�W�h��r�2r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.dragsite_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.dragsite_clear�r�r*c�T�|jj|jdd|�yr�r{r0s  r(r�zTList.dropsite_set�r�r*c�R�|jj|jdd�yr�r{ris r(r�zTList.dropsite_clear�r�r*c�v�|jj|jd|g|j||����yr+rp)r&r-r9r:s    r(r,zTList.insert�s,��������T�W�W�h��G��
�
�c�2�0F�Gr*c�P�|jj|jdd�S)Nr�rr{ris r(�info_activezTList.info_active�rr*c�P�|jj|jdd�Sr�r{ris r(rzTList.info_anchor�rr*c�R�|jj|jdd|�S)Nr��downr{r0s  r(�	info_downzTList.info_down�r
r*c�R�|jj|jdd|�S)Nr��leftr{r0s  r(�	info_leftzTList.info_left�r
r*c�R�|jj|jdd|�S)Nr��rightr{r0s  r(�
info_rightzTList.info_right�rPr*c��|jj|jdd�}|jj|�Sr!rr�s  r(r"zTList.info_selection�r#r*c�P�|jj|jdd�S)Nr�r�r{ris r(�	info_sizezTList.info_size�s���w�w�|�|�D�G�G�V�V�4�4r*c�R�|jj|jdd|�S)Nr��upr{r0s  r(�info_upz
TList.info_up�s���w�w�|�|�D�G�G�V�T�5�9�9r*c�R�|jj|jd||�Sr7r{�r&r�r�s   r(r8z
TList.nearest�s���w�w�|�|�D�G�G�Y��1�5�5r*c�R�|jj|jd|�yr:r{r0s  r(r;z	TList.see�r<r*c�v�|jj|jddg|j||����yr>rpr8s   r(r?zTList.selection_clear�r@r*c�R�|jj|jdd|�SrBr{r0s  r(rDzTList.selection_includes�rEr*c�V�|jj|jdd||�yrGr{rHs   r(rKzTList.selection_set�rLr*rQ)rRrSrTrUr\rrr�r�r�r�r�r�r�r,r!rr%r(r+r"r.r1r8r;r?rDrKrVr*r(r
r
�s����#�r�K�6�1�6�1�3�8�3�8�3�!#�H�7�7�<�<�=�$�5�:�6�,�#%�M�E�?r*r
c�<�eZdZdZdifd�Zd�Zd�Zd�Zd�Zd	d�Z	y)
�Treez�Tree - The tixTree widget can be used to display hierarchical
    data in a tree form. The user can adjust
    the view of the tree by opening or closing parts of the tree.Nc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixTreer�rDrErFrGrs    r(r\z
Tree.__init__�sd�����4���%�;��R�	1�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�P�|jj|jd�y�aThis command calls the setmode method for all the entries in this
     Tree widget: if an entry has no child entries, its mode is set to
     none. Otherwise, if the entry has any hidden child entries, its mode is
     set to open; otherwise its mode is set to close.�autosetmodeNr{ris r(r>zTree.autosetmode����
	
�����T�W�W�m�,r*c�R�|jj|jd|�y�z8Close the entry given by entryPath if its mode is close.�closeNr{�r&�	entrypaths  r(rBz
Tree.close���������T�W�W�g�y�1r*c�P�|jj|jd|�S�z9Returns the current mode of the entry given by entryPath.�getmoder{rCs  r(rHzTree.getmode�����w�w�|�|�D�G�G�Y�	�:�:r*c�R�|jj|jd|�y�z6Open the entry given by entryPath if its mode is open.�openNr{rCs  r(rLz	Tree.open���������T�W�W�f�i�0r*c�T�|jj|jd||�y)a�This command is used to indicate whether the entry given by
     entryPath has children entries and whether the children are visible. mode
     must be one of open, close or none. If mode is set to open, a (+)
     indicator is drawn next the entry. If mode is set to close, a (-)
     indicator is drawn next the entry. If mode is set to none, no
     indicators will be drawn for this entry. The default mode is none. The
     open mode indicates the entry has hidden children and this entry can be
     opened by the user. The close mode indicates that all the children of the
     entry are now visible and the entry can be closed by the user.�setmodeNr{�r&rD�modes   r(rOzTree.setmodes��	
�����T�W�W�i��D�9r*)�none)
rRrSrTrUr\r>rBrHrLrOrVr*r(r9r9�s.��E�
#��B�-�2�;�1�
:r*r9c�J�eZdZdZdifd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
dd
�Zy)�	CheckListz�The CheckList widget
    displays a list of items to be selected by the user. CheckList acts
    similarly to the Tk checkbutton or radiobutton widgets, except it is
    capable of handling many more items than checkbuttons or radiobuttons.
    Nc���tj||dddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixCheckListr�r�rDrErFrGrs    r(r\zCheckList.__init__sg�����4���%�w�/��b�	:�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�P�|jj|jd�yr=r{ris r(r>zCheckList.autosetmoder?r*c�R�|jj|jd|�yrAr{rCs  r(rBzCheckList.close#rEr*c�P�|jj|jd|�SrGr{rCs  r(rHzCheckList.getmode'rIr*c�R�|jj|jd|�yrKr{rCs  r(rLzCheckList.open+rMr*c��|jj|jj|jd|��S)z�Returns a list of items whose status matches status. If status is
     not specified, the list of items in the "on" status will be returned.
     Mode can be on, off, default�getselection)r$r�r%rq)r&rQs  r(r\zCheckList.getselection/s.���w�w� � ������d�g�g�~�t�!L�M�Mr*c�P�|jj|jd|�S)z(Returns the current status of entryPath.�	getstatusr{rCs  r(r^zCheckList.getstatus5s���w�w�|�|�D�G�G�[�)�<�<r*c�T�|jj|jd||�y)z~Sets the status of entryPath to be status. A bitmap will be
     displayed next to the entry its status is on, off or default.�	setstatusNr{rPs   r(r`zCheckList.setstatus9s��	
�����T�W�W�k�9�d�;r*)�on)rRrSrTrUr\r>rBrHrLr\r^r`rVr*r(rTrTs8���#��B�-�2�;�1�N�=�<r*rTc��eZdZdd�Zy)rc�4�tj||||�yrQ�r�r\�r&r�rCr�s    r(r\z_dummyButton.__init__E������d�F�D�2D�Er*N�r��rRrSrTr\rVr*r(rrD���Fr*rc��eZdZdd�Zy)rjc�4�tj||||�yrQrdres    r(r\z_dummyCheckbutton.__init__Irfr*NrgrhrVr*r(rjrjHrir*rjc��eZdZdd�Zy)r c�4�tj||||�yrQrdres    r(r\z_dummyEntry.__init__Mrfr*NrgrhrVr*r(r r Lrir*r c��eZdZdd�Zy)rac�4�tj||||�yrQrdres    r(r\z_dummyFrame.__init__Qrfr*NrgrhrVr*r(raraPrir*rac��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyLabel.__init__Urfr*NrgrhrVr*r(r�r�Trir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyListbox.__init__Yrfr*NrgrhrVr*r(r�r�Xrir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyMenu.__init__]rfr*NrgrhrVr*r(r�r�\rir*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyMenubutton.__init__arfr*NrgrhrVr*r(r�r�`rir*r�c��eZdZdd�Zy)rIc�4�tj||||�yrQrdres    r(r\z_dummyScrollbar.__init__erfr*NrgrhrVr*r(rIrIdrir*rIc��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyText.__init__irfr*NrgrhrVr*r(r�r�hrir*r�c��eZdZdd�Zy)r!c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr�rErF)r�r\r�r�rIres    r(r\z_dummyScrolledListBox.__init__ms\�����d�F�D�2D�E�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*NrgrhrVr*r(r!r!l���Br*r!c��eZdZdd�Zy)rHc�4�tj||||�yrQrdres    r(r\z_dummyHList.__init__trfr*NrgrhrVr*r(rHrHsrir*rHc��eZdZdd�Zy)ric���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y�NrDrErF�r�r\rHr�rIres    r(r\z_dummyScrolledHList.__init__x�\�����d�F�D�2D�E�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*NrgrhrVr*r(ririwr~r*ric��eZdZdd�Zy)r�c�4�tj||||�yrQrdres    r(r\z_dummyTList.__init__rfr*NrgrhrVr*r(r�r�~rir*r�c��eZdZdd�Zy)rkc��tj|||d|g�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)Nrr�rrrrr)r�r\r�r�r rr!r"res    r(r\z_dummyComboBox.__init__�s������d�F�D�7�;M�2N�O�'2�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B3�3	B?�>B?NrgrhrVr*r(rkrk�s��r*rkc��eZdZdd�Zy)r]c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<yr�r�res    r(r\z_dummyDirList.__init__�r�r*NrgrhrVr*r(r]r]�r~r*r]c��eZdZdd�Zy)ruc��tj||||�t|d�|jd<t	|d�|jd<y)Nr[r\)r�r\r]r�r^res    r(r\z_dummyDirSelectBox.__init__�sE�����d�F�D�2D�E�)6�t�Y�)G����I�&�(:�4��(J����H�%r*NrgrhrVr*r(ruru�s��Kr*ruc��eZdZdd�Zy)r�c���tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d�|jd<t
|d�|jd<y)	NrdrerfrgrOr[rhri)r�r\rr�rjrkr!res    r(r\z_dummyExFileSelectBox.__init__�s������d�F�D�2D�E�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)>�t�Y�)O����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*NrgrhrVr*r(r�r��s��	Rr*r�c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr[rirnr�)r�r\r!r�rkres    r(r\z_dummyFileSelectBox.__init__�ss�����d�F�D�2D�E�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*NrgrhrVr*r(r�r��s��Mr*r�c��eZdZdd�Zy)r^c�f�tj||||�t|d�|jd<y)Nr\)r�r\rkr�res    r(r\z_dummyFileComboBox.__init__�s.�����d�F�D�2D�E�(6�t�X�(F����H�%r*NrgrhrVr*r(r^r^�s��Gr*r^c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)Nrer	rdr
)r�r\rr�res    r(r\z_dummyStdButtonBox.__init__�ss�����d�F�D�2D�E�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*NrgrhrVr*r(r�r��s��Ar*r�c��eZdZdd�Zy)�_dummyNoteBookFramec�4�tj||||�yrQrdres    r(r\z_dummyNoteBookFrame.__init__�rfr*N)rrhrVr*r(r�r��rir*r�c��eZdZdd�Zy)rhc�4�tj||||�yrQrdres    r(r\z_dummyPanedWindow.__init__�rfr*NrgrhrVr*r(rhrh�rir*rhc�N�|jjd|j�S)zzReturns the qualified path name for the widget. Normally used to set
    default options for subwidgets. See tixwidgets.py�
tixOptionNamer{)r�s r(�
OptionNamer��s���9�9�>�>�/�6�9�9�5�5r*c�h�d}|j�D]}|dz|zdz|zdz||zdz}�|S)Nrfz{{z} {z - z}} )�keys)�dict�s�types   r(�FileTypeListr��sF��
�A��	�	���
��H�t�O�e�#�d�*�U�2�T�$�Z�?�%�G����Hr*c��eZdZdZy)�CObjViewaBThis file implements the Canvas Object View widget. This is a base
    class of IconView. It implements automatic placement/adjustment of the
    scrollbars according to the canvas objects inside the canvas subwidget.
    The scrollbars are adjusted so that the canvas is just large enough
    to see all the objects.
    N)rRrSrTrUrVr*r(r�r��s���	r*r�c��eZdZdZdifd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zdd�Z
d
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zy)�Grida}The Tix Grid command creates a new window  and makes it into a
    tixGrid widget. Additional options, may be specified on the command
    line or in the option database to configure aspects such as its cursor
    and relief.

    A Grid widget displays its contents in a two dimensional grid of cells.
    Each cell may contain one Tix display item, which may be in text,
    graphics or other formats. See the DisplayStyle class for more information
    about Tix display items. Individual cells, or groups of cells, can be
    formatted with a wide range of attributes, such as its color, relief and
    border.

    Subwidgets - NoneNc�J�g}||_tj||d|||�y)N�tixGrid�r9r�r\r�s     r(r\z
Grid.__init__�s&����������4���F�C��Dr*c�>�|jj|dd�y)zRemoves the selection anchor.r�r�Nr#ris r(r�zGrid.anchor_clears�������T�8�W�-r*c�Z�|j|jj|dd��S)z3Get the (x,y) coordinate of the current anchor cellr�rI�rr$r%ris r(�
anchor_getzGrid.anchor_gets"���}�}�T�W�W�\�\�$��%�@�A�Ar*c�B�|jj|dd||�y)z/Set the selection anchor to the cell at (x, y).r�r�Nr#r3s   r(r�zGrid.anchor_sets�������T�8�U�A�q�1r*c��|�|jj|dd|�y|jj|dd||�y)zdDelete rows between from_ and to inclusive.
        If to is not provided,  delete only row at from_Nr�rr#rs   r(�
delete_rowzGrid.delete_rows7���:��G�G�L�L��x���6��G�G�L�L��x���r�:r*c��|�|jj|dd|�y|jj|dd||�y)zjDelete columns between from_ and to inclusive.
        If to is not provided,  delete only column at from_Nr�rr#rs   r(�
delete_columnzGrid.delete_columns7���:��G�G�L�L��x��5�9��G�G�L�L��x��5�"�=r*c�>�|jj|dd�y)zUIf any cell is being edited, de-highlight the cell  and  applies
        the changes.�editr	Nr#ris r(�
edit_applyzGrid.edit_apply#s��	
�����T�6�7�+r*c�B�|jj|dd||�y)zmHighlights  the  cell  at  (x, y) for editing, if the -editnotify
        command returns True for this cell.r�r�Nr#r3s   r(�edit_setz
Grid.edit_set(s��	
�����T�6�5�!�Q�/r*c�^�|r
|ddk7rd|z}|jj|d|||�S)z&Get the option value for cell at (x,y)rr2r2r#)r&r�r�r.s    r(r2zGrid.entrycget-s4���f�Q�i�3�&��6�\�F��w�w�|�|�D�+�q�!�V�<�<r*c�.�|jd||f||�Sr4)�
_configure)r&r�r�r9r:s     r(r5zGrid.entryconfigure3s����� 0�!�Q�7��b�A�Ar*c	�^�|j|jj|dd||��S)z+Return True if display item exists at (x,y)r�r�)�_getbooleanr$r%r3s   r(rzGrid.info_exists9s(����������T�6�8�Q�� J�K�Kr*c�@�|jj|dd||�Srr#r3s   r(rzGrid.info_bbox=s���w�w�|�|�D�&�&�!�Q�7�7r*c�D�|jj|dd|||�y)z�Moves the range of columns from position FROM through TO by
        the distance indicated by OFFSET. For example, move_column(2, 4, 1)
        moves the columns 2,3,4 to columns 3,4,5.�moverNr#�r&rr�offsets    r(�move_columnzGrid.move_columnAs��	
�����T�6�8�U�B��?r*c�D�|jj|dd|||�y)z�Moves the range of rows from position FROM through TO by
        the distance indicated by OFFSET.
        For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.r�rNr#r�s    r(�move_rowz
Grid.move_rowGs��	
�����T�6�5�%��V�<r*c�\�|j|jj|d||��S)z8Return coordinate of cell nearest pixel coordinate (x,y)r8r�r3s   r(r8zGrid.nearestMs$���}�}�T�W�W�\�\�$�	�1�a�@�A�Ar*c��|j|j|�}|�d|f|z}|jj|d||g|���y)Nz	-itemtyper�)r7r9r$r%)r&r�r�r�r:�argss      r(r�zGrid.setWsH���m�m�D�H�H�b�)������)�D�0�D�������T�5�!�Q�.��.r*c	��|jj|jj|jdd|g|j	i|�����S)a�Queries or sets the size of the column given by
        INDEX.  INDEX may be any non-negative
        integer that gives the position of a given column.
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all columns.
        When no option-value pair is given, this command returns a tuple
        containing the current size setting of the given column.  When
        option-value pairs are given, the corresponding options of the
        size setting of the given column are changed. Options may be one
        of the following:
              pad0 pixels
                     Specifies the paddings to the left of a column.
              pad1 pixels
                     Specifies the paddings to the right of a column.
              size val
                     Specifies the width of a column.  Val may be:
                     "auto" -- the width of the column is set to the
                     width of the widest cell in the column;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the width of the column to the
                     given number of characters.r�r)r$r�r%rqr7�r&r-r:s   r(�size_columnzGrid.size_column]sK��.�w�w� � �������d�g�g�v�x��"5�"�m�m�B��3�"5�6�	6r*c	��|jj|jj|dd|g|ji|�����S)a�Queries or sets the size of the row given by
        INDEX. INDEX may be any non-negative
        integer that gives the position of a given row .
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all rows.
        When no option-value pair is given, this command returns a list con-
        taining the current size setting of the given row . When option-value
        pairs are given, the corresponding options of the size setting of the
        given row are changed. Options may be one of the following:
              pad0 pixels
                     Specifies the paddings to the top of a row.
              pad1 pixels
                     Specifies the paddings to the bottom of a row.
              size val
                     Specifies the height of a row.  Val may be:
                     "auto" -- the height of the row is set to the
                     height of the highest cell in the row;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the height of the row to the
                     given number of characters.r�r)r$r�r%r7r�s   r(�size_rowz
Grid.size_rowwsL��,�w�w� � ��������&�%��"H�15���r�2�1F�"H�I�	Ir*c�T�|jj|jd||�y)z7Clears the cell at (x, y) by removing its display item.�unsetNr{r3s   r(r�z
Grid.unset�s�������T�W�W�g�q�!�,r*rQ)rRrSrTrUr\r�r�r�r�r�r�r�r2r5rrr�r�r8r�r�r�r�rVr*r(r�r��st���"#��E�.�B�2�;�>�,�
0�
=�B�L�8�@�=�B�/�6�4I�2-r*r�c��eZdZdZdifd�Zy)�ScrolledGridzScrolled Grid widgetsNc�J�g}||_tj||d|||�y)N�tixScrolledGridr�r�s     r(r\zScrolledGrid.__init__�s'����������4��):�F�C��Lr*r_rVr*r(r�r��s���#��Mr*r�)wr]�warningsr[r�warn�DeprecationWarning�WINDOW�TEXT�STATUS�	IMMEDIATE�IMAGE�	IMAGETEXT�BALLOON�AUTO�	ACROSSTOP�ASCII�CELL�COLUMN�
DECREASING�
INCREASING�INTEGER�MAIN�MAX�REAL�ROW�S_REGION�X_REGION�Y_REGION�
TCL_DONT_WAIT�TCL_WINDOW_EVENTS�TCL_FILE_EVENTS�TCL_TIMER_EVENTS�TCL_IDLE_EVENTS�TCL_ALL_EVENTSrrXrmr��	__bases__r�r�r�r�rrr2rArSrXrarqr�r�r�r��XView�YViewr�rSrWr]rcrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr
r9rT�Buttonr�Checkbuttonrj�Entryr �Framera�Labelr��Listboxr��Menur��
Menubuttonr��	ScrollbarrI�Textr�r!rHrir�rkr]rur�r�r^r�r�rhr�r�r�r�r�rVr*r(�<module>rs���4
�����
��
�
�-���	�
��
��	���	����	�
��
���	�	��
��	��
�
�
�
�
��
����
�����������
�����������~N�~N�@!����Z�!�.)7�)7�Z#�>�>�3�3�t�g�=�����G����G�X3-�9�3-�p(?�(?�^3�i�3�62�	�2�&*-�y�*-�X(�i�(�B,�i�,�*,�i�,�,K�9�K�&(�i�(�D)�i�)�0)��)�((�I�(�8)�y�)�*
�	�
�2@=�I�u�e�@=�DH�	�H�B��B� B��B�$!-�9�!-�F1�I�1�&/�y�&/�P	�I�	�.��.�8'2�)�'2�R7�	�7�41�9�1�0	B�I�	B�B�i�B�B�9�B�	B�I�	B�B�Y�B�.�Y�.�,T�I�T�(�)�(�2
2�9�
2�Q?�I�u�e�Q?�f*:�9�*:�\.<�	�.<�lF�6�<�F�F��\�F�F�%��F�F�%��F�F�%��F�F�G�\�F�F��|�F�F�z�<�F�F�i��F�F��|�F�B�O�\�B�F�%��F�B�-��B�F�%��F��X�|��"B�G�\�B�K��|�K�
R�O�\�
R�M�-��M�G��<�G�
A��|�A�F�-��F�F��\�F�6�
�	�y�	�f-�9�e�U�f-�RM�4�Mr*__pycache__/tix.cpython-312.opt-2.pyc000064400000261547151710635150013246 0ustar00�

T��h�,��v�ddlZddlZddlZddl�ddlmZejded��dZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z dZ!Gd!�d"�Z"Gd#�d$ejFe"�Z#Gd%�d&�Z$ejJjLe$fzejJ_&Gd'�d(ejJ�Z'Gd)�d*e'�Z(Gd+�d,�Z)Gd-�d.e'�Z*Gd/�d0e'�Z+Gd1�d2e'�Z,Gd3�d4e'�Z-Gd5�d6e'�Z.Gd7�d8e'�Z/Gd9�d:e'�Z0Gd;�d<e'�Z1Gd=�d>e'�Z2Gd?�d@e'�Z3GdA�dBe'�Z4GdC�dDe'�Z5GdE�dFe'�Z6GdG�dHe'e7e8�Z9GdI�dJe'�Z:GdK�dLe'�Z;GdM�dNe'�Z<GdO�dPe'�Z=GdQ�dRe'�Z>GdS�dTe'�Z?GdU�dVe'�Z@GdW�dXe'�ZAGdY�dZe'�ZBGd[�d\e'�ZCGd]�d^e'�ZDGd_�d`e'�ZEGda�dbe'�ZFGdc�dde'�ZGGde�dfe'�ZHGdg�dhe'�ZIGdi�dje'�ZJGdk�dle'�ZKGdm�dne'�ZLGdo�dpe'�ZMGdq�dre'e7e8�ZNGds�dte'�ZOGdu�dve'�ZPGdw�dxeQe(�ZRGdy�dzeSe(�ZTGd{�d|eUe(�ZVGd}�d~eWe(�ZXGd�d�eYe(�ZZGd��d�e[e(�Z\Gd��d�e]e(�Z^Gd��d�e_e(�Z`Gd��d�eae(�ZbGd��d�ece(�ZdGd��d�eFe(�ZeGd��d�e9e(�ZfGd��d�eEe(�ZgGd��d�eNe(�ZhGd��d�e,e(�ZiGd��d�e.e(�ZjGd��d�e0e(�ZkGd��d�e1e(�ZlGd��d�e4e(�ZmGd��d�e,e(�ZnGd��d�eMe(�ZoGd��d�e@e(�ZpGd��d�eBe(�Zqd��Zrd��ZsGd��d�e'�ZtGd��d�e'e7e8�ZuGd��d�eu�Zvy)��N)�*)�	_cnfmergeznThe Tix Tk extension is unmaintained, and the tkinter.tix wrapper module is deprecated in favor of tkinter.ttk�)�
stacklevel�window�text�status�	immediate�image�	imagetext�balloon�auto�	acrosstop�ascii�cell�column�
decreasing�
increasing�integer�main�max�real�rowzs-regionzx-regionzy-region���� c�D�eZdZ	d�Zd�Zd
d�Zd
d�Zd�Zd�Zd�Z	d
d	�Z
y)�
tixCommandc�>�	|jjdd|�S)N�tix�addbitmapdir��tk�call)�self�	directorys  �$/usr/lib64/python3.12/tkinter/tix.py�tix_addbitmapdirztixCommand.tix_addbitmapdirYs ��	��w�w�|�|�E�>�9�=�=�c�>�	|jjdd|�S)Nr!�cgetr#�r&�options  r(�tix_cgetztixCommand.tix_cgetes ��	��w�w�|�|�E�6�6�2�2r*Nc��	|rt||f�}n
|rt|�}|�|jdd�St|t�r|j	ddd|z�S|j
j
d|j|�z�S)Nr!�	configure�-)r!r1)r�
_getconfigure�
isinstance�str�_getconfigure1r$r%�_options�r&�cnf�kws   r(�
tix_configureztixCommand.tix_configurels���		���S�"�I�&�C�
��C�.�C��;��%�%�e�[�9�9��c�3���&�&�u�k�3�s�7�C�C��w�w�|�|�0�4�=�=��3E�E�F�Fr*c�z�	|�|jjdd|�S|jjdd�S)Nr!�
filedialogr#)r&�dlgclasss  r(�tix_filedialogztixCommand.tix_filedialog�s;��	����7�7�<�<��|�X�>�>��7�7�<�<��|�4�4r*c�>�	|jjdd|�S)Nr!�	getbitmapr#�r&�names  r(�
tix_getbitmapztixCommand.tix_getbitmap�s ��	��w�w�|�|�E�;��5�5r*c�>�	|jjdd|�S)Nr!�getimager#rBs  r(�tix_getimageztixCommand.tix_getimage�s ��
	��w�w�|�|�E�:�t�4�4r*c�@�	|jjddd|�S)Nr!r.�getr#rBs  r(�tix_option_getztixCommand.tix_option_get�s"��	��w�w�|�|�E�8�U�D�9�9r*c��	|�|jjdd|||�S|jjdd||�S)Nr!�resetoptionsr#)r&�	newScheme�
newFontSet�
newScmPrios    r(�tix_resetoptionsztixCommand.tix_resetoptions�sC��
	��!��7�7�<�<��~�y�*�j�Y�Y��7�7�<�<��~�y�*�M�Mr*�N)�__name__�
__module__�__qualname__r)r/r;r?rDrGrJrP�r*r(rrNs1���
>�3�G�,5�	6�5�:�"Nr*rc��eZdZ	dd�Zd�Zy)�TkNc�n�tjj||||�tjjd�}|jjd�|�<|jjd|z�|jjd|z�|jjd�y)N�TIX_LIBRARYz<global auto_path; lappend auto_path [file dir [info nameof]]z(global auto_path; lappend auto_path {%s}z,global tcl_pkgPath; lappend tcl_pkgPath {%s}zpackage require Tix)�tkinterrW�__init__�os�environrIr$�eval)r&�
screenName�baseName�	className�tixlibs     r(r[zTk.__init__�s����
�
���D�*�h�	�B������
�.�������S�T����G�G�L�L�C�f�L�M��G�G�L�L�G�&�P�Q�	
�����*�+r*c�f�|jdd�tjj|�y)N�WM_DELETE_WINDOW�)�protocolrZrW�destroy�r&s r(rgz
Tk.destroy�s#���
�
�(�"�-��
�
���4� r*)NN�Tix�rRrSrTr[rgrUr*r(rWrW�s��@�,�!r*rWc�D�eZdZ	ifd�ZeZd�Zd�Zd�Zd	d�Zd
d�Z	d�Z
y)�Formc�t�|jjd|jg|j||����y)N�tixForm�r$r%�_wr7r8s   r(�configzForm.config�s*��������Y����A�$�-�-��R�*@�Ar*c�4�tj|||i�yrQ)rl�form�r&�key�values   r(�__setitem__zForm.__setitem__�s���	�	�$��e��%r*c�P�|jjdd|j�S)Nrn�check�r$r%rprhs r(ryz
Form.check�s���w�w�|�|�I�w����8�8r*c�R�|jjdd|j�y)Nrn�forgetrzrhs r(r|zForm.forget�s�������Y��$�'�'�2r*c�4�|sn|sl|jjdd|j�}|jj|�}d}|D]!}||jj	|�fz}�#|S|jjdd|j||�S)Nrn�gridrU)r$r%rp�	splitlist�getint)r&�xsize�ysize�x�y�zs      r(r~z	Form.grid�s����������Y�����8�A����!�!�!�$�A��A����������*�,�,����H��w�w�|�|�I�v�t�w�w��u�E�Er*Nc��|s'|jjdd|j�S|ddk7rd|z}|jjdd|j|�S)Nrn�inforr2rzr-s  r(r�z	Form.infosR����7�7�<�<�	�6�4�7�7�;�;��!�9����6�\�F��w�w�|�|�I�v�t�w�w��?�?r*c���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)Nrn�slaves)r$rr%rp�
_nametowidget�r&r�s  r(r�zForm.slaves
s`�����!�!��w�w�|�|� �(�D�G�G�5�6�7�6�+,��"�"�1�%�6�7�	7��7s�A)rrrQ)rRrSrTrqrsrwryr|r~r�r�rUr*r(rlrl�s9��2�
�B��D�&�9�3�F�@�7r*rlc�\�eZdZ	dddiifd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
idfd
�Zd�Zy)�	TixWidgetNc��|rt||f�}nt|�}d}|r|jd�ndg}t|j��D]\}}||vs�|d|z|fz}||=�||_|j||�|r(|jj||jg|���|rtj||�i|_y)NrU�optionsr2)r�append�list�items�
widgetName�_setupr$r%rp�Widgetrq�subwidget_list)	r&�masterr��static_optionsr9r:�extra�k�vs	         r(r[zTixWidget.__init__!s�����S�"�I�&�C��C�.�C�����!�!�)�,�'�[�N���	�	��$�C�A�a��N�"���q��!��,����F�%�
%������F�C� ���D�G�G�L�L��T�W�W�5�u�5���M�M�$��$�
!��r*c�R�||jvr|j|St|��rQ)r��AttributeErrorrBs  r(�__getattr__zTixWidget.__getattr__Ns,���4�&�&�&��&�&�t�,�,��T�"�"r*c�T�	|jjd|j|�y)N�tixSetSilentrz)r&rvs  r(�
set_silentzTixWidget.set_silentSs��?������^�T�W�W�e�4r*c��	|j|�}|std|zdz|jz��|t|j�dzd}|j|�S)Nz
Subwidget z not child of �)�_subwidget_name�TclError�_name�lenrpr�)r&rC�ns   r(�	subwidgetzTixWidget.subwidgetWsb��	�� � ��&����<�$�.�1A�A�D�J�J�N�O�O�
�c�$�'�'�l�1�n�o����!�!�!�$�$r*c���	|j�}|sgSg}|D]>}|t|j�dzd}	|j|j	|���@|S#Y�GxYw)Nr�)�_subwidget_namesr�rpr�r�)r&�names�retlistrCs    r(�subwidgets_allzTixWidget.subwidgets_allaso��$��%�%�'����I����D���D�G�G��Q���(�D�
����t�1�1�$�7�8�����
��s� A�A!c�r�		|jj|jd|�S#t$rYywxYw)Nr�)r$r%rpr�rBs  r(r�zTixWidget._subwidget_nameps7��E�	��7�7�<�<�����d�;�;���	��	�s�&*�	6�6c��		|jj|jdd�}|jj|�S#t$rYywxYw)N�
subwidgetsz-all)r$r%rprr�r�s  r(r�zTixWidget._subwidget_nameswsK��0�	������T�W�W�l�F�;�A��7�7�$�$�Q�'�'���	��	�s�AA�	A�Ac���	|dk(ryt|t�st|�}t|t�st|�}|j�}|D]#}|jj|dd|z|��%y)Nrer1r2)r4r5�reprr�r$r%)r&r.rvr�rCs     r(�
config_allzTixWidget.config_allsg��F��R�<���F�C�(��&�\�F��%��%���K�E��%�%�'���D��G�G�L�L��{�C�&�L�%�@�r*c��|�|}|r|rt||f�}n|r|}d}|j�D]+\}}t|�r|j|�}|d|z|fz}�-|jjdd|f|z�S)NrUr2r�create)rr��callable�	_registerr$r%)r&�imgtyper9r�r:r�r�r�s        r(�image_createzTixWidget.image_create�s����>��F�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���{��N�N�1�%����Q���
�*�G� ��y�y�~�~�w��'�;�g�E�F�Fr*c�^�	|jjdd|�y#t$rYywxYw)Nr�delete)r$r%r�)r&�imgnames  r(�image_deletezTixWidget.image_delete�s-��	��G�G�L�L��(�G�4���	��	�s� �	,�,)
rRrSrTr[r�r�r�r�r�r�r�r�r�rUr*r(r�r�sQ��� $��#���&!�Z#�
5�%�
���
A�)+�4�
G�r*r�c��eZdZ		dd�Zd�Zy)�TixSubWidgetc��|r>|j|�}	|t|j�dzd}|jd�}|s#tj||ddd|i�||_y|}t
t�dz
�D]-}dj|d|dz�}		|j|	�}
|
}�/|r|d}tj||ddd|i�||_y#g}Y��xYw#t$rt|||dd��}Y��wxYw)Nr��.rCr)�destroy_physically�check_intermediate���)r�r�rp�splitr�r[�range�joinr��KeyErrorr�r�)r&r�rCr�r��path�plist�parent�ir��ws           r(r[zTixSubWidget.__init__�s"����)�)�$�/�D�
��C��	�	�N�1�,�-�.���
�
�3���"����t�V�T�4�&�4��I�$#5����F��3�u�:��>�*���H�H�U�4�A�a�C�[�)��@��,�,�Q�/�A��F�	+���R�y�����t�V�T�4�&�4��I�"4����/
���� �@�)�&�%��(�=>�=>�@�F�@�s�,C�C"�C�"D�?Dc���t|jj��D]}|j��|j|j
jvr!|j
j|j=|j|j
jvr!|j
j|j=|jr'|jjd|j�yy)Nrg)r��children�valuesrgr�r�r�r�r$r%rp�r&�cs  r(rgzTixSubWidget.destroy�s���
�d�m�m�*�*�,�-�A�q�y�y�{�-��:�:����-�-�-����$�$�T�Z�Z�0��:�:����3�3�3����*�*�4�:�:�6��"�"��G�G�L�L��D�G�G�,�#r*N)r�r�rjrUr*r(r�r��s���9:�5�@-r*r�c�F�eZdZ	ifdd�d�Zd�Zd�Zd�Zd�Zifd�Zd	�Z	y)
�DisplayStyleN)r�c���|�)d|vr|d}nd|vr|d}ntjd�}|j|_|jjd|g|j	||����|_y)N�	refwindowzcreate display style�tixDisplayStyle)rZ�_get_default_rootr$r%r7�	stylename)r&�itemtyper9r�r:s     r(r[zDisplayStyle.__init__�st���>��b� ��K�����#��[�)�� �2�2�3I�J���)�)���%������&7��5�!�]�]�3�r�2�5��r*c��|jSrQ)r�rhs r(�__str__zDisplayStyle.__str__�s���~�~�r*c�z�|r|rt||f�}n|r|}d}|j�D]\}}|d|z|fz}�|S)NrUr2)rr�)r&r9r:�optsr�r�s      r(r7zDisplayStyle._options�sM��
�#��S�"�I�&�C�
��C����I�I�K�D�A�q��3�q�5�!�*�$�D� ��r*c�P�|jj|jd�y�Nr��r$r%r�rhs r(r�zDisplayStyle.delete�s�������T�^�^�X�.r*c�Z�|jj|jdd|z|�y)Nr1�-%sr�rts   r(rwzDisplayStyle.__setitem__�s �������T�^�^�[�%��)�U�Cr*c�^�|j|jdg|j||����S)Nr1)r3r�r7r8s   r(rqzDisplayStyle.config�s6��!�t�!�!��N�N�K�A�*.�-�-��B�*?�A�	Ar*c�V�|jj|jdd|z�S)Nr,r�r�)r&rus  r(�__getitem__zDisplayStyle.__getitem__�s!���w�w�|�|�D�N�N�F�E�#�I�>�>r*)
rRrSrTr[r�r7r�rwrqr�rUr*r(r�r��s=�� �&(�
5�4�
5���/�D��A�?r*r�c�*�eZdZ	difd�Zifd�Zd�Zy)�BalloonNc��gd�}tj||d|||�t|dd��|jd<t|dd��|jd<y)N)r��installcolormap�initwait�	statusbar�cursor�
tixBalloon�labelr�r��message�r�r[�_dummyLabelr��r&r�r9r:�statics     r(r[zBalloon.__init__s[�������4���v�s�B�G�'2�4��FG�(I����G�$�)4�T�9�HI�*K����I�&r*c��	|jj|jd|jg|j||����y�N�bindro)r&�widgetr9r:s    r(�bind_widgetzBalloon.bind_widgets6��	O�������T�W�W�f�f�i�i�I�$�-�-��R�2H�Ir*c�f�|jj|jd|j�y�N�unbindrz�r&r�s  r(�
unbind_widgetzBalloon.unbind_widget��������T�W�W�h��	�	�2r*)rRrSrTr[r�rrUr*r(r�r�s$���#��K�')�J�
3r*r�c�*�eZdZ	difd�Zifd�Zd�Zy)�	ButtonBoxNc�<�tj||dddg||�y)N�tixButtonBox�orientationr��r�r[�r&r�r9r:s    r(r[zButtonBox.__init__&s#�����4���)�9�5�s�B�	@r*c��	|jj|jd|g|j||����}t	||�|j
|<|S�N�add�r$r%rpr7�_dummyButtonr�)r&rCr9r:�btns     r(rz
ButtonBox.add*sM��2��d�g�g�l�l�4�7�7�E�4�I�$�-�-��R�2H�I��$0��t�$<����D�!��
r*c�p�||jvr(|jj|jd|�yy�N�invoke�r�r$r%rprBs  r(rzButtonBox.invoke1�-���4�&�&�&��G�G�L�L����(�D�1�'r*�rRrSrTr[rrrUr*r(rr"s#���#��@���2r*rc�2�eZdZ	difd�Zd�Zd�Zd�Zd�Zy)�ComboBoxNc��tj||dgd�||�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)	N�tixComboBox)�editable�dropdown�fancyr�r��entry�arrow�slistbox�tick�cross)r�r[r�r��_dummyEntryr
�_dummyScrolledListBox�	TypeErrorrs    r(r[zComboBox.__init__Cs������4���G���	$�(3�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B5�5	C�Cc�R�|jj|jd|�y)N�
addhistoryrz�r&r5s  r(�add_historyzComboBox.add_historyUs�������T�W�W�l�C�0r*c�R�|jj|jd|�y)N�
appendhistoryrzr&s  r(�append_historyzComboBox.append_historyXs�������T�W�W�o�s�3r*c�T�|jj|jd||�y�N�insertrz)r&�indexr5s   r(r-zComboBox.insert[s�������T�W�W�h��s�3r*c�R�|jj|jd|�y)N�pickrz�r&r.s  r(r0z
ComboBox.pick^s�������T�W�W�f�e�,r*)rRrSrTr[r'r*r-r0rUr*r(rr5s(��
E� $���$1�4�4�-r*rc�2�eZdZ	difd�Zd�Zd�Zd�Zd�Zy)�ControlNc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<y)N�
tixControlr��incr�decrr�r)r�r[r
r�r�r!rs    r(r[zControl.__init__osx�����4���	�{�C��L�&2�4��&@����F�#�&2�4��&@����F�#�'2�4��'A����G�$�'2�4��'A����G�$r*c�P�|jj|jd�y)Nr7rzrhs r(�	decrementzControl.decrementv��������T�W�W�f�%r*c�P�|jj|jd�y)Nr6rzrhs r(�	incrementzControl.incrementyr:r*c�P�|jj|jd�yrrzrhs r(rzControl.invoke|��������T�W�W�h�'r*c�P�|jj|jd�y)N�updaterzrhs r(r@zControl.updater>r*)rRrSrTr[r9r<rr@rUr*r(r3r3as(��
� $��B�&�&�(�(r*r3c��eZdZ	ifd�Zd�Zy)�DirListc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirListr��hlist�vsb�hsb�r�r[�_dummyHListr��_dummyScrollbarrs    r(r[zDirList.__init__��a�����4���	�{�C��L�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�R�|jj|jd|�y�N�chdirrz�r&�dirs  r(rNz
DirList.chdir���������T�W�W�g�s�+r*N�rRrSrTr[rNrUr*r(rBrB�s��"�$&�B�,r*rBc��eZdZ	ifd�Zd�Zy)�DirTreec���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�
tixDirTreer�rErFrGrHrs    r(r[zDirTree.__init__�rKr*c�R�|jj|jd|�yrMrzrOs  r(rNz
DirTree.chdir�rQr*NrRrUr*r(rTrT�s��	!�$&�B�,r*rTc��eZdZ	ifd�Zy)�DirSelectBoxc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixDirSelectBoxr��dirlist�dircbx)r�r[�
_dummyDirListr��_dummyFileComboBoxrs    r(r[zDirSelectBox.__init__�sK�����4��):�Y�K��b�Q�)6�t�Y�)G����I�&�(:�4��(J����H�%r*N�rRrSrTr[rUr*r(rYrY�s��'�$&�Kr*rYc�$�eZdZ	ifd�Zd�Zd�Zy)�ExFileSelectBoxc���tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d	�|jd	<t|d
�|jd
<y)N�tixExFileSelectBoxr��cancel�ok�hidden�typesrPr\�file�filelist)r�r[r
r��_dummyCheckbutton�_dummyComboBoxr^r"rs    r(r[zExFileSelectBox.__init__�s������4��)=�	�{�C�QS�T�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)6�t�Y�)G����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*c�P�|jj|jd�y�N�filterrzrhs r(rozExFileSelectBox.filter�r>r*c�P�|jj|jd�yrrzrhs r(rzExFileSelectBox.invoke�r>r*N)rRrSrTr[rorrUr*r(rbrb�s��&�$&�	R�(�(r*rbc�$�eZdZ	ifd�Zd�Zd�Zy)�DirSelectDialogc�l�tj||ddg||�t|d�|jd<y)N�tixDirSelectDialogr��dirbox)r�r[�_dummyDirSelectBoxr�rs    r(r[zDirSelectDialog.__init__�s7�����4��)=�%�;��R�	1�(:�4��(J����H�%r*c�P�|jj|jd�y�N�popuprzrhs r(ryzDirSelectDialog.popup���������T�W�W�g�&r*c�P�|jj|jd�y�N�popdownrzrhs r(r}zDirSelectDialog.popdown���������T�W�W�i�(r*N�rRrSrTr[ryr}rUr*r(rrrr�s��$�$&�K�'�)r*rrc�$�eZdZ	ifd�Zd�Zd�Zy)�ExFileSelectDialogc�l�tj||ddg||�t|d�|jd<y)N�tixExFileSelectDialogr��fsbox)r�r[�_dummyExFileSelectBoxr�rs    r(r[zExFileSelectDialog.__init__s7�����4��)@�%�;��R�	1�'<�T�7�'K����G�$r*c�P�|jj|jd�yrxrzrhs r(ryzExFileSelectDialog.popuprzr*c�P�|jj|jd�yr|rzrhs r(r}zExFileSelectDialog.popdownr~r*NrrUr*r(r�r��s��#�$&�L�
'�)r*r�c�$�eZdZ	ifd�Zd�Zd�Zy)�
FileSelectBoxc��tj||ddg||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixFileSelectBoxr�r\rjro�	selection)r�r[r"r�rlrs    r(r[zFileSelectBox.__init__sy�����4��);�i�[�#�r�R�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*c�P�|jj|jd�yrnrzrhs r(�apply_filterzFileSelectBox.apply_filter#r>r*c�P�|jj|jd�yrrzrhs r(rzFileSelectBox.invoke&r>r*N)rRrSrTr[r�rrUr*r(r�r�s��'�$&�M�(�(r*r�c�$�eZdZ	ifd�Zd�Zd�Zy)�FileSelectDialogc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixFileSelectDialogr��btnsr�)r�r[�_dummyStdButtonBoxr��_dummyFileSelectBoxrs    r(r[zFileSelectDialog.__init__3sN�����4��)>�%�;��R�	1�&8��v�&F����F�#�':�4��'I����G�$r*c�P�|jj|jd�yrxrzrhs r(ryzFileSelectDialog.popup9rzr*c�P�|jj|jd�yr|rzrhs r(r}zFileSelectDialog.popdown<r~r*NrrUr*r(r�r�*s��!�$&�J�'�)r*r�c�$�eZdZ	ifd�Zd�Zd�Zy)�	FileEntryc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�tixFileEntry�
dialogtyper��buttonr)r�r[r
r�r!rs    r(r[zFileEntry.__init__KsP�����4���(�)�4�c�2�	?�(4�T�8�(D����H�%�'2�4��'A����G�$r*c�P�|jj|jd�yrrzrhs r(rzFileEntry.invokeQr>r*c��yrQrUrhs r(�file_dialogzFileEntry.file_dialogTs��r*N)rRrSrTr[rr�rUr*r(r�r�?s���$&�B�(�
r*r�c��eZdZ	difd�Zifd�Zdifd�Zd�Zd�Zd6d�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zifd�Zifd�Zd�Zd�ZeZd�Zd�Zd�Zifd�Zifd�Zd�Zd�Zd�Zd�Zd�Zd�Z d7d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+ifd*�Z,ifd+�Z-d,�Z.d-�Z/d.�Z0ifd/�Z1d0�Z2d1�Z3ifd2�Z4d3�Z5d7d4�Z6d5�Z7y)8�HListNc�<�tj||dddg||�y)N�tixHList�columnsr�rrs    r(r[zHList.__init__`s"�����4���%�y�1�3��	<r*c�t�|jj|jd|g|j||����Sr
ro�r&rr9r:s    r(rz	HList.addds/���t�w�w�|�|�D�G�G�U�E�K�D�M�M�#�r�4J�K�Kr*c�|�|�d}|jj|jd|g|j||����S)Nre�addchildro)r&r�r9r:s    r(�	add_childzHList.add_childgsD���>��F��t�w�w�|�|��W�W�j�&�K�37�=�=��b�3I�K�	Kr*c�T�|jj|jdd|�y�N�anchor�setrz�r&rs  r(�
anchor_setzHList.anchor_setm��������T�W�W�h��u�5r*c�R�|jj|jdd�y�Nr��clearrzrhs r(�anchor_clearzHList.anchor_clearp��������T�W�W�h��0r*c��|s)|jj|jdd||�S|jj|jdd|d|�S)Nr�widthz-charrz)r&�colr��charss    r(�column_widthzHList.column_widthssJ����7�7�<�<�����7�C��G�G��7�7�<�<�����7�C� '��0�
0r*c�R�|jj|jdd�y)Nr��allrzrhs r(�
delete_allzHList.delete_allzs�������T�W�W�h��.r*c�T�|jj|jdd|�y)Nr�rrzr�s  r(�delete_entryzHList.delete_entry}s�������T�W�W�h���7r*c�T�|jj|jdd|�y)Nr��
offspringsrzr�s  r(�delete_offspringszHList.delete_offsprings�s�������T�W�W�h��e�<r*c�T�|jj|jdd|�y)Nr��siblingsrzr�s  r(�delete_siblingszHList.delete_siblings�s�������T�W�W�h�
�E�:r*c�T�|jj|jdd|�y�N�dragsiter�rzr1s  r(�dragsite_setzHList.dragsite_set���������T�W�W�j�%��7r*c�R�|jj|jdd�y�Nr�r�rzrhs r(�dragsite_clearzHList.dragsite_clear���������T�W�W�j�'�2r*c�T�|jj|jdd|�y�N�dropsiter�rzr1s  r(�dropsite_setzHList.dropsite_set�r�r*c�R�|jj|jdd�y�Nr�r�rzrhs r(�dropsite_clearzHList.dropsite_clear�r�r*c�x�|jj|jdd|g|j||����y)N�headerr�ro�r&r�r9r:s    r(�
header_createzHList.header_create�s.��������T�W�W�h��#�O��
�
�c�2�8N�Or*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1�r3rpr$r%r7r�s    r(�header_configurezHList.header_configure�sS���;��%�%�d�g�g�x��c�J�J�������T�W�W�h��S�	.��m�m�C��,�	.r*c�T�|jj|jdd||�S)Nr�r,rz)r&r��opts   r(�header_cgetzHList.header_cget�s!���w�w�|�|�D�G�G�X�v�s�C�@�@r*c��|jj|jj|jdd|��S)Nr��exist)r$�
getbooleanr%rp�r&r�s  r(�
header_existszHList.header_exists�s0���w�w�!�!�$�'�'�,�,�t�w�w��'�3�"O�P�Pr*c�T�|jj|jdd|�y)Nr�r�rzr�s  r(�
header_deletezHList.header_delete�s�������T�W�W�h��#�6r*c�R�|jj|jdd|�S)Nr��sizerzr�s  r(�header_sizezHList.header_size�s���w�w�|�|�D�G�G�X�v�s�;�;r*c�T�|jj|jdd|�y)N�hiderrzr�s  r(�
hide_entryzHList.hide_entry�s�������T�W�W�f�g�u�5r*c�x�|jj|jdd|g|j||����y)N�	indicatorr�ror�s    r(�indicator_createzHList.indicator_create�s6���������g�g�{�H�e�	N�6:�m�m�C��6L�	Nr*c��|�|j|jdd|�S|jj|jdd|g|j	||����y)Nr�r1r�r�s    r(�indicator_configurezHList.indicator_configure�s[���;��%�%�����k�5�:�
:��������g�g�{�K��	Q�9=���s�B�9O�	Qr*c�T�|jj|jdd||�S)Nr�r,rz�r&rr�s   r(�indicator_cgetzHList.indicator_cget�s!���w�w�|�|�D�G�G�[�&�%��E�Er*c�R�|jj|jdd|�S)Nr��existsrzr�s  r(�indicator_existszHList.indicator_exists�s���w�w�|�|�T�W�W�k�8�U�C�Cr*c�T�|jj|jdd|�y)Nr�r�rzr�s  r(�indicator_deletezHList.indicator_delete�s�������T�W�W�k�8�U�;r*c�R�|jj|jdd|�S)Nr�r�rzr�s  r(�indicator_sizezHList.indicator_size�s���w�w�|�|�D�G�G�[�&�%�@�@r*c�P�|jj|jdd�S�Nr�r�rzrhs r(�info_anchorzHList.info_anchor�����w�w�|�|�D�G�G�V�X�6�6r*c�x�|j|jj|jdd|��xsdS�Nr��bbox)�_getintsr$r%rpr�s  r(�	info_bboxzHList.info_bbox�s7���}�}������T�W�W�f�f�e�<�>�F�AE�	Fr*c��|jj|jdd|�}|jj|�S)Nr�r��r$r%rpr)r&rr�s   r(�
info_childrenzHList.info_children�s3���G�G�L�L����&�*�e�<���w�w� � ��#�#r*c�R�|jj|jdd|�S)Nr��datarzr�s  r(�	info_datazHList.info_data�����w�w�|�|�D�G�G�V�V�U�;�;r*c�P�|jj|jdd�S)Nr�r�rzrhs r(�
info_dragsitezHList.info_dragsite�����w�w�|�|�D�G�G�V�Z�8�8r*c�P�|jj|jdd�S)Nr�r�rzrhs r(�
info_dropsitezHList.info_dropsite�rr*c�R�|jj|jdd|�S�Nr�r�rzr�s  r(�info_existszHList.info_exists�����w�w�|�|�D�G�G�V�X�u�=�=r*c�R�|jj|jdd|�S)Nr�rgrzr�s  r(�info_hiddenzHList.info_hidden�rr*c�R�|jj|jdd|�S)Nr��nextrzr�s  r(�	info_nextzHList.info_next�r
r*c�R�|jj|jdd|�S)Nr�r�rzr�s  r(�info_parentzHList.info_parent�rr*c�R�|jj|jdd|�S)Nr��prevrzr�s  r(�	info_prevzHList.info_prev�r
r*c��|jj|jdd�}|jj|�S�Nr�r�rr�s  r(�info_selectionzHList.info_selection��1���G�G�L�L����&�+�6���w�w� � ��#�#r*c�V�|jj|jdd|||�S)N�itemr,rz)r&rr�r�s    r(�	item_cgetzHList.item_cget�s#���w�w�|�|�D�G�G�V�V�U�C��E�Er*c��|�|j|jdd||�S|jj|jdd||g|j	||����y)Nr&r1r��r&rr�r9r:s     r(�item_configurezHList.item_configure�sW���;��%�%�d�g�g�v�{�E�3�O�O�������T�W�W�f�k�5�#�	'��}�}�S�"�%�	'r*c�z�|jj|jdd||g|j||����y)Nr&r�ror)s     r(�item_createzHList.item_create�s8���������g�g�v�x���	N�6:�m�m�C��6L�	Nr*c�T�|jj|jdd||�S)Nr&r�rz�r&rr�s   r(�item_existszHList.item_exists�s!���w�w�|�|�D�G�G�V�X�u�c�B�Br*c�V�|jj|jdd||�y)Nr&r�rzr.s   r(�item_deletezHList.item_delete�s�������T�W�W�f�h��s�;r*c�R�|jj|jd||�S)N�	entrycgetrzr�s   r(r3zHList.entrycget�s���w�w�|�|�D�G�G�[�%��=�=r*c��|�|j|jd|�S|jj|jd|g|j	||����y�N�entryconfigurer�r�s    r(r6zHList.entryconfiguresQ���;��%�%�d�g�g�/?��G�G�������T�W�W�.��	'��}�}�S�"�%�	'r*c�P�|jj|jd|�S�N�nearestrz)r&r�s  r(r9z
HList.nearests���w�w�|�|�D�G�G�Y��2�2r*c�R�|jj|jd|�y�N�seerzr�s  r(r<z	HList.see��������T�W�W�e�U�+r*c�v�|jj|jddg|j||����y�Nr�r�ror8s   r(�selection_clearzHList.selection_clear�,��������T�W�W�k�7�L�T�]�]�3��5K�Lr*c�R�|jj|jdd|�S�Nr��includesrzr�s  r(�selection_includeszHList.selection_includes����w�w�|�|�D�G�G�[�*�e�D�Dr*c�V�|jj|jdd||�y�Nr�r�rz�r&�first�lasts   r(�
selection_setzHList.selection_set��������T�W�W�k�5�%��>r*c�R�|jj|jdd|�S)N�showrrzr�s  r(�
show_entryzHList.show_entry����w�w�|�|�D�G�G�V�W�e�<�<r*)rNNrQ)8rRrSrTr[rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��header_existr�r�r�r�r�r�r�r�r�rrr	rrrrrrrr r#r'r*r,r/r1r3r6r9r<r@rErLrPrUr*r(r�r�Xs]���#�r�<� �L� $��K�6�1�0�/�8�=�;�8�3�8�3�&(�P�)+�.�A�Q�
!�L�7�<�6�+-�N�.0�Q�F�D�<�A�7�F�$�<�9�9�>�>�<�>�<�$�F�.0�'�+-�N�C�<�>�)+�'�3�,�#%�M�E�?�=r*r�c��eZdZ	difd�Zy)�	InputOnlyNc�8�tj||dd||�y)N�tixInputOnlyrrs    r(r[zInputOnly.__init__s�����4����s�B�Gr*r`rUr*r(rTrTs���#�r�Hr*rTc��eZdZ	difd�Zy)�
LabelEntryNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelEntry�	labelsider�r�r)r�r[r�r�r!rs    r(r[zLabelEntry.__init__,�P�����4���'�	�2�C��	=�'2�4��'A����G�$�'2�4��'A����G�$r*r`rUr*r(rXrX"s���#�r�Br*rXc��eZdZ	difd�Zy)�
LabelFrameNc��tj||dddg||�t|d�|jd<t	|d�|jd<y)N�
tixLabelFramer[r�r��frame)r�r[r�r��_dummyFramers    r(r[zLabelFrame.__init__=r\r*r`rUr*r(r^r^2s���#�r�Br*r^c�4�eZdZ	ifd�Zifd�Zd�Zd�Zd�Zy)�ListNoteBookc���tj||ddg||�t|dd��|jd<t	|d�|jd<t|d�|jd<y)N�tixListNoteBookr��panerr�rE�shlist)r�r[�_dummyPanedWindowr�rI�_dummyScrolledHListrs    r(r[zListNoteBook.__init__Lsh�����4��):�Y�K��b�Q�&7��f�KL�'N����F�#�'2�4��'A����G�$�(;�D�(�(K����H�%r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr
�r$r%rpr7r�r��r&rCr9r:s    r(rzListNoteBook.addT�T��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�$<����D�!��"�"�4�(�(r*c�$�|j|�SrQ�r�rBs  r(�pagezListNoteBook.pageY����~�~�d�#�#r*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|S�N�pages�r$rr%rpr�r��r&r��retr�s    r(ruzListNoteBook.pages\�R�����!�!�$�'�'�,�,�t�w�w��"@�A�����A��J�J�t�~�~�a�(�)���
r*c�R�|jj|jd|�y�N�raiserzrBs  r(�
raise_pagezListNoteBook.raise_paged��������T�W�W�g�t�,r*N)rRrSrTr[rrqrur}rUr*r(rdrdDs,��E�$&�L��)�
$��-r*rdc��eZdZ	difd�Zy)�MeterNc�:�tj||ddg||�y)N�tixMeterr�rrs    r(r[zMeter.__init__ls�����4���%�;��R�	1r*r`rUr*r(r�r�gs���#��1r*r�c�B�eZdZ	difd�Zifd�Zd�Zd�Zd�Zd�Zd�Z	y)	�NoteBookNc�p�tj||ddg||�t|dd��|jd<y)N�tixNoteBookr��nbframerr�)r�r[r�r�rs    r(r[zNoteBook.__init__xs9�����4��}�y�k�3��K�)5�d�I�IJ�*L����I�&r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr
rlrms    r(rzNoteBook.add}rnr*c��|jj|jd|�|j|j	�|j|=yr��r$r%rpr�rgrBs  r(r�zNoteBook.delete��?�������T�W�W�h��-����D�!�)�)�+�����%r*c�$�|j|�SrQrprBs  r(rqz
NoteBook.page�rrr*c���|jj|jj|jd��}g}|D]"}|j	|j|���$|Srtrvrws    r(ruzNoteBook.pages�ryr*c�R�|jj|jd|�yr{rzrBs  r(r}zNoteBook.raise_page�r~r*c�N�|jj|jd�S)N�raisedrzrhs r(r�zNoteBook.raised�s���w�w�|�|�D�G�G�X�.�.r*)
rRrSrTr[rr�rqrur}r�rUr*r(r�r�ps8��H�#�r�L�
�)�
&�
$��-�/r*r�c��eZdZy)�
NoteBookFrameN�rRrSrTrUr*r(r�r��s��r*r�c�>�eZdZ	ifd�Zifd�Zifd�Zd�Zd�Zd�Zy)�
OptionMenuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�
tixOptionMenur��
menubutton�menu�r�r[�_dummyMenubuttonr��
_dummyMenurs    r(r[zOptionMenu.__init__�sJ�����4���9�+�s�B�O�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�x�|jj|jdd|g|j||����y)Nr�commandrorms    r(�add_commandzOptionMenu.add_command�s.��������T�W�W�e�Y��N�t�}�}�S�"�7M�Nr*c�x�|jj|jdd|g|j||����y)Nr�	separatorrorms    r(�
add_separatorzOptionMenu.add_separator�s.��������T�W�W�e�[�$�P����s�B�9O�Pr*c�R�|jj|jd|�yr�rzrBs  r(r�zOptionMenu.delete���������T�W�W�h��-r*c�R�|jj|jd|�y)N�disablerzrBs  r(r�zOptionMenu.disable�s�������T�W�W�i��.r*c�R�|jj|jd|�y)N�enablerzrBs  r(r�zOptionMenu.enable�r�r*N)	rRrSrTr[r�r�r�r�r�rUr*r(r�r��s6���$&�?�
%'�O�')�Q�.�/�.r*r�c�D�eZdZ	ifd�Zifd�Zd�Zd�Zd�Zifd�Zd�Z	y)	�PanedWindowc�<�tj||dddg||�y)N�tixPanedWindowrr�rrs    r(r[zPanedWindow.__init__�s"�����4��)9�M�9�;U�WZ�\^�_r*c���|jj|jd|g|j||����t	||d��|j
|<|j
|S)Nrr)r�rlrms    r(rzPanedWindow.add�sZ��������T�W�W�e�T�C�D�M�M�#�r�,B�C�$0��t�DE�%G����D�!��"�"�4�(�(r*c��|jj|jd|�|j|j	�|j|=yr�r�rBs  r(r�zPanedWindow.delete�r�r*c�R�|jj|jd|�y)Nr|rzrBs  r(r|zPanedWindow.forget�r�r*c�R�|jj|jd||�S)N�panecgetrzr�s   r(r�zPanedWindow.panecget�s���w�w�|�|�D�G�G�Z���<�<r*c��|�|j|jd|�S|jj|jd|g|j	||����y)N�
paneconfigurer�r�s    r(r�zPanedWindow.paneconfigure�sJ���;��%�%�d�g�g���F�F�������T�W�W�o�u�N�t�}�}�S�"�7M�Nr*c���|jj|jj|jd��}|D�cgc]}|j	|���c}Scc}w)N�panes)r$rr%rpr�)r&r�r�s   r(r�zPanedWindow.panes�sJ�����!�!�$�'�'�,�,�t�w�w��"@�A��+0�1�5�a����q�!�5�1�1��1s�AN)
rRrSrTr[rr�r|r�r�r�rUr*r(r�r��s<��H�$&�`��)�&�
.�=�(*�O�
2r*r�c�*�eZdZ	ifd�Zd�Zd�Zd�Zy)�	PopupMenuc��tj||ddg||�t|d�|jd<t	|d�|jd<y)N�tixPopupMenur�r�r�r�rs    r(r[zPopupMenu.__init__�sJ�����4���)��c�2�N�,<�T�<�,P����L�)�&0��v�&>����F�#r*c�f�|jj|jd|j�yr�rzr�s  r(r�zPopupMenu.bind_widget���������T�W�W�f�f�i�i�0r*c�f�|jj|jd|j�yr�rzr�s  r(rzPopupMenu.unbind_widget�rr*c�j�|jj|jd|j||�y)N�postrz)r&r�r�r�s    r(�post_widgetzPopupMenu.post_widget�s"�������T�W�W�f�f�i�i��A�6r*N)rRrSrTr[r�rr�rUr*r(r�r��s ���$&�?�
1�3�7r*r�c�0�eZdZ	ifd�Zd�Zd�Zd�Zd�Zy)�ResizeHandlec�@�gd�}tj||d|||�y)N)	r�r��cursorfg�cursorbg�
handlesize�	hintcolor�	hintwidthr�r��tixResizeHandler)r&r�r9r:�flagss     r(r[zResizeHandle.__init__�s'����	���4��):� �#�r�	+r*c�f�|jj|jd|j�y)N�attachwidgetrzr�s  r(�
attach_widgetzResizeHandle.attach_widget��������T�W�W�n�f�i�i�8r*c�f�|jj|jd|j�y)N�detachwidgetrzr�s  r(�
detach_widgetzResizeHandle.detach_widget
r�r*c�f�|jj|jd|j�y)Nr�rzr�s  r(r�zResizeHandle.hide
r�r*c�f�|jj|jd|j�y)NrOrzr�s  r(rOzResizeHandle.showr�r*N)rRrSrTr[r�r�r�rOrUr*r(r�r��s!��E�#%�+�9�9�1�1r*r�c��eZdZ	ifd�Zy)�
ScrolledHListc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledHListr�rErFrGrHrs    r(r[zScrolledHList.__init__�e�����4��);�i�[���	$�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr`rUr*r(r�r����:�$&�Br*r�c��eZdZ	ifd�Zy)�ScrolledListBoxc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledListBoxr��listboxrFrG)r�r[�
_dummyListboxr�rJrs    r(r[zScrolledListBox.__init__"sc�����4��)=�	�{�C�QS�T�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr`rUr*r(r�r�s��>�$&�Br*r�c��eZdZ	ifd�Zy)�ScrolledTextc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTextr�rrFrG)r�r[�
_dummyTextr�rJrs    r(r[zScrolledText.__init__,sb�����4��):�Y�K��b�Q�&0��v�&>����F�#�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr`rUr*r(r�r�(s��8�$&�Br*r�c��eZdZ	ifd�Zy)�
ScrolledTListc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledTListr��tlistrFrG)r�r[�_dummyTListr�rJrs    r(r[zScrolledTList.__init__6r�r*Nr`rUr*r(r�r�2r�r*r�c��eZdZ	ifd�Zy)�ScrolledWindowc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixScrolledWindowr�rrFrG)r�r[rbr�rJrs    r(r[zScrolledWindow.__init__Asc�����4��)<�y�k�3�PR�S�(3�D�(�(C����H�%�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nr`rUr*r(r�r�=s��<�$&�Br*r�c�(�eZdZ	ifd�Zifd�Zd�Zy)�Selectc�n�tj||dgd�||�t|d�|jd<y)N�	tixSelect)�	allowzero�radiorr[r�r�r�rs    r(r[zSelect.__init__Ns9�����4���'���	$�(3�4��'A����G�$r*c���|jj|jd|g|j||����t	||�|j
|<|j
|Sr
rrms    r(rz
Select.addUrnr*c�R�|jj|jd|�yrrzrBs  r(rz
Select.invokeZr�r*NrrUr*r(r�r�Gs"��F�$&�B��)�
.r*r�c��eZdZ	difd�Zy)�ShellNc�<�tj||dddg||�y)N�tixShellr��titlerrs    r(r[zShell.__init__bs �����4���i��5I�3�PR�Sr*r`rUr*r(r�r�]s���#�r�Tr*r�c�,�eZdZ	difd�Zd�Zd�Zd�Zy)�DialogShellNc�<�tj||dgd�||�y)N�tixDialogShell)r�r��mapped�	minheight�minwidthr��	transientrrs    r(r[zDialogShell.__init__ns!�����4��+�3�47��		=r*c�P�|jj|jd�yr|rzrhs r(r}zDialogShell.popdownur~r*c�P�|jj|jd�yrxrzrhs r(ryzDialogShell.popupxrzr*c�P�|jj|jd�y)N�centerrzrhs r(rzDialogShell.center{r>r*)rRrSrTr[r}ryrrUr*r(r�r�es"���#�r�=�)�'�(r*r�c� �eZdZ	difd�Zd�Zy)�StdButtonBoxNc��tj||dddg||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)N�tixStdButtonBoxrr�rf�applyre�help)r�r[r
r�rs    r(r[zStdButtonBox.__init__�s������4��):�)�9�5�s�B�	@�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*c�p�||jvr(|jj|jd|�yyrrrBs  r(rzStdButtonBox.invoke�rr*)rRrSrTr[rrUr*r(rr~s��J�"��A�2r*rc��eZdZ	difd�Zd�Zd�Zd�Zd�Zdd�Zd�Z	d	�Z
d
�Zd�Zifd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Zdd�Zy)�TListNc�:�tj||ddg||�y)N�tixTListr�rrs    r(r[zTList.__init__�s�����4���i�[�#�r�Jr*c�T�|jj|jdd|�y)N�activer�rzr1s  r(�
active_setzTList.active_set�r�r*c�R�|jj|jdd�y)Nrr�rzrhs r(�active_clearzTList.active_clear�r�r*c�T�|jj|jdd|�yr�rzr1s  r(r�zTList.anchor_set�r�r*c�R�|jj|jdd�yr�rzrhs r(r�zTList.anchor_clear�r�r*c�T�|jj|jd||�yr�rz�r&�from_�tos   r(r�zTList.delete�s�������T�W�W�h��r�2r*c�T�|jj|jdd|�yr�rzr1s  r(r�zTList.dragsite_set�r�r*c�R�|jj|jdd�yr�rzrhs r(r�zTList.dragsite_clear�r�r*c�T�|jj|jdd|�yr�rzr1s  r(r�zTList.dropsite_set�r�r*c�R�|jj|jdd�yr�rzrhs r(r�zTList.dropsite_clear�r�r*c�v�|jj|jd|g|j||����yr,ro)r&r.r9r:s    r(r-zTList.insert�s,��������T�W�W�h��G��
�
�c�2�0F�Gr*c�P�|jj|jdd�S)Nr�rrzrhs r(�info_activezTList.info_active�rr*c�P�|jj|jdd�Sr�rzrhs r(rzTList.info_anchor�rr*c�R�|jj|jdd|�S)Nr��downrzr1s  r(�	info_downzTList.info_down�r
r*c�R�|jj|jdd|�S)Nr��leftrzr1s  r(�	info_leftzTList.info_left�r
r*c�R�|jj|jdd|�S)Nr��rightrzr1s  r(�
info_rightzTList.info_right�rQr*c��|jj|jdd�}|jj|�Sr"rr�s  r(r#zTList.info_selection�r$r*c�P�|jj|jdd�S)Nr�r�rzrhs r(�	info_sizezTList.info_size�s���w�w�|�|�D�G�G�V�V�4�4r*c�R�|jj|jdd|�S)Nr��uprzr1s  r(�info_upz
TList.info_up�s���w�w�|�|�D�G�G�V�T�5�9�9r*c�R�|jj|jd||�Sr8rz�r&r�r�s   r(r9z
TList.nearest�s���w�w�|�|�D�G�G�Y��1�5�5r*c�R�|jj|jd|�yr;rzr1s  r(r<z	TList.see�r=r*c�v�|jj|jddg|j||����yr?ror8s   r(r@zTList.selection_clear�rAr*c�R�|jj|jdd|�SrCrzr1s  r(rEzTList.selection_includes�rFr*c�V�|jj|jdd||�yrHrzrIs   r(rLzTList.selection_set�rMr*rQ)rRrSrTr[rrr�r�r�r�r�r�r�r-r#rr'r*r-r#r0r3r9r<r@rErLrUr*r(rr�s����#�r�K�6�1�6�1�3�8�3�8�3�!#�H�7�7�<�<�=�$�5�:�6�,�#%�M�E�?r*rc�:�eZdZ	difd�Zd�Zd�Zd�Zd�Zdd�Zy)	�TreeNc���tj||ddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixTreer�rErFrGrHrs    r(r[z
Tree.__init__�sd�����4���%�;��R�	1�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�R�	|jj|jd�y�N�autosetmoderzrhs r(r@zTree.autosetmode����	9�	
�����T�W�W�m�,r*c�T�	|jj|jd|�y�N�closerz�r&�	entrypaths  r(rDz
Tree.close����F������T�W�W�g�y�1r*c�R�	|jj|jd|�S�N�getmoderzrEs  r(rJzTree.getmode�� ��G��w�w�|�|�D�G�G�Y�	�:�:r*c�T�	|jj|jd|�y�N�openrzrEs  r(rNz	Tree.open����D������T�W�W�f�i�0r*c�V�	|jj|jd||�y)N�setmoderz�r&rF�modes   r(rQzTree.setmodes$��	G�	
�����T�W�W�i��D�9r*)�none)	rRrSrTr[r@rDrJrNrQrUr*r(r;r;�s.��E�
#��B�-�2�;�1�
:r*r;c�H�eZdZ	difd�Zd�Zd�Zd�Zd�Zd
d�Zd�Z	d
d	�Z
y)�	CheckListNc���tj||dddg||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)N�tixCheckListr�r�rErFrGrHrs    r(r[zCheckList.__init__sg�����4���%�w�/��b�	:�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*c�R�	|jj|jd�yr?rzrhs r(r@zCheckList.autosetmoderAr*c�T�	|jj|jd|�yrCrzrEs  r(rDzCheckList.close#rGr*c�R�	|jj|jd|�SrIrzrEs  r(rJzCheckList.getmode'rKr*c�T�	|jj|jd|�yrMrzrEs  r(rNzCheckList.open+rOr*c��	|jj|jj|jd|��S)N�getselection)r$rr%rp)r&rSs  r(r^zCheckList.getselection/s3��	%��w�w� � ������d�g�g�~�t�!L�M�Mr*c�R�	|jj|jd|�S)N�	getstatusrzrEs  r(r`zCheckList.getstatus5s ��6��w�w�|�|�D�G�G�[�)�<�<r*c�V�	|jj|jd||�y)N�	setstatusrzrRs   r(rbzCheckList.setstatus9s"��	F������T�W�W�k�9�d�;r*)�on)rRrSrTr[r@rDrJrNr^r`rbrUr*r(rVrVs8���#��B�-�2�;�1�N�=�<r*rVc��eZdZdd�Zy)r
c�4�tj||||�yrQ�r�r[�r&r�rCr�s    r(r[z_dummyButton.__init__E������d�F�D�2D�Er*N�r�r`rUr*r(r
r
D���Fr*r
c��eZdZdd�Zy)rkc�4�tj||||�yrQrfrgs    r(r[z_dummyCheckbutton.__init__Irhr*Nrir`rUr*r(rkrkHrjr*rkc��eZdZdd�Zy)r!c�4�tj||||�yrQrfrgs    r(r[z_dummyEntry.__init__Mrhr*Nrir`rUr*r(r!r!Lrjr*r!c��eZdZdd�Zy)rbc�4�tj||||�yrQrfrgs    r(r[z_dummyFrame.__init__Qrhr*Nrir`rUr*r(rbrbPrjr*rbc��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyLabel.__init__Urhr*Nrir`rUr*r(r�r�Trjr*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyListbox.__init__Yrhr*Nrir`rUr*r(r�r�Xrjr*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyMenu.__init__]rhr*Nrir`rUr*r(r�r�\rjr*r�c��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyMenubutton.__init__arhr*Nrir`rUr*r(r�r�`rjr*r�c��eZdZdd�Zy)rJc�4�tj||||�yrQrfrgs    r(r[z_dummyScrollbar.__init__erhr*Nrir`rUr*r(rJrJdrjr*rJc��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyText.__init__irhr*Nrir`rUr*r(r�r�hrjr*r�c��eZdZdd�Zy)r"c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr�rFrG)r�r[r�r�rJrgs    r(r[z_dummyScrolledListBox.__init__ms\�����d�F�D�2D�E�)6�t�Y�)G����I�&�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nrir`rUr*r(r"r"l���Br*r"c��eZdZdd�Zy)rIc�4�tj||||�yrQrfrgs    r(r[z_dummyHList.__init__trhr*Nrir`rUr*r(rIrIsrjr*rIc��eZdZdd�Zy)rjc���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<y�NrErFrG�r�r[rIr�rJrgs    r(r[z_dummyScrolledHList.__init__x�\�����d�F�D�2D�E�'2�4��'A����G�$�%4�T�5�%A����E�"�%4�T�5�%A����E�"r*Nrir`rUr*r(rjrjwrr*rjc��eZdZdd�Zy)r�c�4�tj||||�yrQrfrgs    r(r[z_dummyTList.__init__rhr*Nrir`rUr*r(r�r�~rjr*r�c��eZdZdd�Zy)rlc��tj|||d|g�t|d�|jd<t	|d�|jd<t|d�|jd<t
|d�|jd<	t|d�|jd<t|d�|jd<y#t$rYywxYw)Nrr�rrrrr )r�r[r�r�r!r
r"r#rgs    r(r[z_dummyComboBox.__init__�s������d�F�D�7�;M�2N�O�'2�4��'A����G�$�'2�4��'A����G�$�'3�D�'�'B����G�$�*?��@J�+L����J�'�	�*6�t�V�*D�D����'�+7��g�+F�D����(���	��	�s�2B3�3	B?�>B?Nrir`rUr*r(rlrl�s��r*rlc��eZdZdd�Zy)r^c���tj||||�t|d�|jd<t	|d�|jd<t	|d�|jd<yr�r�rgs    r(r[z_dummyDirList.__init__�r�r*Nrir`rUr*r(r^r^�rr*r^c��eZdZdd�Zy)rvc��tj||||�t|d�|jd<t	|d�|jd<y)Nr\r])r�r[r^r�r_rgs    r(r[z_dummyDirSelectBox.__init__�sE�����d�F�D�2D�E�)6�t�Y�)G����I�&�(:�4��(J����H�%r*Nrir`rUr*r(rvrv�s��Kr*rvc��eZdZdd�Zy)r�c���tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t|d�|jd<t|d�|jd<t
|d�|jd<t|d�|jd<t
|d�|jd<y)	NrerfrgrhrPr\rirj)r�r[r
r�rkrlr"rgs    r(r[z_dummyExFileSelectBox.__init__�s������d�F�D�2D�E�(4�T�8�(D����H�%�$0��t�$<����D�!�(9�$��(I����H�%�'5�d�G�'D����G�$�%3�D�%�%@����E�"�)>�t�Y�)O����I�&�&4�T�6�&B����F�#�*?��j�*Q����J�'r*Nrir`rUr*r(r�r��s��	Rr*r�c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t	|d�|jd<t	|d�|jd<y)Nr\rjror�)r�r[r"r�rlrgs    r(r[z_dummyFileSelectBox.__init__�ss�����d�F�D�2D�E�)>�t�Y�)O����I�&�*?��j�*Q����J�'�(6�t�X�(F����H�%�+9�$��+L����K�(r*Nrir`rUr*r(r�r��s��Mr*r�c��eZdZdd�Zy)r_c�f�tj||||�t|d�|jd<y)Nr])r�r[rlr�rgs    r(r[z_dummyFileComboBox.__init__�s.�����d�F�D�2D�E�(6�t�X�(F����H�%r*Nrir`rUr*r(r_r_�s��Gr*r_c��eZdZdd�Zy)r�c��tj||||�t|d�|jd<t|d�|jd<t|d�|jd<t|d�|jd<y)Nrfrrer)r�r[r
r�rgs    r(r[z_dummyStdButtonBox.__init__�ss�����d�F�D�2D�E�$0��t�$<����D�!�'3�D�'�'B����G�$�(4�T�8�(D����H�%�&2�4��&@����F�#r*Nrir`rUr*r(r�r��s��Ar*r�c��eZdZdd�Zy)�_dummyNoteBookFramec�4�tj||||�yrQrfrgs    r(r[z_dummyNoteBookFrame.__init__�rhr*N)rr`rUr*r(r�r��rjr*r�c��eZdZdd�Zy)ric�4�tj||||�yrQrfrgs    r(r[z_dummyPanedWindow.__init__�rhr*Nrir`rUr*r(riri�rjr*ric�P�	|jjd|j�S)N�
tixOptionNamerz)r�s r(�
OptionNamer��s ��9��9�9�>�>�/�6�9�9�5�5r*c�h�d}|j�D]}|dz|zdz|zdz||zdz}�|S)Nrez{{z} {z - z}} )�keys)�dict�s�types   r(�FileTypeListr��sF��
�A��	�	���
��H�t�O�e�#�d�*�U�2�T�$�Z�?�%�G����Hr*c��eZdZ	y)�CObjViewNr�rUr*r(r�r��s���	r*r�c��eZdZ	difd�Zd�Zd�Zd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zy)�GridNc�J�g}||_tj||d|||�y)N�tixGrid�r9r�r[r�s     r(r[z
Grid.__init__�s&����������4���F�C��Dr*c�@�	|jj|dd�yr�r#rhs r(r�zGrid.anchor_clears��+������T�8�W�-r*c�\�	|j|jj|dd��S)Nr�rI�rr$r%rhs r(�
anchor_getzGrid.anchor_gets%��=��}�}�T�W�W�\�\�$��%�@�A�Ar*c�D�	|jj|dd||�yr�r#r5s   r(r�zGrid.anchor_sets��=������T�8�U�A�q�1r*c��	|�|jj|dd|�y|jj|dd||�y)Nr�rr#rs   r(�
delete_rowzGrid.delete_rows:��	<�
�:��G�G�L�L��x���6��G�G�L�L��x���r�:r*c��	|�|jj|dd|�y|jj|dd||�y)Nr�rr#rs   r(�
delete_columnzGrid.delete_columns:��	?�
�:��G�G�L�L��x��5�9��G�G�L�L��x��5�"�=r*c�@�	|jj|dd�y)N�editrr#rhs r(�
edit_applyzGrid.edit_apply#s��	������T�6�7�+r*c�D�	|jj|dd||�y)Nr�r�r#r5s   r(�edit_setz
Grid.edit_set(s��	/������T�6�5�!�Q�/r*c�`�	|r
|ddk7rd|z}|jj|d|||�S)Nrr2r3r#)r&r�r�r.s    r(r3zGrid.entrycget-s7��0��f�Q�i�3�&��6�\�F��w�w�|�|�D�+�q�!�V�<�<r*c�.�|jd||f||�Sr5)�
_configure)r&r�r�r9r:s     r(r6zGrid.entryconfigure3s����� 0�!�Q�7��b�A�Ar*c	�`�	|j|jj|dd||��Sr)�_getbooleanr$r%r5s   r(rzGrid.info_exists9s+��5���������T�6�8�Q�� J�K�Kr*c�@�|jj|dd||�Srr#r5s   r(rzGrid.info_bbox=s���w�w�|�|�D�&�&�!�Q�7�7r*c�F�	|jj|dd|||�y)N�moverr#�r&rr�offsets    r(�move_columnzGrid.move_columnAs#��	5�	
�����T�6�8�U�B��?r*c�F�	|jj|dd|||�y)Nr�rr#r�s    r(�move_rowz
Grid.move_rowGs$��	N�	
�����T�6�5�%��V�<r*c�^�	|j|jj|d||��Sr8r�r5s   r(r9zGrid.nearestMs'��B��}�}�T�W�W�\�\�$�	�1�a�@�A�Ar*c��|j|j|�}|�d|f|z}|jj|d||g|���y)Nz	-itemtyper�)r7r9r$r%)r&r�r�r�r:�argss      r(r�zGrid.setWsH���m�m�D�H�H�b�)������)�D�0�D�������T�5�!�Q�.��.r*c	��	|jj|jj|jdd|g|j	i|�����S)Nr�r)r$rr%rpr7�r&r.r:s   r(�size_columnzGrid.size_column]sP��	4�,�w�w� � �������d�g�g�v�x��"5�"�m�m�B��3�"5�6�	6r*c	��	|jj|jj|dd|g|ji|�����S)Nr�r)r$rr%r7r�s   r(�size_rowz
Grid.size_rowwsQ��	4�*�w�w� � ��������&�%��"H�15���r�2�1F�"H�I�	Ir*c�V�	|jj|jd||�y)N�unsetrzr5s   r(r�z
Grid.unset�s��E������T�W�W�g�q�!�,r*rQ)rRrSrTr[r�r�r�r�r�r�r�r3r6rrr�r�r9r�r�r�r�rUr*r(r�r��st���"#��E�.�B�2�;�>�,�
0�
=�B�L�8�@�=�B�/�6�4I�2-r*r�c��eZdZ	difd�Zy)�ScrolledGridNc�J�g}||_tj||d|||�y)N�tixScrolledGridr�r�s     r(r[zScrolledGrid.__init__�s'����������4��):�F�C��Lr*r`rUr*r(r�r��s���#��Mr*r�)wr\�warningsrZr�warn�DeprecationWarning�WINDOW�TEXT�STATUS�	IMMEDIATE�IMAGE�	IMAGETEXT�BALLOON�AUTO�	ACROSSTOP�ASCII�CELL�COLUMN�
DECREASING�
INCREASING�INTEGER�MAIN�MAX�REAL�ROW�S_REGION�X_REGION�Y_REGION�
TCL_DONT_WAIT�TCL_WINDOW_EVENTS�TCL_FILE_EVENTS�TCL_TIMER_EVENTS�TCL_IDLE_EVENTS�TCL_ALL_EVENTSrrWrlr��	__bases__r�r�r�r�rrr3rBrTrYrbrrr�r�r�r��XView�YViewr�rTrXr^rdr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr;rV�Buttonr
�Checkbuttonrk�Entryr!�Framerb�Labelr��Listboxr��Menur��
Menubuttonr��	ScrollbarrJ�Textr�r"rIrjr�rlr^rvr�r�r_r�r�rir�r�r�r�r�rUr*r(�<module>rs���4
�����
��
�
�-���	�
��
��	���	����	�
��
���	�	��
��	��
�
�
�
�
��
����
�����������
�����������~N�~N�@!����Z�!�.)7�)7�Z#�>�>�3�3�t�g�=�����G����G�X3-�9�3-�p(?�(?�^3�i�3�62�	�2�&*-�y�*-�X(�i�(�B,�i�,�*,�i�,�,K�9�K�&(�i�(�D)�i�)�0)��)�((�I�(�8)�y�)�*
�	�
�2@=�I�u�e�@=�DH�	�H�B��B� B��B�$!-�9�!-�F1�I�1�&/�y�&/�P	�I�	�.��.�8'2�)�'2�R7�	�7�41�9�1�0	B�I�	B�B�i�B�B�9�B�	B�I�	B�B�Y�B�.�Y�.�,T�I�T�(�)�(�2
2�9�
2�Q?�I�u�e�Q?�f*:�9�*:�\.<�	�.<�lF�6�<�F�F��\�F�F�%��F�F�%��F�F�%��F�F�G�\�F�F��|�F�F�z�<�F�F�i��F�F��|�F�B�O�\�B�F�%��F�B�-��B�F�%��F��X�|��"B�G�\�B�K��|�K�
R�O�\�
R�M�-��M�G��<�G�
A��|�A�F�-��F�F��\�F�6�
�	�y�	�f-�9�e�U�f-�RM�4�Mr*__pycache__/ttk.cpython-312.opt-1.pyc000064400000217617151710635150013242 0ustar00�

T��h����"�dZdZdZgd�ZddlZddlmZmZmZmZdBd�Z	dCd�Z
d	�ZdBd
�ZdBd�Z
dDd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdEd�ZGd�de�ZGd�dej4�ZGd�de�ZGd�de�ZGd�deej:�ZGd �d!e�ZGd"�d#e�ZGd$�d%e�Z Gd&�d'e�Z!e!Z"Gd(�d)e�Z#Gd*�d+e�Z$Gd,�d-eejJ�Z&e&Z%Gd.�d/e�Z'Gd0�d1e�Z(Gd2�d3eejR�Z)Gd4�d5eejT�Z*Gd6�d7e�Z+Gd8�d9e�Z,Gd:�d;e�Z-Gd<�d=eej\ej^�Z0Gd>�d?e�Z1Gd@�dAe#�Z2y)Fa�Ttk wrapper.

This module provides classes to allow using Tk themed widget set.

Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.

Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
appearance. Widget class bindings are primarily responsible for
maintaining the widget state and invoking callbacks, all aspects
of the widgets appearance lies at Themes.
z0.3.1z!Guilherme Polo <ggpolo@gmail.com>)�Button�Checkbutton�Combobox�Entry�Frame�Label�
Labelframe�
LabelFrame�
Menubutton�Notebook�Panedwindow�PanedWindow�Progressbar�Radiobutton�Scale�	Scrollbar�	Separator�Sizegrip�Spinbox�Style�Treeview�LabeledScale�
OptionMenu�
tclobjs_to_py�setup_master�N)�_flatten�_join�
_stringify�
_splitdictc�f�|r
t|�}|St|ttf�rt	|�}|S)zInternal function.)r�
isinstance�list�tupler)�value�scripts  �$/usr/lib64/python3.12/tkinter/ttk.py�_format_optvaluer' s6��
��5�!���L�
�E�D�%�=�	)��e����L�c��g}|j�D]>\}}|r||vs�
|jd|z�|��$|jt||���@t|�S)z�Formats optdict to a tuple to pass it to tk.call.

    E.g. (script=False):
      {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
      ('-foreground', 'blue', '-padding', '1 2 3 4')�-%s)�items�appendr'r)�optdictr%�ignore�opts�optr$s      r&�_format_optdictr1*s]���D��m�m�o�
��U���F�*��K�K����$�� ����,�U�F�;�<�	&��D�>�r(c��g}|D]S�^}}t|�dk(r
|dxsd}ndj|�}|j|�|��C|j|��U|S)N�r�� )�len�joinr,)r+�opt_val�state�vals    r&�_mapdict_valuesr;:sd���G������u�:��?��!�H�N��E��H�H�U�O�E����u���?��N�N�3����Nr(c	��g}|j�D].\}}|jd|ztt|�|�f��0t	|�S)z�Formats mapdict to pass it to tk.call.

    E.g. (script=False):
      {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]}

      returns:

      ('-expand', '{active selected} grey focus {1, 2, 3, 4}')r*)r+�extendr'r;r)�mapdictr%r/r0r$s     r&�_format_mapdictr?OsQ���D��m�m�o�
��U����U�S�[�%�o�e�&<�f�E�G�	H�&��D�>�r(c�X�d}d}|dvr_|dk(r$|d}tt|dd��}|�d|��}n)|dd\}}	tt|dd��}
|�d|	�d|
��}t||�}n(|d	k(r#|d}t|�dkDrt	|d|�f}|rd
|z}dj|�}||fS)zAFormats args and kw according to the given element factory etype.N�)�image�vsapirBrr3r5��fromz{%s})rr;r1r6r'r7)�etyper%�args�kw�specr/�iname�	imagespec�
class_name�part_id�statemaps           r&�_format_elemcreaterO`s����D�
�D��"�"��G����G�E��o�d�1�2�h�7�8�I�#�Y�/�D�#'�r��(��J���_�T�!�"�X�6�7�H�!+�W�h�?�D��r�6�*��	�&���A�w���t�9�q�=�$�T�!�W�f�5�7�D�
���}���x�x��~����:�r(c��g}|D]�}|\}}|xsi}djt|dd��}d|z�|�|rd|znd��}d|vrZ|j|dz�||z
}t|d||�\}	}|j|	�||z}|jdd|zz���|j|���d	j|�|fS)
a$Formats a layout list so we can pass the result to ttk::style
    layout and ttk::style settings. Note that the layout doesn't have to
    be a list necessarily.

    E.g.:
      [("Menubutton.background", None),
       ("Menubutton.button", {"children":
           [("Menubutton.focus", {"children":
               [("Menubutton.padding", {"children":
                [("Menubutton.label", {"side": "left", "expand": 1})]
               })]
           })]
       }),
       ("Menubutton.indicator", {"side": "right"})
      ]

      returns:

      Menubutton.background
      Menubutton.button -children {
        Menubutton.focus -children {
          Menubutton.padding -children {
            Menubutton.label -side left -expand 1
          }
        }
      }
      Menubutton.indicator -side rightr5T)�childrenz %sr4rQz -children {z%s}�
)r7r1r,�_format_layoutlist)
�layout�indent�indent_sizer%�layout_elem�elemr/�fopts�head�	newscripts
          r&rSrS�s���8�F��� �
��d��z�r�������t�]�C�D����<��%���
�R�/O�P������M�M�$��/�0��k�!�F� 2�4�
�3C�V��!��I�v��M�M�)�$��k�!�F��M�M�%�3��<�0�1��M�M�$���"�9�9�V��f�$�$r(c�<�g}|j�D�]v\}}|jd�r6djt|dd��}|j	d|�d|�d��|jd�r6djt|dd��}|j	d|�d|�d��d|vr1|dsd	}nt
|d�\}}|j	d
|�d|�d��|jd
�s��|d
}|d}d}|t|�kr2t||d�s#|dz
}|t|�krt||d�s�#|d|}	|t|�kr
||r||ni}
t|dg|	��i|
��\}}|j	d|�d|�d|�d|�����ydj|�S)z�Returns an appropriate script, based on settings, according to
    theme_settings definition to be used by theme_settings and
    theme_create.�	configurer5Tzttk::style configure �;�mapzttk::style map rT�nullzttk::style layout z {
z
}zelement createrr3r+zttk::style element create rR)
r+�getr7r1r,r?rSr6�hasattrrO)�settingsr%�namer/�s�_�eoptsrF�argc�elemargs�elemkwrIs            r&�_script_from_settingsrk�s����F��n�n�&�
��d��8�8�K� ������k�):�D�A�B�A��M�M�4��C�D��8�8�E�?������e��d�;�<�A��M�M�T�1�=�>��t����>���)�$�x�.�9���1��M�M�T�1�E�F��8�8�$�%��)�*�E��!�H�E��D���U��#�G�E�$�K��,I���	����U��#�G�E�$�K��,I��Q�t�}�H�$(�3�u�:�$5�%��+�U�4�[�2�F�+�E�4�M�(�M�f�M�J�D�$��M�M��e�T�4�)�
*�='�B�9�9�V��r(c��t|t�r|Sg}t|�}t||�D]�\}}t	|d�rt|�j�}n:t|t�r|j�}nt|ttf�s|f}t	|d�rt|�}|jg|�|�����|S)ztConstruct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict.�typename)	r!�str�iter�ziprb�splitr#r"r,)�stuple�result�itr9r:s     r&�_list_from_statespecru�s����&�#���
�
�F�	
�f��B��"�b�k�
��s��5�*�%���J�$�$�&�E�
��s�
#��K�K�M�E��E�E�4�=�1��H�E��3�
�#��c�(�C��
�
�m��m�s�m�$�"��Mr(c�\�|j|�}g}d}|t|�kr�||}i}|j||f�|dz
}|t|�krL|||dz\}}|jd�sn/|dd}|dz
}|dk(rt	||�}|||<|t|�kr�L|t|�kr��|S)zpConstruct a list from the tuple returned by ttk::layout, this is
    somewhat the reverse of _format_layoutlist.rr3rD�-NrQ)�	splitlistr6r,�
startswith�_list_from_layouttuple)�tk�ltuple�res�indxrdr/r0r:s        r&rzrz�s����\�\�&�
!�F�
�C��D�
��V��
��d�|�����
�
�D�$�<� ���	���S��[� ��d�4�!�8�,�H�C���>�>�#�&���a�b�'�C��A�I�D��j� �,�R��5���D��I��S��[� �
��V��
�&�Jr(c��t|�}|j||z�}t|�dzr|St||t��S)ahFormat options then call Tk command with args and options and return
    the appropriate result.

    If no option is specified, a dict is returned. If an option is
    specified with the None value, the value for that option is returned.
    Otherwise, the function just sets the passed options and the caller
    shouldn't be expecting a return value anyway.rD)�conv)r1�callr6r�
_tclobj_to_py)r{�optionsrGr}s    r&�_val_or_dictr�sB���g�&�G�
�"�'�'�D�7�N�
$�C�
�7�|�a���
��b�#�M�2�2r(c�`�t|�}	t|�}|S#ttf$rY|SwxYw)zAConverts a value to, hopefully, a more appropriate Python object.)rn�int�
ValueError�	TypeError)r$s r&�_convert_stringvalr� s>����J�E�
��E�
���L��
�	�"�
���L�
�s��-�-c�^�t|t�rd|vr
t|�}|St|�}|S)N�.)r!rn�floatr�)�xs r&�
_to_numberr�*s3���!�S���!�8��a��A�
�H��A��A��Hr(c���|rWt|d�rKt|t�s;t|ddd�dk(r
t	|�}|Stt
t|��}|St|d�rt|�}|S)z8Return value converted from Tcl object to Python object.�__len__rrmN�	StateSpec)rbr!rn�getattrrur"r_r�)r:s r&r�r�2ss��
�w�s�I�&�z�#�s�/C��3�q�6�:�t�,��;�&�s�+�C��J��s�-�s�3�4�C�
�J�
��j�	!� ��%���Jr(c�R�|j�D]\}}t|�||<�|S)zOReturns adict with its values converted from Tcl objects to Python
    objects.)r+r�)�adictr0r:s   r&rr?s-���K�K�M���S�"�3�'��c�
�"��Lr(c�2�|�tj�}|S)aIf master is not None, itself is returned. If master is None,
    the default master is returned if there is one, otherwise a new
    master is created and returned.

    If it is not allowed to use the default root and master is None,
    RuntimeError is raised.)�tkinter�_get_default_root)�masters r&rrGs���~��*�*�,���Mr(c�j�eZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zdd�Z
d
�Zd�Zdd�Zy)rzManipulate style database.z
ttk::styleNc�^�t|�}||_|jj|_y�N)rr�r{)�selfr�s  r&�__init__zStyle.__init__Xs"���f�%������+�+�.�.��r(c�d�|�d||<t|j||jd|�}|s|r|Sy)z�Query or sets the default value of the specified option(s) in
        style.

        Each key in kw is an option and each value is either a string or
        a sequence identifying the value for that option.Nr])r�r{�_name)r��style�	query_optrHrss     r&r]zStyle.configure^s<��� � �B�y�M��d�g�g�r�4�:�:�{�E�J���Y��M�r(c
���|�O|jj|jd|d|z�}t|jj	|��S|jj|jd|gt|����}t
|j|�j�D��cic]*\}}|t|jj	|����,c}}Scc}}w)aSQuery or sets dynamic values of the specified option(s) in
        style.

        Each key in kw is an option and each value should be a list or a
        tuple (usually) containing statespecs grouped in tuples, or list,
        or something else of your preference. A statespec is compound of
        one or more states and then a value.r_r*)r{r�r�rurxr?rr+)r�r�r�rHrs�k�vs       r&r_z	Style.mapks���� ��W�W�\�\�$�*�*�e�U�E�I�<M�N�F�'����(9�(9�&�(A�B�B�������d�j�j�%��M���9L�M��&�t�w�w��7�=�=�?�A�?�D�A�q��'����(9�(9�!�(<�=�=�?�A�	A��As�+/Cc��|rdj|�nd}|jj|jd|d|z||�S)aReturns the value specified for option in style.

        If state is specified it is expected to be a sequence of one
        or more states. If the default argument is set, it is used as
        a fallback value in case no specification for option is found.r5r4�lookupr*)r7r{r�r�)r�r��optionr9�defaults     r&r�zStyle.lookup|s?��$)������b���w�w�|�|�D�J�J��%�����7��	r(c	��d}|rt|�d}n|�d}t|j|jj|jd||��S)a�Define the widget layout for given style. If layoutspec is
        omitted, return the layout specification for given style.

        layoutspec is expected to be a list or an object different than
        None that evaluates to False if you want to "turn off" that style.
        If it is a list (or tuple, or something else), each item should be
        a tuple where the first item is the layout name and the second item
        should have the format described below:

        LAYOUTS

            A layout can contain the value None, if takes no options, or
            a dict of options specifying how to arrange the element.
            The layout mechanism uses a simplified version of the pack
            geometry manager: given an initial cavity, each element is
            allocated a parcel. Valid options/values are:

                side: whichside
                    Specifies which side of the cavity to place the
                    element; one of top, right, bottom or left. If
                    omitted, the element occupies the entire cavity.

                sticky: nswe
                    Specifies where the element is placed inside its
                    allocated parcel.

                children: [sublayout... ]
                    Specifies a list of elements to place inside the
                    element. Each element is a tuple (or other sequence)
                    where the first item is the layout name, and the other
                    is a LAYOUT.Nrr`rT)rSrzr{r�r�)r�r��
layoutspec�lspecs    r&rTzStyle.layout�sV��@���&�z�2�1�5�E�
�
#��E�&�d�g�g��G�G�L�L����X�u�e�<�>�	>r(c��t|dg|��i|��\}}|jj|jdd|||g|���y)z9Create a new element in the current theme of given etype.F�element�createN)rOr{r�r�)r��elementnamerFrGrHrIr/s       r&�element_createzStyle.element_create�sG��'��u�B�t�B�r�B�
��d�������T�Z�Z��H�k�5��	��	r(c
��td�|jj|jj|jdd��D��S)z:Returns the list of elements defined in the current theme.c3�>K�|]}|jd����y�w�rwN��lstrip)�.0�ns  r&�	<genexpr>z&Style.element_names.<locals>.<genexpr>�s!����;�-:�q�Q�X�X�c�]�-:���r��names�r#r{rxr�r��r�s r&�
element_nameszStyle.element_names�sB���;�D�G�G�,=�,=��G�G�L�L����Y��8�-:�;�;�	;r(c��td�|jj|jj|jdd|��D��S)z)Return the list of elementname's options.c3�>K�|]}|jd����y�wr�r�)r��os  r&r�z(Style.element_options.<locals>.<genexpr>�s$����J�-I�q�Q�X�X�c�]�-I�r�r�r�r�)r�r�s  r&�element_optionszStyle.element_options�sI���J�D�G�G�,=�,=��G�G�L�L����Y�	�;�G�-I�J�J�	Jr(c
���|rt|�nd}|r-|jj|jdd|d|d|�y|jj|jdd|d|�y)a.Creates a new theme.

        It is an error if themename already exists. If parent is
        specified, the new theme will inherit styles, elements and
        layouts from the specified parent theme. If settings are present,
        they are expected to have the same syntax used for theme_settings.r4�themer�z-parentz	-settingsN�rkr{r�r�)r��	themename�parentrcr%s     r&�theme_createzStyle.theme_create�s^��5=�&�x�0�"����G�G�L�L����W�h�	��6�;��
8�
�G�G�L�L����W�h�	��V�
%r(c�l�t|�}|jj|jdd||�y)a�Temporarily sets the current theme to themename, apply specified
        settings and then restore the previous theme.

        Each key in settings is a style and each value may contain the
        keys 'configure', 'map', 'layout' and 'element create' and they
        are expected to have the same format as specified by the methods
        configure, map, layout and element_create respectively.r�rcNr�)r�r�rcr%s    r&�theme_settingszStyle.theme_settings�s*��'�x�0�������T�Z�Z��*�i��Hr(c��|jj|jj|jdd��S)z#Returns a list of all known themes.r�r�)r{rxr�r�r�s r&�theme_nameszStyle.theme_names�s,���w�w� � ������d�j�j�'�7�!K�L�Lr(c�v�|�|jjd�S|jjd|�y)z�If themename is None, returns the theme in use, otherwise, set
        the current theme to themename, refreshes all widgets and emits
        a <<ThemeChanged>> event.Nzreturn $ttk::currentThemez
ttk::setTheme)r{�evalr�)r�r�s  r&�	theme_usezStyle.theme_use�s4�����7�7�<�<� ;�<�<�
	
�����_�i�0r(r��NN)�__name__�
__module__�__qualname__�__doc__r�r�r]r_r�rTr�r�r�r�r�r�r�rAr(r&rrSsK��$��E�!�
�A�"	�(>�V�;�J�%�"	I�M�
1r(rc�.�eZdZdZdd�Zd�Zdd�Zdd�Zy)�Widgetz!Base class for Tk themed widgets.Nc�`�t|�}tjj||||��y)a�Constructs a Ttk Widget with the parent master.

        STANDARD OPTIONS

            class, cursor, takefocus, style

        SCROLLABLE WIDGET OPTIONS

            xscrollcommand, yscrollcommand

        LABEL WIDGET OPTIONS

            text, textvariable, underline, image, compound, width

        WIDGET STATES

            active, disabled, focus, pressed, selected, background,
            readonly, alternate, invalid
        )rHN)rr�r�r�)r�r��
widgetnamerHs    r&r�zWidget.__init__�s)��(�f�%��������f�j�R��@r(c�R�|jj|jd||�S)z�Returns the name of the element at position x, y, or the empty
        string if the point does not lie within any element.

        x and y are pixel coordinates relative to the widget.�identify�r{r��_w�r�r��ys   r&r�zWidget.identifys!��
�w�w�|�|�D�G�G�Z��A�6�6r(c	��|jj|jj|jddj	|���}|r
|�||i|��S|S)a1Test the widget's state.

        If callback is not specified, returns True if the widget state
        matches statespec and False otherwise. If callback is specified,
        then it will be invoked with *args, **kw if the widget state
        matches statespec. statespec is expected to be a sequence.�instater5)r{�
getbooleanr�r�r7)r��	statespec�callbackrGrH�rets      r&r�zWidget.instatesW���g�g� � ������T�W�W�i����)�1D�E�G���8�'��T�(�R�(�(��
r(c	��|�dj|�}|jjt|jj	|j
d|���S)aModify or inquire widget state.

        Widget state is returned if statespec is None, otherwise it is
        set according to the statespec flags and then a new state spec
        is returned indicating which flags were changed. statespec is
        expected to be a sequence.r5r9)r7r{rxrnr�r�)r�r�s  r&r9zWidget.state)sG��� �����+�I��w�w� � ��T�W�W�\�\�$�'�'�7�I�%N�!O�P�Pr(r�)r�r�r�r�r�r�r�r9rAr(r&r�r��s��+�A�07��
Qr(r�c��eZdZdZdd�Zd�Zy)rzcTtk Button widget, displays a textual label and/or image, and
    evaluates a command when pressed.Nc�4�tj||d|�y)aConstruct a Ttk Button widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, default, width
        zttk::buttonN�r�r��r�r�rHs   r&r�zButton.__init__:s��	����f�m�R�8r(c�N�|jj|jd�S)z/Invokes the command associated with the button.�invoker�r�s r&r�z
Button.invokeIs���w�w�|�|�D�G�G�X�.�.r(r��r�r�r�r�r�r�rAr(r&rr6s��)�9�/r(rc��eZdZdZdd�Zd�Zy)rz;Ttk Checkbutton widget which is either in on- or off-state.Nc�4�tj||d|�y)a'Construct a Ttk Checkbutton widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, offvalue, onvalue, variable
        zttk::checkbuttonNr�r�s   r&r�zCheckbutton.__init__Q���	����f�&8�"�=r(c�N�|jj|jd�S)aWToggles between the selected and deselected states and
        invokes the associated command. If the widget is currently
        selected, sets the option variable to the offvalue option
        and deselects the widget; otherwise, sets the option variable
        to the option onvalue.

        Returns the result of the associated command.r�r�r�s r&r�zCheckbutton.invoke`s���w�w�|�|�D�G�G�X�.�.r(r�r�rAr(r&rrNs��E�>�/r(rc�*�eZdZdZdd�Zd�Zd�Zd�Zy)rzeTtk Entry widget displays a one-line text string and allows that
    string to be edited by the user.Nc�<�tj|||xsd|�y)a�Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        z
ttk::entryNr�)r�r��widgetrHs    r&r�zEntry.__init__os�� 	����f�f�&<��b�Ar(c�n�|j|jj|jd|��S)zqReturn a tuple of (x, y, width, height) which describes the
        bounding box of the character given by index.�bbox��_getintsr{r�r�)r��indexs  r&r�z
Entry.bbox�s(���}�}�T�W�W�\�\�$�'�'�6�5�A�B�Br(c�R�|jj|jd||�S)zxReturns the name of the element at position x, y, or the
        empty string if the coordinates are outside the window.r�r�r�s   r&r�zEntry.identify��!���w�w�|�|�D�G�G�Z��A�6�6r(c��|jj|jj|jd��S)z�Force revalidation, independent of the conditions specified
        by the validate option. Returns False if validation fails, True
        if it succeeds. Sets or clears the invalid state accordingly.�validate�r{r�r�r�r�s r&r�zEntry.validate�s,���w�w�!�!�$�'�'�,�,�t�w�w�
�"C�D�Dr(r�)r�r�r�r�r�r�r�r�rAr(r&rrks��(�B�&C�7�Er(rc�&�eZdZdZdd�Zdd�Zd�Zy)rzMTtk Combobox widget combines a text field with a pop-down list of
    values.Nc�4�tj||dfi|��y)aConstruct a Ttk Combobox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            exportselection, justify, height, postcommand, state,
            textvariable, values, width
        z
ttk::comboboxN�rr�r�s   r&r�zCombobox.__init__�s��	���t�V�_�;��;r(c���|�G|jj|jd�}|dk(ry|jj|�S|jj|jd|�S)aIf newindex is supplied, sets the combobox value to the
        element at position newindex in the list of values. Otherwise,
        returns the index of the current value in the list of values
        or -1 if the current value does not appear in the list.�currentr4���)r{r�r��getint)r��newindexr}s   r&rzCombobox.current�sZ��
���'�'�,�,�t�w�w�	�2�C��b�y���7�7�>�>�#�&�&��w�w�|�|�D�G�G�Y��9�9r(c�R�|jj|jd|�y)z(Sets the value of the combobox to value.�setNr��r�r$s  r&rzCombobox.set���������T�W�W�e�U�+r(r�)r�r�r�r�r�rrrAr(r&rr�s���<�
:�,r(rc��eZdZdZdd�Zy)rzJTtk Frame widget is a container, used to group other widgets
    together.Nc�4�tj||d|�y)z�Construct a Ttk Frame with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            borderwidth, relief, padding, width, height
        z
ttk::frameNr�r�s   r&r�zFrame.__init__����	����f�l�B�7r(r��r�r�r�r�r�rAr(r&rr�s���8r(rc��eZdZdZdd�Zy)rz7Ttk Label widget displays a textual label and/or image.Nc�4�tj||d|�y)aGConstruct a Ttk Label with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, style, takefocus, text,
            textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            anchor, background, font, foreground, justify, padding,
            relief, text, wraplength
        z
ttk::labelNr�r�s   r&r�zLabel.__init__�s��	����f�l�B�7r(r�rrAr(r&rr�s
��A�
8r(rc��eZdZdZdd�Zy)rz�Ttk Labelframe widget is a container used to group other widgets
    together. It has an optional label, which may be a plain text string
    or another widget.Nc�4�tj||d|�y)z�Construct a Ttk Labelframe with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS
            labelanchor, text, underline, padding, labelwidget, width,
            height
        zttk::labelframeNr�r�s   r&r�zLabelframe.__init__�s��	����f�&7��<r(r�rrAr(r&rr�s���=r(rc��eZdZdZdd�Zy)r
zbTtk Menubutton widget displays a textual label and/or image, and
    displays a menu when pressed.Nc�4�tj||d|�y)aConstruct a Ttk Menubutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            direction, menu
        zttk::menubuttonNr�r�s   r&r�zMenubutton.__init__�s��	����f�&7��<r(r�rrAr(r&r
r
�s��%�=r(r
c�X�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
dd
�Zdd�Zd�Z
d
�Zy)rz�Ttk Notebook widget manages a collection of windows and displays
    a single one at a time. Each child window is associated with a tab,
    which the user may select to change the currently-displayed window.Nc�4�tj||d|�y)a\Construct a Ttk Notebook with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            height, padding, width

        TAB OPTIONS

            state, sticky, padding, text, image, compound, underline

        TAB IDENTIFIERS (tab_id)

            The tab_id argument found in several methods may take any of
            the following forms:

                * An integer between zero and the number of tabs
                * The name of a child window
                * A positional specification of the form "@x,y", which
                  defines the tab
                * The string "current", which identifies the
                  currently-selected tab
                * The string "end", which returns the number of tabs (only
                  valid for method index)
        z
ttk::notebookNr�r�s   r&r�zNotebook.__init__s��:	����f�o�r�:r(c�h�|jj|jd|gt|����y)z�Adds a new tab to the notebook.

        If window is currently managed by the notebook but hidden, it is
        restored to its previous position.�addN�r{r�r�r1)r��childrHs   r&rzNotebook.add,s(��
	������T�W�W�e�U�C�o�b�.A�Cr(c�R�|jj|jd|�y)zXRemoves the tab specified by tab_id, unmaps and unmanages the
        associated window.�forgetNr��r��tab_ids  r&rzNotebook.forget4s��	
�����T�W�W�h��/r(c�R�|jj|jd|�y)z�Hides the tab specified by tab_id.

        The tab will not be displayed, but the associated window remains
        managed by the notebook and its configuration remembered. Hidden
        tabs may be restored with the add command.�hideNr�rs  r&rz
Notebook.hide:s��	
�����T�W�W�f�f�-r(c�R�|jj|jd||�S)zZReturns the name of the tab element at position x, y, or the
        empty string if none.r�r�r�s   r&r�zNotebook.identifyCr�r(c��|jj|jj|jd|��S)z|Returns the numeric index of the tab specified by tab_id, or
        the total number of tabs if tab_id is the string "end".r��r{rr�r�rs  r&r�zNotebook.indexIs,���w�w�~�~�d�g�g�l�l�4�7�7�G�V�D�E�Er(c�j�|jj|jd||gt|����y)z�Inserts a pane at the specified position.

        pos is either the string end, an integer index, or the name of
        a managed child. If child is already managed by the notebook,
        moves it to the specified position.�insertNr�r��posrrHs    r&r#zNotebook.insertO�*��	������T�W�W�h��U�K�o�b�6I�Kr(c�P�|jj|jd|�S)z�Selects the specified tab.

        The associated child window will be displayed, and the
        previously-selected window (if different) is unmapped. If tab_id
        is omitted, returns the widget name of the currently selected
        pane.�selectr�rs  r&r(zNotebook.selectXs���w�w�|�|�D�G�G�X�v�6�6r(c�V�|�d||<t|j||jd|�S)z�Query or modify the options of the specific tab_id.

        If kw is not given, returns a dict of the tab option values. If option
        is specified, returns the value of that option. Otherwise, sets the
        options to the corresponding values.N�tab�r�r{r�)r�rr�rHs    r&r*zNotebook.tabbs.�����B�v�J��D�G�G�R����%��@�@r(c��|jj|jj|jd�xsd�S)z2Returns a list of windows managed by the notebook.�tabsrA�r{rxr�r�r�s r&r-z
Notebook.tabsms/���w�w� � ������d�g�g�v�!>�!D�"�E�Er(c�P�|jjd|j�y)a�Enable keyboard traversal for a toplevel window containing
        this notebook.

        This will extend the bindings for the toplevel window containing
        this notebook as follows:

            Control-Tab: selects the tab following the currently selected
                         one

            Shift-Control-Tab: selects the tab preceding the currently
                               selected one

            Alt-K: where K is the mnemonic (underlined) character of any
                   tab, will select that tab.

        Multiple notebooks in a single toplevel may be enabled for
        traversal, including nested notebooks. However, notebook traversal
        only works properly if all panes are direct children of the
        notebook.zttk::notebook::enableTraversalNr�r�s r&�enable_traversalzNotebook.enable_traversalrs��.	
�����5�t�w�w�?r(r�)r�r�r�r�r�rrrr�r�r#r(r*r-r0rAr(r&rrsF��K�;�@D�0�.�7�F�L�7�A�F�
@r(rc�Z�eZdZdZdd�ZejjZd�Zdd�Z	dd�Z
y)rzfTtk Panedwindow widget displays a number of subwindows, stacked
    either vertically or horizontally.Nc�4�tj||d|�y)z�Construct a Ttk Panedwindow with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, width, height

        PANE OPTIONS

            weight
        zttk::panedwindowNr�r�s   r&r�zPanedwindow.__init__�s��	����f�&8�"�=r(c�j�|jj|jd||gt|����y)z�Inserts a pane at the specified positions.

        pos is either the string end, and integer index, or the name
        of a child. If child is already managed by the paned window,
        moves it to the specified position.r#Nrr$s    r&r#zPanedwindow.insert�r&r(c�V�|�d||<t|j||jd|�S)aQQuery or modify the options of the specified pane.

        pane is either an integer index or the name of a managed subwindow.
        If kw is not given, returns a dict of the pane option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.N�paner+)r�r5r�rHs    r&r5zPanedwindow.pane��.�����B�v�J��D�G�G�R����&�$�?�?r(c��|jj|jj|jd||��S)aLIf newpos is specified, sets the position of sash number index.

        May adjust the positions of adjacent sashes to ensure that
        positions are monotonically increasing. Sash positions are further
        constrained to be between 0 and the total size of the widget.

        Returns the new position of sash number index.�sashposr!)r�r��newposs   r&r8zPanedwindow.sashpos�s.���w�w�~�~�d�g�g�l�l�4�7�7�I�u�f�M�N�Nr(r�)r�r�r�r�r�r�r
rr#r5r8rAr(r&rr�s1��*�>�$�
 �
 �
'�
'�F�L�	@�Or(rc�.�eZdZdZdd�Zdd�Zdd�Zd�Zy)ra6Ttk Progressbar widget shows the status of a long-running
    operation. They can operate in two modes: determinate mode shows the
    amount completed relative to the total amount of work to be done, and
    indeterminate mode provides an animated display to let the user know
    that something is happening.Nc�4�tj||d|�y)z�Construct a Ttk Progressbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, length, mode, maximum, value, variable, phase
        zttk::progressbarNr�r�s   r&r�zProgressbar.__init__�s��	����f�&8�"�=r(c�R�|jj|jd|�y)z�Begin autoincrement mode: schedules a recurring timer event
        that calls method step every interval milliseconds.

        interval defaults to 50 milliseconds (20 steps/second) if omitted.�startNr�)r��intervals  r&r=zProgressbar.start�s��
	
�����T�W�W�g�x�0r(c�R�|jj|jd|�y)zRIncrements the value option by amount.

        amount defaults to 1.0 if omitted.�stepNr�)r��amounts  r&r@zProgressbar.step�s��	
�����T�W�W�f�f�-r(c�P�|jj|jd�y)zVStop autoincrement mode: cancels any recurring timer event
        initiated by start.�stopNr�r�s r&rCzProgressbar.stop�s��	
�����T�W�W�f�%r(r�)r�r�r�r�r�r=r@rCrAr(r&rr�s��$�>�1�.�&r(rc��eZdZdZdd�Zd�Zy)rzeTtk Radiobutton widgets are used in groups to show or change a
    set of mutually-exclusive options.Nc�4�tj||d|�y)aConstruct a Ttk Radiobutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, value, variable
        zttk::radiobuttonNr�r�s   r&r�zRadiobutton.__init__�r�r(c�N�|jj|jd�S)z�Sets the option variable to the option value, selects the
        widget, and invokes the associated command.

        Returns the result of the command, or an empty string if
        no command is specified.r�r�r�s r&r�zRadiobutton.invokes���w�w�|�|�D�G�G�X�.�.r(r�r�rAr(r&rr�s��*�>�/r(rc�(�eZdZdZdd�Zdd�Zdd�Zy)rzTtk Scale widget is typically used to control the numeric value of
    a linked variable that varies uniformly over some range.Nc�4�tj||d|�y)z�Construct a Ttk Scale with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, from, length, orient, to, value, variable
        z
ttk::scaleNr�r�s   r&r�zScale.__init__rr(c���tj||fi|��}t|td�tf�s|j|�t
d|vd|vd|vg�r|jd�|S)z�Modify or query scale options.

        Setting a value for any of the "from", "from_" or "to" options
        generates a <<RangeChanged>> event.NrE�from_�to�<<RangeChanged>>)r�r]r!�typern�update�any�event_generate)r��cnfrH�retvals    r&r]zScale.configuresh��
�!�!�$��2�r�2���#��T�
�C�0�1��I�I�c�N���"��g��m�T�R�Z�8�9���� 2�3��
r(c�R�|jj|jd||�S)z�Get the current value of the value option, or the value
        corresponding to the coordinates x, y if they are specified.

        x and y are pixel coordinates relative to the scale widget
        origin.rar�r�s   r&raz	Scale.get,s!���w�w�|�|�D�G�G�U�A�q�1�1r(r�r�)r�r�r�r�r�r]rarAr(r&rr
s��@�8�
�2r(rc��eZdZdZdd�Zy)rz;Ttk Scrollbar controls the viewport of a scrollable widget.Nc�4�tj||d|�y)z�Construct a Ttk Scrollbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, orient
        zttk::scrollbarNr�r�s   r&r�zScrollbar.__init__8���	����f�&6��;r(r�rrAr(r&rr5s
��E�<r(rc��eZdZdZdd�Zy)rzITtk Separator widget displays a horizontal or vertical separator
    bar.Nc�4�tj||d|�y)z�Construct a Ttk Separator with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient
        zttk::separatorNr�r�s   r&r�zSeparator.__init__JrVr(r�rrAr(r&rrFs���<r(rc��eZdZdZdd�Zy)rzlTtk Sizegrip allows the user to resize the containing toplevel
    window by pressing and dragging the grip.Nc�4�tj||d|�y)z�Construct a Ttk Sizegrip with parent master.

        STANDARD OPTIONS

            class, cursor, state, style, takefocus
        z
ttk::sizegripNr�r�s   r&r�zSizegrip.__init__\s��	����f�o�r�:r(r�rrAr(r&rrXs��1�;r(rc��eZdZdZdd�Zd�Zy)rz�Ttk Spinbox is an Entry with increment and decrement arrows

    It is commonly used for number entry or to select from a list of
    string values.
    Nc�4�tj||dfi|��y)a/Construct a Ttk Spinbox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, validate,
            validatecommand, xscrollcommand, invalidcommand

        WIDGET-SPECIFIC OPTIONS

            to, from_, increment, values, wrap, format, command
        zttk::spinboxNr�r�s   r&r�zSpinbox.__init__ms��	���t�V�^�:�r�:r(c�R�|jj|jd|�y)z'Sets the value of the Spinbox to value.rNr�rs  r&rzSpinbox.set|rr(r�)r�r�r�r�r�rrAr(r&rrfs���;�,r(rc���eZdZdZd$d�Zd$d�Zd$d�Zd�Zd$d�Zd�Z	d	�Z
d
�Zd$d�Zd$d�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd$d�Zd$d�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d%d �Z"d%d!�Z#d$d"�Z$d$d#�Z%y)&rz�Ttk Treeview widget displays a hierarchical collection of items.

    Each item has a textual label, an optional image, and an optional list
    of data values. The data values are displayed in successive columns
    after the tree label.Nc�4�tj||d|�y)a�Construct a Ttk Treeview with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand,
            yscrollcommand

        WIDGET-SPECIFIC OPTIONS

            columns, displaycolumns, height, padding, selectmode, show

        ITEM OPTIONS

            text, image, values, open, tags

        TAG OPTIONS

            foreground, background, font, image
        z
ttk::treeviewNr�r�s   r&r�zTreeview.__init__�s��(	����f�o�r�:r(c�x�|j|jj|jd||��xsdS)aTReturns the bounding box (relative to the treeview widget's
        window) of the specified item in the form x y width height.

        If column is specified, returns the bounding box of that cell.
        If the item is not visible (i.e., if it is a descendant of a
        closed item or is scrolled offscreen), returns an empty string.r�r4r�)r��item�columns   r&r�z
Treeview.bbox�s/���}�}�T�W�W�\�\�$�'�'�6�4��H�I�O�R�Or(c��|jj|jj|jd|xsd�xsd�S)zhReturns a tuple of children belonging to item.

        If item is not specified, returns root children.rQr4rAr.�r�ras  r&�get_childrenzTreeview.get_children�s>���w�w� � ������T�W�W�j�$�*�"�=�C��E�	Er(c�T�|jj|jd||�y)z�Replaces item's child with newchildren.

        Children present in item that are not present in newchildren
        are detached from tree. No items in newchildren may be an
        ancestor of item.rQNr�)r�ra�newchildrens   r&�set_childrenzTreeview.set_children�s��	
�����T�W�W�j�$��<r(c�V�|�d||<t|j||jd|�S)a
Query or modify the options for the specified column.

        If kw is not given, returns a dict of the column option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.Nrbr+)r�rbr�rHs    r&rbzTreeview.column�s.�����B�v�J��D�G�G�R����(�F�C�Cr(c�R�|jj|jd|�y)z_Delete all specified items and all their descendants. The root
        item may not be deleted.�deleteNr��r�r+s  r&rkzTreeview.delete�s��	
�����T�W�W�h��.r(c�R�|jj|jd|�y)z�Unlinks all of the specified items from the tree.

        The items and all of their descendants are still present, and may
        be reinserted at another point in the tree, but will not be
        displayed. The root item may not be detached.�detachNr�rls  r&rnzTreeview.detach�s��	
�����T�W�W�h��.r(c��|jj|jj|jd|��S)zSReturns True if the specified item is present in the tree,
        False otherwise.�existsr�rds  r&rpzTreeview.exists�s.���w�w�!�!�$�'�'�,�,�t�w�w��$�"G�H�Hr(c�P�|jj|jd|�S)z}If item is specified, sets the focus item to item. Otherwise,
        returns the current focus item, or '' if there is none.�focusr�rds  r&rrzTreeview.focus�s���w�w�|�|�D�G�G�W�d�3�3r(c���|jd�}|r9t|t�s)|jj	||j
�|d<|�d||<t
|j||jd|�S)a_Query or modify the heading options for the specified column.

        If kw is not given, returns a dict of the heading option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.

        Valid options/values are:
            text: text
                The text to display in the column heading
            image: image_name
                Specifies an image to display to the right of the column
                heading
            anchor: anchor
                Specifies how the heading text should be aligned. One of
                the standard Tk anchor values
            command: callback
                A callback to be invoked when the heading label is
                pressed.

        To configure the tree column heading, call this with column = "#0" �commandN�heading)	rar!rnr��register�_substituter�r{r�)r�rbr�rH�cmds     r&ruzTreeview.heading�sh��*�f�f�Y����z�#�s�+� �K�K�0�0��d�6F�6F�G�B�y�M����B�v�J��D�G�G�R����)�V�D�Dr(c�T�|jj|jd|||�S)z�Returns a description of the specified component under the
        point given by x and y, or the empty string if no such component
        is present at that position.r�r�)r��	componentr�r�s    r&r�zTreeview.identifys#���w�w�|�|�D�G�G�Z��A�q�A�Ar(c�(�|jdd|�S)z.Returns the item ID of the item at position y.�rowr�r�)r�r�s  r&�identify_rowzTreeview.identify_rows���}�}�U�A�q�)�)r(c�(�|jd|d�S)zaReturns the data column identifier of the cell at position x.

        The tree column has ID #0.rbrr})r�r�s  r&�identify_columnzTreeview.identify_columns���}�}�X�q�!�,�,r(c�(�|jd||�S)z�Returns one of:

        heading: Tree heading area.
        separator: Space between two columns headings;
        tree: The tree area.
        cell: A data cell.

        * Availability: Tk 8.6�regionr}r�s   r&�identify_regionzTreeview.identify_regions���}�}�X�q�!�,�,r(c�(�|jd||�S)zEReturns the element at position x, y.

        * Availability: Tk 8.6r�r}r�s   r&�identify_elementzTreeview.identify_elements���}�}�Y��1�-�-r(c��|jj|jj|jd|��S)zOReturns the integer index of item within its parent's list
        of children.r�r!rds  r&r�zTreeview.index&s,���w�w�~�~�d�g�g�l�l�4�7�7�G�T�B�C�Cr(c���t|�}|�.|jj|jd||d|g|���}|S|jj|jd||g|���}|S)a�Creates a new item and return the item identifier of the newly
        created item.

        parent is the item ID of the parent item, or the empty string
        to create a new top-level item. index is an integer, or the value
        end, specifying where in the list of parent's children to insert
        the new item. If index is less than or equal to zero, the new node
        is inserted at the beginning, if index is greater than or equal to
        the current number of children, it is inserted at the end. If iid
        is specified, it is used as the item identifier, iid must not
        already exist in the tree. Otherwise, a new unique identifier
        is generated.r#z-id)r1r{r�r�)r�r�r��iidrHr/r}s       r&r#zTreeview.insert,sq���r�"���?��$�'�'�,�,�t�w�w��&�%��s�#�!�#�C�
�
��$�'�'�,�,�t�w�w��&�%�G�$�G�C��
r(c�V�|�d||<t|j||jd|�S)a-Query or modify the options for the specified item.

        If no options are given, a dict with options/values for the item
        is returned. If option is specified then the value for that option
        is returned. Otherwise, sets the options to the corresponding
        values as given by kw.Nrar+)r�rar�rHs    r&raz
Treeview.itemCr6r(c�V�|jj|jd|||�y)aRMoves item to position index in parent's list of children.

        It is illegal to move an item under one of its descendants. If
        index is less than or equal to zero, item is moved to the
        beginning, if greater than or equal to the number of children,
        it is moved to the end. If item was detached it is reattached.�moveNr�)r�rar�r�s    r&r�z
Treeview.moveOs ��	
�����T�W�W�f�d�F�E�:r(c�P�|jj|jd|�S)zeReturns the identifier of item's next sibling, or '' if item
        is the last child of its parent.�nextr�rds  r&r�z
Treeview.next[����w�w�|�|�D�G�G�V�T�2�2r(c�P�|jj|jd|�S)zaReturns the ID of the parent of item, or '' if item is at the
        top level of the hierarchy.r�r�rds  r&r�zTreeview.parentas���w�w�|�|�D�G�G�X�t�4�4r(c�P�|jj|jd|�S)zjReturns the identifier of item's previous sibling, or '' if
        item is the first child of its parent.�prevr�rds  r&r�z
Treeview.prevgr�r(c�R�|jj|jd|�y)z�Ensure that item is visible.

        Sets all of item's ancestors open option to True, and scrolls
        the widget if necessary so that item is within the visible
        portion of the tree.�seeNr�rds  r&r�zTreeview.seems��	
�����T�W�W�e�T�*r(c��|jj|jj|jd��S)z$Returns the tuple of selected items.�	selectionr.r�s r&r�zTreeview.selectionvs*���w�w� � ������d�g�g�{�!C�D�Dr(c��t|�dk(rt|dttf�r|d}|jj|jd||�y)Nr3rr�)r6r!r#r"r{r�r�)r��selopr+s   r&�
_selectionzTreeview._selection{sA���u�:��?�z�%��(�U�D�M�B��!�H�E������T�W�W�k�5�%�8r(c�(�|jd|�y)z.The specified items becomes the new selection.rN�r�rls  r&�
selection_setzTreeview.selection_set��������u�%r(c�(�|jd|�y)z0Add all of the specified items to the selection.rNr�rls  r&�
selection_addzTreeview.selection_add�r�r(c�(�|jd|�y)z5Remove all of the specified items from the selection.�removeNr�rls  r&�selection_removezTreeview.selection_remove��������%�(r(c�(�|jd|�y)z2Toggle the selection state of each specified item.�toggleNr�rls  r&�selection_togglezTreeview.selection_toggle�r�r(c��|jj|jd|||�}|�|�t|j|dt��S|S)a;Query or set the value of given item.

        With one argument, return a dictionary of column/value pairs
        for the specified item. With two arguments, return the current
        value of the specified column. With three arguments, set the
        value of given column in given item to the specified value.rF)�	cut_minusr�)r{r�r�rr�)r�rarbr$r}s     r&rzTreeview.set�sN���g�g�l�l�4�7�7�E�4���?���>�e�m��d�g�g�s�(-�M�C�
C��Jr(c�J�|j|jdd|f||d��y)z�Bind a callback for the given event sequence to the tag tagname.
        When an event is delivered to an item, the callbacks for each
        of the item's tags option are called.�tag�bindr)rN)�_bindr�)r��tagname�sequencer�s    r&�tag_bindzTreeview.tag_bind�s%��	
�
�
�D�G�G�U�F�G�4�h��a�
�Pr(c�X�|�d||<t|j||jdd|�S)aBQuery or modify the options for the specified tagname.

        If kw is not given, returns a dict of the option settings for tagname.
        If option is specified, returns the value for that option for the
        specified tagname. Otherwise, sets the options to the corresponding
        values for the given tagname.Nr�r]r+)r�r�r�rHs    r&�
tag_configurezTreeview.tag_configure�s5�����B�v�J��D�G�G�R����%����	r(c	��|�A|jj|jj|jdd|��S|jj	|jj|jdd||��S)z�If item is specified, returns 1 or 0 depending on whether the
        specified item has the given tagname. Otherwise, returns a list of
        all items which have the specified tag.

        * Availability: Tk 8.6r��has)r{rxr�r�r�)r�r�ras   r&�tag_haszTreeview.tag_has�sq���<��7�7�$�$������T�W�W�e�U�G�<�>�
>��7�7�%�%������T�W�W�e�U�G�T�B�D�
Dr(r�r�)&r�r�r�r�r�r�rerhrbrkrnrprrrur�r~r�r�r�r�r#rar��reattachr�r�r�r�r�r�r�r�r�r�rr�r�r�rAr(r&rr�s����;�.P�E�=�D�/�/�I�4�E�@B�*�
-�	-�.�D��.	@�;��H�3�5�3�+�E�
9�&�
&�
)�
)�
�Q�
�Dr(rc�d��eZdZdZdd�Z�fd�Zd�Zed��Zejd��Z�xZ
S)rz�A Ttk Scale widget with a Ttk Label widget indicating its
    current value.

    The Ttk Scale can be accessed through instance.scale, and Ttk Label
    can be accessed through instance.labelc�`�|jdd�dk(|_tj||fi|��|xst	j
|�|_|jj|�||_t|�|_
t||j||��|_|jjd|j�|jrdnd}|dk(rdnd}|jj|d��t|�}|j|��|j!�|jj#|dk(rd	nd
��|jj%d|j�|_|jd
|j�|jd|j�y)a�Construct a horizontal LabeledScale with parent master, a
        variable to be associated with the Ttk Scale widget and its range.
        If variable is not specified, a tkinter.IntVar is created.

        WIDGET-SPECIFIC OPTIONS

            compound: 'top' or 'bottom'
                Specifies how to display the label relative to the scale.
                Defaults to 'top'.
        �compound�top)�variablerJrKrL�bottomr�)�side�fill)r�r�re)�anchor�writez<Configure>z<Map>N)�pop�
_label_toprr�r��IntVar�	_variabler�_last_validr�labelr�scaler��_adjust�pack�lower�place�	trace_add�_LabeledScale__tracecb)	r�r�r�rJrKrH�
scale_side�
label_side�dummys	         r&r�zLabeledScale.__init__�sF���&�&��U�3�u�<���
���t�V�*�r�*�!�;�W�^�^�F�%;��������5�!� ����4�[��
��4�$�.�.��"�M��
��
�
���*�D�L�L�9�"&���X�e�
�(�H�4�U�(�
��
�
���Z�c��2��d���
�
�
�
�
�#�
���
��
�
���z�U�':����D����1�1�'�4�<�<�H����	�	�-����.��	�	�'�4�<�<�(r(c���	|jjd|j�|`t�|��d|_d|_y#t$rY�(wxYw)z9Destroy this widget and possibly its associated variable.r�N)r��trace_remover��AttributeError�super�destroyr�r��r��	__class__s �r&r�zLabeledScale.destroy�sS���	��N�N�'�'�����@���
������
���
��
�	��	�s�&A�	A�Ac�B���fd�}t�jd�}t�jd�}||kr||}}�jj�}||cxkr|ksn�j�_y|�_|�jd<�j|�y)z1Adjust the label position according to the scale.c����j��jj�\}}�jr6�jj	��j
j
�z
}n5�jj
��j
j
�z}�j
j||��y)N)r�r�)�update_idletasksr��coordsr��winfo_yr��winfo_reqheight�place_configure)r�r�r�s  �r&�adjust_labelz*LabeledScale._adjust.<locals>.adjust_labels�����!�!�#��:�:�$�$�&�D�A�q�����J�J�&�&�(�4�:�:�+E�+E�+G�G���J�J�.�.�0�4�:�:�3M�3M�3O�O���J�J�&�&��a�&�0r(rErKN�text)r�r�r�rar�r$r��
after_idle)r�rGr�rJrK�newvals`     r&r�zLabeledScale._adjusts����		1��4�:�:�f�-�.��
��
�
�4�(�
)��
��:��E�2�E����#�#�%����$�"�$��)�)�D�J��!���#��
�
�6������%r(c�6�|jj�S)zReturn current scale value.)r�rar�s r&r$zLabeledScale.values���~�~�!�!�#�#r(c�:�|jj|�y)zSet new scale value.N)r�r)r�r:s  r&r$zLabeledScale.value#s��	
�����3�r()NNr�
)r�r�r�r�r�r�r��propertyr$�setter�
__classcell__�r�s@r&rr�sD���.�#)�L
�&�6�$��$��\�\� �� r(rc�8��eZdZdZdd�Zd�Zdd�Z�fd�Z�xZS)rzmThemed OptionMenu, based after tkinter's OptionMenu, which allows
    the user to select a value from a menu.c	��||jdd�|jdd�d�}tj||fi|��tj|d��|d<||_|jdd�|_|r8tjd	tt|j���z��|j|g|���y)
a9Construct a themed OptionMenu widget with master as the parent,
        the resource textvariable set to variable, the initially selected
        value specified by the default parameter, the menu values given by
        *values and additional keywords.

        WIDGET-SPECIFIC OPTIONS

            style: stylename
                Menubutton style.
            direction: 'above', 'below', 'left', 'right', or 'flush'
                Menubutton direction.
            command: callback
                A callback that will be invoked after selecting an item.
        r�N�	direction)�textvariabler�r�F)�tearoff�menurtzunknown option -%s)r�r
r�r��Menur��	_callback�TclErrorr�ro�keys�set_menu)r�r�r�r��values�kwargsrHs       r&r�zOptionMenu.__init__-s���'����G�T�1J�!�:�:�k�4�8�:�����D�&�/�B�/��|�|�D�%�8��V��!������I�t�4�����"�"�#7��T�&�+�+�-�(�)�$+�,�
,�	��
�
�g�'��'r(c��|dk(r%|jtj||��Stj||�S)Nr�)�nametowidgetr
�__getitem__rds  r&r�zOptionMenu.__getitem__Js:���6�>��$�$�Z�%;�%;�D�$�%G�H�H��%�%�d�D�1�1r(c�����d}|jdd�|D]3}|j|�j�dn|f�fd�	�j���5|r�jj	|�yy)zUBuild a new menu of radiobuttons with *values and optionally
        a default value.r�r�endNc�&���j|�Sr�)r�)r:r�s �r&�<lambda>z%OptionMenu.set_menu.<locals>.<lambda>Zs�������)<r()r�rtr�)rk�add_radiobuttonr�r�r)r�r�r�r�r:s`    r&r�zOptionMenu.set_menuQsp����F�|�����A�u���C�� � �s� �N�N�2�D�$'�<����
!�
)����N�N���w�'�r(c�F��	|`t�|�
�y#t$rY�wxYw)z0Destroy this widget and its associated variable.N)r�r�r�r�r�s �r&r�zOptionMenu.destroybs-���	���	������	��	�s��	 � r�)	r�r�r�r�r�r�r�r�r�r�s@r&rr)s!���/�(�:2�(�"�r(r)F)FN)rrDr�)3r��__version__�
__author__�__all__r�rrrrr'r1r;r?rOrSrkrurzr�r�r�r�rr�objectrr�rrrrrrrr	r
rr
rrrrrrrr�XView�YViewrrrrAr(r&�<module>rs������
0�
�,���;�;��� �*�"#�J/%�b(�T�(�83� �
���	�a1�F�a1�H<Q�W�^�^�<Q�~/�V�/�0/�&�/�:'E�F�G�M�M�'E�T",�u�",�J8�F�8�$8�F�8�&=��=�$�
�=��=�&B@�v�B@�J6O�&�'�-�-�6O�p��'&�&�'&�T/�&�/�8%2�F�G�M�M�%2�P<���)�)�<�"<��<�$;�v�;�,�e�,�6CD�v�w�}�}�g�m�m�CD�P
] �5�] �@?��?r(__pycache__/ttk.cpython-312.opt-2.pyc000064400000131767151710635150013244 0ustar00�

T��h���� �	dZdZgd�ZddlZddlmZmZmZmZdAd�ZdBd�Z	d�Z
dAd	�ZdAd
�ZdCd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZdDd�ZGd�de�ZGd�dej2�ZGd�de�ZGd�de�ZGd�deej8�ZGd�d e�ZGd!�d"e�ZGd#�d$e�ZGd%�d&e�Z e Z!Gd'�d(e�Z"Gd)�d*e�Z#Gd+�d,eejH�Z%e%Z$Gd-�d.e�Z&Gd/�d0e�Z'Gd1�d2eejP�Z(Gd3�d4eejR�Z)Gd5�d6e�Z*Gd7�d8e�Z+Gd9�d:e�Z,Gd;�d<eejZej\�Z/Gd=�d>e�Z0Gd?�d@e"�Z1y)Ez0.3.1z!Guilherme Polo <ggpolo@gmail.com>)�Button�Checkbutton�Combobox�Entry�Frame�Label�
Labelframe�
LabelFrame�
Menubutton�Notebook�Panedwindow�PanedWindow�Progressbar�Radiobutton�Scale�	Scrollbar�	Separator�Sizegrip�Spinbox�Style�Treeview�LabeledScale�
OptionMenu�
tclobjs_to_py�setup_master�N)�_flatten�_join�
_stringify�
_splitdictc�h�	|r
t|�}|St|ttf�rt	|�}|S�N)r�
isinstance�list�tupler)�value�scripts  �$/usr/lib64/python3.12/tkinter/ttk.py�_format_optvaluer( s9���
��5�!���L�
�E�D�%�=�	)��e����L�c��	g}|j�D]>\}}|r||vs�
|jd|z�|��$|jt||���@t|�S�N�-%s)�items�appendr(r)�optdictr&�ignore�opts�optr%s      r'�_format_optdictr3*sb��8��D��m�m�o�
��U���F�*��K�K����$�� ����,�U�F�;�<�	&��D�>�r)c��g}|D]S�^}}t|�dk(r
|dxsd}ndj|�}|j|�|��C|j|��U|S)N�r�� )�len�joinr.)r-�opt_val�state�vals    r'�_mapdict_valuesr=:sd���G������u�:��?��!�H�N��E��H�H�U�O�E����u���?��N�N�3����Nr)c	��	g}|j�D].\}}|jd|ztt|�|�f��0t	|�Sr+)r-�extendr(r=r)�mapdictr&r1r2r%s     r'�_format_mapdictrAOsW��B��D��m�m�o�
��U����U�S�[�%�o�e�&<�f�E�G�	H�&��D�>�r)c�Z�	d}d}|dvr_|dk(r$|d}tt|dd��}|�d|��}n)|dd\}}	tt|dd��}
|�d|	�d|
��}t||�}n(|dk(r#|d}t|�dkDrt	|d|�f}|rd	|z}dj|�}||fS)
N�)�image�vsapirDrr5r7��fromz{%s})rr=r3r8r(r9)�etyper&�args�kw�specr1�iname�	imagespec�
class_name�part_id�statemaps           r'�_format_elemcreaterQ`s���K��D�
�D��"�"��G����G�E��o�d�1�2�h�7�8�I�#�Y�/�D�#'�r��(��J���_�T�!�"�X�6�7�H�!+�W�h�?�D��r�6�*��	�&���A�w���t�9�q�=�$�T�!�W�f�5�7�D�
���}���x�x��~����:�r)c��	g}|D]�}|\}}|xsi}djt|dd��}d|z�|�|rd|znd��}d|vrZ|j|dz�||z
}t|d||�\}	}|j|	�||z}|jdd|zz���|j|���d	j|�|fS)
Nr7T)�childrenz %sr6rSz -children {z%s}�
)r9r3r.�_format_layoutlist)
�layout�indent�indent_sizer&�layout_elem�elemr1�fopts�head�	newscripts
          r'rUrU�s���*�6�F��� �
��d��z�r�������t�]�C�D����<��%���
�R�/O�P������M�M�$��/�0��k�!�F� 2�4�
�3C�V��!��I�v��M�M�)�$��k�!�F��M�M�%�3��<�0�1��M�M�$���"�9�9�V��f�$�$r)c�>�	g}|j�D�]v\}}|jd�r6djt|dd��}|j	d|�d|�d��|jd�r6djt|dd��}|j	d|�d|�d��d|vr1|dsd	}nt
|d�\}}|j	d
|�d|�d��|jd
�s��|d
}|d}d}|t|�kr2t||d�s#|dz
}|t|�krt||d�s�#|d|}	|t|�kr
||r||ni}
t|dg|	��i|
��\}}|j	d|�d|�d|�d|�����ydj|�S)N�	configurer7Tzttk::style configure �;�mapzttk::style map rV�nullzttk::style layout z {
z
}zelement createrr5r-zttk::style element create rT)
r-�getr9r3r.rArUr8�hasattrrQ)�settingsr&�namer1�s�_�eoptsrH�argc�elemargs�elemkwrKs            r'�_script_from_settingsrm�s�����F��n�n�&�
��d��8�8�K� ������k�):�D�A�B�A��M�M�4��C�D��8�8�E�?������e��d�;�<�A��M�M�T�1�=�>��t����>���)�$�x�.�9���1��M�M�T�1�E�F��8�8�$�%��)�*�E��!�H�E��D���U��#�G�E�$�K��,I���	����U��#�G�E�$�K��,I��Q�t�}�H�$(�3�u�:�$5�%��+�U�4�[�2�F�+�E�4�M�(�M�f�M�J�D�$��M�M��e�T�4�)�
*�='�B�9�9�V��r)c��	t|t�r|Sg}t|�}t||�D]�\}}t	|d�rt|�j�}n:t|t�r|j�}nt|ttf�s|f}t	|d�rt|�}|jg|�|�����|S)N�typename)	r"�str�iter�ziprd�splitr$r#r.)�stuple�result�itr;r<s     r'�_list_from_statespecrw�s���7��&�#���
�
�F�	
�f��B��"�b�k�
��s��5�*�%���J�$�$�&�E�
��s�
#��K�K�M�E��E�E�4�=�1��H�E��3�
�#��c�(�C��
�
�m��m�s�m�$�"��Mr)c�^�	|j|�}g}d}|t|�kr�||}i}|j||f�|dz
}|t|�krL|||dz\}}|jd�sn/|dd}|dz
}|dk(rt	||�}|||<|t|�kr�L|t|�kr��|S)Nrr5rF�-rS)�	splitlistr8r.�
startswith�_list_from_layouttuple)�tk�ltuple�res�indxrfr1r2r<s        r'r|r|�s���3�
�\�\�&�
!�F�
�C��D�
��V��
��d�|�����
�
�D�$�<� ���	���S��[� ��d�4�!�8�,�H�C���>�>�#�&���a�b�'�C��A�I�D��j� �,�R��5���D��I��S��[� �
��V��
�&�Jr)c��	t|�}|j||z�}t|�dzr|St||t��S)NrF)�conv)r3�callr8r�
_tclobj_to_py)r}�optionsrIrs    r'�_val_or_dictr�sG��5��g�&�G�
�"�'�'�D�7�N�
$�C�
�7�|�a���
��b�#�M�2�2r)c�b�	t|�}	t|�}|S#ttf$rY|SwxYwr!)rp�int�
ValueError�	TypeError)r%s r'�_convert_stringvalr� sA��K���J�E�
��E�
���L��
�	�"�
���L�
�s��.�.c�^�t|t�rd|vr
t|�}|St|�}|S)N�.)r"rp�floatr�)�xs r'�
_to_numberr�*s3���!�S���!�8��a��A�
�H��A��A��Hr)c���	|rWt|d�rKt|t�s;t|ddd�dk(r
t	|�}|Stt
t|��}|St|d�rt|�}|S)N�__len__rro�	StateSpec)rdr"rp�getattrrwr#rar�)r<s r'r�r�2sv��B�
�w�s�I�&�z�#�s�/C��3�q�6�:�t�,��;�&�s�+�C��J��s�-�s�3�4�C�
�J�
��j�	!� ��%���Jr)c�T�	|j�D]\}}t|�||<�|Sr!)r-r�)�adictr2r<s   r'rr?s0����K�K�M���S�"�3�'��c�
�"��Lr)c�4�	|�tj�}|Sr!)�tkinter�_get_default_root)�masters r'rrGs!����~��*�*�,���Mr)c�h�eZdZ	dZdd�Zdd�Zdd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Zdd�Zy)rz
ttk::styleNc�^�t|�}||_|jj|_yr!)rr�r})�selfr�s  r'�__init__zStyle.__init__Xs"���f�%������+�+�.�.��r)c�f�	|�d||<t|j||jd|�}|s|r|Sy)Nr_)r�r}�_name)r��style�	query_optrJrus     r'r_zStyle.configure^sA��	=�
� � �B�y�M��d�g�g�r�4�:�:�{�E�J���Y��M�r)c
���	|�O|jj|jd|d|z�}t|jj	|��S|jj|jd|gt|����}t
|j|�j�D��cic]*\}}|t|jj	|����,c}}Scc}}w)Nrar,)r}r�r�rwrzrArr-)r�r�r�rJru�k�vs       r'raz	Style.mapks���	0�� ��W�W�\�\�$�*�*�e�U�E�I�<M�N�F�'����(9�(9�&�(A�B�B�������d�j�j�%��M���9L�M��&�t�w�w��7�=�=�?�A�?�D�A�q��'����(9�(9�!�(<�=�=�?�A�	A��As�,/Cc��	|rdj|�nd}|jj|jd|d|z||�S)Nr7r6�lookupr,)r9r}r�r�)r�r��optionr;�defaults     r'r�zStyle.lookup|sE��	J�
$)������b���w�w�|�|�D�J�J��%�����7��	r)c	��	d}|rt|�d}n|�d}t|j|jj|jd||��S)NrrbrV)rUr|r}r�r�)r�r��
layoutspec�lspecs    r'rVzStyle.layout�sZ��	$�>���&�z�2�1�5�E�
�
#��E�&�d�g�g��G�G�L�L����X�u�e�<�>�	>r)c��	t|dg|��i|��\}}|jj|jdd|||g|���y)NF�element�create)rQr}r�r�)r��elementnamerHrIrJrKr1s       r'�element_createzStyle.element_create�sJ��G�'��u�B�t�B�r�B�
��d�������T�Z�Z��H�k�5��	��	r)c
��	td�|jj|jj|jdd��D��S)Nc3�>K�|]}|jd����y�w�ryN��lstrip)�.0�ns  r'�	<genexpr>z&Style.element_names.<locals>.<genexpr>�s!����;�-:�q�Q�X�X�c�]�-:���r��names�r$r}rzr�r��r�s r'�
element_nameszStyle.element_names�sE��H��;�D�G�G�,=�,=��G�G�L�L����Y��8�-:�;�;�	;r)c��	td�|jj|jj|jdd|��D��S)Nc3�>K�|]}|jd����y�wr�r�)r��os  r'r�z(Style.element_options.<locals>.<genexpr>�s$����J�-I�q�Q�X�X�c�]�-I�r�r�r�r�)r�r�s  r'�element_optionszStyle.element_options�sL��7��J�D�G�G�,=�,=��G�G�L�L����Y�	�;�G�-I�J�J�	Jr)c
���	|rt|�nd}|r-|jj|jdd|d|d|�y|jj|jdd|d|�y)Nr6�themer�z-parentz	-settings�rmr}r�r�)r��	themename�parentrer&s     r'�theme_createzStyle.theme_create�sd��	N�5=�&�x�0�"����G�G�L�L����W�h�	��6�;��
8�
�G�G�L�L����W�h�	��V�
%r)c�n�	t|�}|jj|jdd||�y)Nr�rer�)r�r�rer&s    r'�theme_settingszStyle.theme_settings�s0��	C�'�x�0�������T�Z�Z��*�i��Hr)c��	|jj|jj|jdd��S)Nr�r�)r}rzr�r�r�s r'�theme_nameszStyle.theme_names�s/��1��w�w� � ������d�j�j�'�7�!K�L�Lr)c�x�	|�|jjd�S|jjd|�y)Nzreturn $ttk::currentThemez
ttk::setTheme)r}�evalr�)r�r�s  r'�	theme_usezStyle.theme_use�s9��	%����7�7�<�<� ;�<�<�
	
�����_�i�0r)r!�NN)�__name__�
__module__�__qualname__r�r�r_rar�rVr�r�r�r�r�r�r�rCr)r'rrSsK��$��E�!�
�A�"	�(>�V�;�J�%�"	I�M�
1r)rc�,�eZdZ	dd�Zd�Zdd�Zdd�Zy)�WidgetNc�b�	t|�}tjj||||��y)N)rJ)rr�r�r�)r�r��
widgetnamerJs    r'r�zWidget.__init__�s.��	�&�f�%��������f�j�R��@r)c�T�	|jj|jd||�S�N�identify�r}r��_w�r�r��ys   r'r�zWidget.identifys'��	A��w�w�|�|�D�G�G�Z��A�6�6r)c	��	|jj|jj|jddj	|���}|r
|�||i|��S|S)N�instater7)r}�
getbooleanr�r�r9)r��	statespec�callbackrIrJ�rets      r'r�zWidget.instates]��	F��g�g� � ������T�W�W�i����)�1D�E�G���8�'��T�(�R�(�(��
r)c	��	|�dj|�}|jjt|jj	|j
d|���S)Nr7r;)r9r}rzrpr�r�)r�r�s  r'r;zWidget.state)sL��	&�� �����+�I��w�w� � ��T�W�W�\�\�$�'�'�7�I�%N�!O�P�Pr)r!)r�r�r�r�r�r�r;rCr)r'r�r��s��+�A�07��
Qr)r�c��eZdZ	dd�Zd�Zy)rNc�6�	tj||d|�y)Nzttk::button�r�r��r�r�rJs   r'r�zButton.__init__:s��
	�	����f�m�R�8r)c�P�	|jj|jd�S�N�invoker�r�s r'r�z
Button.invokeIs��=��w�w�|�|�D�G�G�X�.�.r)r!�r�r�r�r�r�rCr)r'rr6s��)�9�/r)rc��eZdZ	dd�Zd�Zy)rNc�6�	tj||d|�y)Nzttk::checkbuttonr�r�s   r'r�zCheckbutton.__init__Q���
	�	����f�&8�"�=r)c�P�	|jj|jd�Sr�r�r�s r'r�zCheckbutton.invoke`s"��	9��w�w�|�|�D�G�G�X�.�.r)r!r�rCr)r'rrNs��E�>�/r)rc�(�eZdZ	dd�Zd�Zd�Zd�Zy)rNc�>�	tj|||xsd|�y)Nz
ttk::entryr�)r�r��widgetrJs    r'r�zEntry.__init__os ��	�	����f�f�&<��b�Ar)c�p�	|j|jj|jd|��S)N�bbox��_getintsr}r�r�)r��indexs  r'r�z
Entry.bbox�s+��	9��}�}�T�W�W�\�\�$�'�'�6�5�A�B�Br)c�T�	|jj|jd||�Sr�r�r�s   r'r�zEntry.identify�s%��	C��w�w�|�|�D�G�G�Z��A�6�6r)c��	|jj|jj|jd��S)N�validate�r}r�r�r�r�s r'r�zEntry.validate�s2��	I��w�w�!�!�$�'�'�,�,�t�w�w�
�"C�D�Dr)r�)r�r�r�r�r�r�r�rCr)r'rrks��(�B�&C�7�Er)rc�$�eZdZ	dd�Zdd�Zd�Zy)rNc�6�	tj||dfi|��y)Nz
ttk::combobox�rr�r�s   r'r�zCombobox.__init__�s��
	�	���t�V�_�;��;r)c���	|�G|jj|jd�}|dk(ry|jj|�S|jj|jd|�S)N�currentr6���)r}r�r��getint)r��newindexrs   r'rzCombobox.current�s`��	C����'�'�,�,�t�w�w�	�2�C��b�y���7�7�>�>�#�&�&��w�w�|�|�D�G�G�Y��9�9r)c�T�	|jj|jd|�y�N�setr��r�r%s  r'rzCombobox.set�s��6������T�W�W�e�U�+r)r!)r�r�r�r�rrrCr)r'rr�s���<�
:�,r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nz
ttk::framer�r�s   r'r�zFrame.__init__����		�	����f�l�B�7r)r!�r�r�r�r�rCr)r'rr�s���8r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nz
ttk::labelr�r�s   r'r�zLabel.__init__�s��	�	����f�l�B�7r)r!r
rCr)r'rr�s
��A�
8r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nzttk::labelframer�r�s   r'r�zLabelframe.__init__�s��		�	����f�&7��<r)r!r
rCr)r'rr�s���=r)rc��eZdZ	dd�Zy)r
Nc�6�	tj||d|�y)Nzttk::menubuttonr�r�s   r'r�zMenubutton.__init__�s��
	�	����f�&7��<r)r!r
rCr)r'r
r
�s��%�=r)r
c�V�eZdZ	d
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d
d	�Z
d
d
�Zd�Zd�Z
y)rNc�6�	tj||d|�y)Nz
ttk::notebookr�r�s   r'r�zNotebook.__init__s��	�8	����f�o�r�:r)c�j�	|jj|jd|gt|����y�N�add�r}r�r�r3)r��childrJs   r'rzNotebook.add,s-��	.�	������T�W�W�e�U�C�o�b�.A�Cr)c�T�	|jj|jd|�y)N�forgetr��r��tab_ids  r'rzNotebook.forget4s��	������T�W�W�h��/r)c�T�	|jj|jd|�y)N�hider�rs  r'r z
Notebook.hide:s!��	6�
	
�����T�W�W�f�f�-r)c�T�	|jj|jd||�Sr�r�r�s   r'r�zNotebook.identifyCs$��	!��w�w�|�|�D�G�G�Z��A�6�6r)c��	|jj|jj|jd|��S�Nr��r}rr�r�rs  r'r�zNotebook.indexIs0��	C��w�w�~�~�d�g�g�l�l�4�7�7�G�V�D�E�Er)c�l�	|jj|jd||gt|����y�N�insertr�r��posrrJs    r'r'zNotebook.insertO�/��	/�
	������T�W�W�h��U�K�o�b�6I�Kr)c�R�	|jj|jd|�S)N�selectr�rs  r'r,zNotebook.selectXs$��	��w�w�|�|�D�G�G�X�v�6�6r)c�X�	|�d||<t|j||jd|�S)N�tab�r�r}r�)r�rr�rJs    r'r.zNotebook.tabbs3��	0�
���B�v�J��D�G�G�R����%��@�@r)c��	|jj|jj|jd�xsd�S)N�tabsrC�r}rzr�r�r�s r'r1z
Notebook.tabsms2��@��w�w� � ������d�g�g�v�!>�!D�"�E�Er)c�R�	|jjd|j�y)Nzttk::notebook::enableTraversalr�r�s r'�enable_traversalzNotebook.enable_traversalrs ��	�,	
�����5�t�w�w�?r)r!)r�r�r�r�rrr r�r�r'r,r.r1r4rCr)r'rrsF��K�;�@D�0�.�7�F�L�7�A�F�
@r)rc�X�eZdZ	dd�Zej
jZd�Zdd�Zdd�Z	y)rNc�6�	tj||d|�y)Nzttk::panedwindowr�r�s   r'r�zPanedwindow.__init__�s��
	�	����f�&8�"�=r)c�l�	|jj|jd||gt|����yr&rr(s    r'r'zPanedwindow.insert�r*r)c�X�	|�d||<t|j||jd|�S)N�paner/)r�r9r�rJs    r'r9zPanedwindow.pane�s4��	D����B�v�J��D�G�G�R����&�$�?�?r)c��	|jj|jj|jd||��S)N�sashposr$)r�r��newposs   r'r;zPanedwindow.sashpos�s3��	:��w�w�~�~�d�g�g�l�l�4�7�7�I�u�f�M�N�Nr)r!)
r�r�r�r�r�r
rr'r9r;rCr)r'rr�s1��*�>�$�
 �
 �
'�
'�F�L�	@�Or)rc�,�eZdZ	dd�Zdd�Zdd�Zd�Zy)rNc�6�	tj||d|�y)Nzttk::progressbarr�r�s   r'r�zProgressbar.__init__�s��		�	����f�&8�"�=r)c�T�	|jj|jd|�y)N�startr�)r��intervals  r'r@zProgressbar.start�s"��	N�	
�����T�W�W�g�x�0r)c�T�	|jj|jd|�y)N�stepr�)r��amounts  r'rCzProgressbar.step�s!��	.�	
�����T�W�W�f�f�-r)c�R�	|jj|jd�y)N�stopr�r�s r'rFzProgressbar.stop�s��	������T�W�W�f�%r)r!)r�r�r�r�r@rCrFrCr)r'rr�s��$�>�1�.�&r)rc��eZdZ	dd�Zd�Zy)rNc�6�	tj||d|�y)Nzttk::radiobuttonr�r�s   r'r�zRadiobutton.__init__�r�r)c�P�	|jj|jd�Sr�r�r�s r'r�zRadiobutton.invokes"��	$�
�w�w�|�|�D�G�G�X�.�.r)r!r�rCr)r'rr�s��*�>�/r)rc�&�eZdZ	dd�Zdd�Zdd�Zy)rNc�6�	tj||d|�y)Nz
ttk::scaler�r�s   r'r�zScale.__init__rr)c���	tj||fi|��}t|td�tf�s|j|�t
d|vd|vd|vg�r|jd�|S)NrG�from_�to�<<RangeChanged>>)r�r_r"�typerp�update�any�event_generate)r��cnfrJ�retvals    r'r_zScale.configuresm��	/��!�!�$��2�r�2���#��T�
�C�0�1��I�I�c�N���"��g��m�T�R�Z�8�9���� 2�3��
r)c�T�	|jj|jd||�S)Nrcr�r�s   r'rcz	Scale.get,s&��	�
�w�w�|�|�D�G�G�U�A�q�1�1r)r!r�)r�r�r�r�r_rcrCr)r'rr
s��@�8�
�2r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nzttk::scrollbarr�r�s   r'r�zScrollbar.__init__8���		�	����f�&6��;r)r!r
rCr)r'rr5s
��E�<r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nzttk::separatorr�r�s   r'r�zSeparator.__init__JrYr)r!r
rCr)r'rrFs���<r)rc��eZdZ	dd�Zy)rNc�6�	tj||d|�y)Nz
ttk::sizegripr�r�s   r'r�zSizegrip.__init__\s��	�	����f�o�r�:r)r!r
rCr)r'rrXs��1�;r)rc��eZdZ	dd�Zd�Zy)rNc�6�	tj||dfi|��y)Nzttk::spinboxrr�s   r'r�zSpinbox.__init__ms��
	�	���t�V�^�:�r�:r)c�T�	|jj|jd|�yrr�r	s  r'rzSpinbox.set|s��5������T�W�W�e�U�+r)r!)r�r�r�r�rrCr)r'rrfs���;�,r)rc���eZdZ	d#d�Zd#d�Zd#d�Zd�Zd#d�Zd�Zd�Z	d	�Z
d#d
�Zd#d�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd#d�Zd#d�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d$d�Z!d$d �Z"d#d!�Z#d#d"�Z$y)%rNc�6�	tj||d|�y)Nz
ttk::treeviewr�r�s   r'r�zTreeview.__init__�s��	�&	����f�o�r�:r)c�z�	|j|jj|jd||��xsdS)Nr�r6r�)r��item�columns   r'r�z
Treeview.bbox�s5��	K��}�}�T�W�W�\�\�$�'�'�6�4��H�I�O�R�Or)c��	|jj|jj|jd|xsd�xsd�S)NrSr6rCr2�r�rds  r'�get_childrenzTreeview.get_children�sC��	<��w�w� � ������T�W�W�j�$�*�"�=�C��E�	Er)c�V�	|jj|jd||�y)NrSr�)r�rd�newchildrens   r'�set_childrenzTreeview.set_children�s#��	�
	
�����T�W�W�j�$��<r)c�X�	|�d||<t|j||jd|�S)Nrer/)r�rer�rJs    r'rezTreeview.column�s4��	D�
���B�v�J��D�G�G�R����(�F�C�Cr)c�T�	|jj|jd|�y)N�deleter��r�r-s  r'rnzTreeview.delete�s��	$������T�W�W�h��.r)c�T�	|jj|jd|�y)N�detachr�ros  r'rqzTreeview.detach�s!��	9�
	
�����T�W�W�h��.r)c��	|jj|jj|jd|��S)N�existsr�rgs  r'rszTreeview.exists�s1��	��w�w�!�!�$�'�'�,�,�t�w�w��$�"G�H�Hr)c�R�	|jj|jd|�S)N�focusr�rgs  r'ruzTreeview.focus�s#��	C��w�w�|�|�D�G�G�W�d�3�3r)c���	|jd�}|r9t|t�s)|jj	||j
�|d<|�d||<t
|j||jd|�S)N�command�heading)	rcr"rpr��register�_substituter�r}r�)r�rer�rJ�cmds     r'rxzTreeview.heading�sn��	O�(�f�f�Y����z�#�s�+� �K�K�0�0��d�6F�6F�G�B�y�M����B�v�J��D�G�G�R����)�V�D�Dr)c�V�	|jj|jd|||�Sr�r�)r��	componentr�r�s    r'r�zTreeview.identifys(��	(��w�w�|�|�D�G�G�Z��A�q�A�Ar)c�*�	|jdd|�S)N�rowr�r�)r�r�s  r'�identify_rowzTreeview.identify_rows��<��}�}�U�A�q�)�)r)c�*�	|jd|d�S)Nrerr�)r�r�s  r'�identify_columnzTreeview.identify_columns��	&��}�}�X�q�!�,�,r)c�*�	|jd||�S)N�regionr�r�s   r'�identify_regionzTreeview.identify_regions��	"��}�}�X�q�!�,�,r)c�*�	|jd||�S)Nr�r�r�s   r'�identify_elementzTreeview.identify_elements��	"��}�}�Y��1�-�-r)c��	|jj|jj|jd|��Sr#r$rgs  r'r�zTreeview.index&s/��	��w�w�~�~�d�g�g�l�l�4�7�7�G�T�B�C�Cr)c���	t|�}|�.|jj|jd||d|g|���}|S|jj|jd||g|���}|S)Nr'z-id)r3r}r�r�)r�r�r��iidrJr1rs       r'r'zTreeview.insert,sv��	��r�"���?��$�'�'�,�,�t�w�w��&�%��s�#�!�#�C�
�
��$�'�'�,�,�t�w�w��&�%�G�$�G�C��
r)c�X�	|�d||<t|j||jd|�S)Nrdr/)r�rdr�rJs    r'rdz
Treeview.itemCs3��	"����B�v�J��D�G�G�R����&�$�?�?r)c�X�	|jj|jd|||�y)N�mover�)r�rdr�r�s    r'r�z
Treeview.moveOs&��	J�	
�����T�W�W�f�d�F�E�:r)c�R�	|jj|jd|�S)N�nextr�rgs  r'r�z
Treeview.next[s"��	,��w�w�|�|�D�G�G�V�T�2�2r)c�R�	|jj|jd|�S)Nr�r�rgs  r'r�zTreeview.parentas"��	'��w�w�|�|�D�G�G�X�t�4�4r)c�R�	|jj|jd|�S)N�prevr�rgs  r'r�z
Treeview.prevgs"��	2��w�w�|�|�D�G�G�V�T�2�2r)c�T�	|jj|jd|�y)N�seer�rgs  r'r�zTreeview.seems!��	 �
	
�����T�W�W�e�T�*r)c��	|jj|jj|jd��S)N�	selectionr2r�s r'r�zTreeview.selectionvs-��2��w�w� � ������d�g�g�{�!C�D�Dr)c��t|�dk(rt|dttf�r|d}|jj|jd||�y)Nr5rr�)r8r"r$r#r}r�r�)r��selopr-s   r'�
_selectionzTreeview._selection{sA���u�:��?�z�%��(�U�D�M�B��!�H�E������T�W�W�k�5�%�8r)c�*�	|jd|�yr�r�ros  r'�
selection_setzTreeview.selection_set�s��<�����u�%r)c�*�	|jd|�yrr�ros  r'�
selection_addzTreeview.selection_add�s��>�����u�%r)c�*�	|jd|�y)N�remover�ros  r'�selection_removezTreeview.selection_remove�s��C�����%�(r)c�*�	|jd|�y)N�toggler�ros  r'�selection_togglezTreeview.selection_toggle�s��@�����%�(r)c��	|jj|jd|||�}|�|�t|j|dt��S|S)NrF)�	cut_minusr�)r}r�r�rr�)r�rdrer%rs     r'rzTreeview.set�sT��	G��g�g�l�l�4�7�7�E�4���?���>�e�m��d�g�g�s�(-�M�C�
C��Jr)c�L�	|j|jdd|f||d��y)N�tag�bindr)r)�_bindr�)r��tagname�sequencer�s    r'�tag_bindzTreeview.tag_bind�s*��	1�	
�
�
�D�G�G�U�F�G�4�h��a�
�Pr)c�Z�	|�d||<t|j||jdd|�S)Nr�r_r/)r�r�r�rJs    r'�
tag_configurezTreeview.tag_configure�s:��	)����B�v�J��D�G�G�R����%����	r)c	��	|�A|jj|jj|jdd|��S|jj	|jj|jdd||��S)Nr��has)r}rzr�r�r�)r�r�rds   r'�tag_haszTreeview.tag_has�sv��	"�
�<��7�7�$�$������T�W�W�e�U�G�<�>�
>��7�7�%�%������T�W�W�e�U�G�T�B�D�
Dr)r!r�)%r�r�r�r�r�rhrkrernrqrsrurxr�r�r�r�r�r�r'rdr��reattachr�r�r�r�r�r�r�r�r�r�rr�r�r�rCr)r'rr�s����;�.P�E�=�D�/�/�I�4�E�@B�*�
-�	-�.�D��.	@�;��H�3�5�3�+�E�
9�&�
&�
)�
)�
�Q�
�Dr)rc�b��eZdZ	dd�Z�fd�Zd�Zed��Zejd��Z�xZ	S)rc�b�	|jdd�dk(|_tj||fi|��|xst	j
|�|_|jj|�||_t|�|_
t||j||��|_|jjd|j�|jrdnd}|dk(rdnd}|jj|d��t|�}|j|��|j!�|jj#|dk(rd	nd
��|jj%d|j�|_|jd
|j�|jd|j�y)N�compound�top)�variablerMrNrO�bottomr�)�side�fill)r�r�rg)�anchor�writez<Configure>z<Map>)�pop�
_label_toprr�r��IntVar�	_variabler�_last_validr�labelr�scaler��_adjust�pack�lower�place�	trace_add�_LabeledScale__tracecb)	r�r�r�rMrNrJ�
scale_side�
label_side�dummys	         r'r�zLabeledScale.__init__�sK��		��&�&��U�3�u�<���
���t�V�*�r�*�!�;�W�^�^�F�%;��������5�!� ����4�[��
��4�$�.�.��"�M��
��
�
���*�D�L�L�9�"&���X�e�
�(�H�4�U�(�
��
�
���Z�c��2��d���
�
�
�
�
�#�
���
��
�
���z�U�':����D����1�1�'�4�<�<�H����	�	�-����.��	�	�'�4�<�<�(r)c���		|jjd|j�|`t�|��d|_d|_y#t$rY�(wxYw)Nr�)r��trace_remover��AttributeError�super�destroyr�r��r��	__class__s �r'r�zLabeledScale.destroy�sV���G�	��N�N�'�'�����@���
������
���
��
�	��	�s�&A	�		A�Ac�D��	�fd�}t�jd�}t�jd�}||kr||}}�jj�}||cxkr|ksn�j�_y|�_|�jd<�j|�y)Nc����j��jj�\}}�jr6�jj	��j
j
�z
}n5�jj
��j
j
�z}�j
j||��y)N)r�r�)�update_idletasksr��coordsr��winfo_yr��winfo_reqheight�place_configure)r�r�r�s  �r'�adjust_labelz*LabeledScale._adjust.<locals>.adjust_labels�����!�!�#��:�:�$�$�&�D�A�q�����J�J�&�&�(�4�:�:�+E�+E�+G�G���J�J�.�.�0�4�:�:�3M�3M�3O�O���J�J�&�&��a�&�0r)rGrN�text)r�r�r�rcr�r%r��
after_idle)r�rIr�rMrN�newvals`     r'r�zLabeledScale._adjusts����?�		1��4�:�:�f�-�.��
��
�
�4�(�
)��
��:��E�2�E����#�#�%����$�"�$��)�)�D�J��!���#��
�
�6������%r)c�8�	|jj�Sr!)r�rcr�s r'r%zLabeledScale.values��)��~�~�!�!�#�#r)c�<�	|jj|�yr!)r�r)r�r<s  r'r%zLabeledScale.value#s��"������3�r))NNr�
)
r�r�r�r�r�r��propertyr%�setter�
__classcell__�r�s@r'rr�sD���.�#)�L
�&�6�$��$��\�\� �� r)rc�6��eZdZ	dd�Zd�Zdd�Z�fd�Z�xZS)rc	��	||jdd�|jdd�d�}tj||fi|��tj|d��|d<||_|jdd�|_|r8tjdtt|j���z��|j|g|���y)	Nr��	direction)�textvariabler�r�F)�tearoff�menurwzunknown option -%s)r�r
r�r��Menur��	_callback�TclErrorr�rq�keys�set_menu)r�r�r�r��values�kwargsrJs       r'r�zOptionMenu.__init__-s���
	�'����G�T�1J�!�:�:�k�4�8�:�����D�&�/�B�/��|�|�D�%�8��V��!������I�t�4�����"�"�#7��T�&�+�+�-�(�)�$+�,�
,�	��
�
�g�'��'r)c��|dk(r%|jtj||��Stj||�S)Nr�)�nametowidgetr
�__getitem__rgs  r'r�zOptionMenu.__getitem__Js:���6�>��$�$�Z�%;�%;�D�$�%G�H�H��%�%�d�D�1�1r)c����	�d}|jdd�|D]3}|j|�j�dn|f�fd�	�j���5|r�jj	|�yy)Nr�r�endc�&���j|�Sr!)r�)r<r�s �r'�<lambda>z%OptionMenu.set_menu.<locals>.<lambda>Zs�������)<r))r�rwr�)rn�add_radiobuttonr�r�r)r�r�r�r�r<s`    r'r�zOptionMenu.set_menuQss���	��F�|�����A�u���C�� � �s� �N�N�2�D�$'�<����
!�
)����N�N���w�'�r)c�H��		|`t�|�
�y#t$rY�wxYwr!)r�r�r�r�r�s �r'r�zOptionMenu.destroybs0���>�	���	������	��	�s��	!�!r!)r�r�r�r�r�r�r�r�r�s@r'rr)s!���/�(�:2�(�"�r)r)F)FN)rrFr!)2�__version__�
__author__�__all__r�rrrrr(r3r=rArQrUrmrwr|r�r�r�r�rr�objectrr�rrrrrrrr	r
rr
rrrrrrrr�XView�YViewrrrrCr)r'�<module>rs������
0�
�,���;�;��� �*�"#�J/%�b(�T�(�83� �
���	�a1�F�a1�H<Q�W�^�^�<Q�~/�V�/�0/�&�/�:'E�F�G�M�M�'E�T",�u�",�J8�F�8�$8�F�8�&=��=�$�
�=��=�&B@�v�B@�J6O�&�'�-�-�6O�p��'&�&�'&�T/�&�/�8%2�F�G�M�M�%2�P<���)�)�<�"<��<�$;�v�;�,�e�,�6CD�v�w�}�}�g�m�m�CD�P
] �5�] �@?��?r)__pycache__/__init__.cpython-312.opt-1.pyc000064400000737670151710635150014205 0ustar00�

T��hp��� �dZddlZddlZddlZddlZddlZejZddl�ddlZdZ	dZ
eej�Z
eej�Zej Zej"Zej$Zej&d�Zej&dej*�Zd�Zd	�Zd
�Zej2Zd�Zej6Zdud
�ZGd�dej:dd��Zd�Zej@ejB�Gd�d��Z"Gd�d�Z#da$da%d�Z&dvd�Z'd�Z(d�Z)d�Z*dwd�Z+da,Gd�d�Z-Gd�de-�Z.Gd �d!e-�Z/Gd"�d#e-�Z0Gd$�d%e-�Z1dwd&�Z2e3Z4eZ5d'�Z6Gd(�d)�Z7Gd*�d+�Z8Gd,�d-�Z9Gd.�d/�Z:Gd0�d1�Z;Gd2�d3e7e;�Z<ejzd4�d5�Z>dxd6�Z?Gd7�d8�Z@Gd9�d:�ZAGd;�d<�ZBGd=�d>e7�ZCGd?�d@eCe@eAeB�ZDGdA�dBeCe;�ZEGdC�dDeD�ZFGdE�dFeDe9e:�ZGdaHGdG�dHeD�ZIGdI�dJeDe9�ZJGdK�dLeD�ZKGdM�dNeD�ZLGdO�dPeDe9e:�ZMGdQ�dReD�ZNGdS�dTeD�ZOGdU�dVeD�ZPGdW�dXeD�ZQGdY�dZeD�ZRGd[�d\eD�ZSGd]�d^eDe9e:�ZTGd_�d`�ZUGda�dbeO�ZVGdc�dd�ZWGde�dfeW�ZXGdg�dheW�ZYdi�ZZdj�Z[Gdk�dleDe9�Z\Gdm�dneD�Z]Gdo�dpeD�Z^dq�Z_e`�j��D��cgc]/\}}|j�dr�sec|ej��s|dsvr|��1c}}Zeefdtk(re_�yy#e$rY���wxYw#e$rY���wxYwcc}}w)ya8Wrapper functions for Tcl/Tk.

Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow.

Properties of the widgets are specified with keyword arguments.
Keyword arguments have the same name as the corresponding resource
under Tk.

Widgets are positioned with one of the geometry managers Place, Pack
or Grid. These managers can be called with methods place, pack, grid
available in every Widget.

Actions are bound to events by resources (e.g. keyword argument
command) or with the method bind.

Example (Hello, World):
import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()
�N)�*�Fz([\\{}])z([\s])c�@�djtt|��S)�Internal function.� )�join�map�
_stringify��values �)/usr/lib64/python3.12/tkinter/__init__.py�_joinr:s���8�8�C�
�E�*�+�+�c�&�t|ttf�rHt|�dk(r*t	|d�}t
j
|�rd|z}|Sdt|�z}|St|t�r
t|d�}nt|�}|sd}|St
j
|�rMt
jd|�}|jdd�}tjd|�}|dd	k(rd
|z}|S|dd	k(stj
|�rd|z}|S)rrrz{%s}�latin1z{}z\\\1�
z\n�"�\)
�
isinstance�list�tuple�lenr
�	_magic_re�searchr�bytes�str�sub�replace�	_space_rers r
r
r
?s���%�$���'��u�:��?��u�Q�x�(�E�����&�����&�L�#�U�5�\�)�E�"�L��e�U�#���x�(�E���J�E���E��L��
�
�e�
$��M�M�'�5�1�E��M�M�$��.�E��M�M�'�5�1�E��Q�x�3���u����L��1�X��_�	� 0� 0�� 7��U�N�E��Lrc�t�d}|D]0}t|ttf�r|t|�z}�(|��+||fz}�2|S)r�)rrr�_flatten)�seq�res�items   r
r"r"[sE��
�C����d�U�D�M�*�����&�C�
�
����-�C�	�
�Jrc�6�t|t�r|St|td�tf�r|Si}t	|�D]}	|j|��|S#ttf$r3}td|�|j�D]
\}}|||<�Yd}~�Vd}~wwxYw)rNz_cnfmerge: fallback due to:)
r�dict�typerr"�update�AttributeError�	TypeError�print�items)�cnfs�cnf�c�msg�k�vs      r
�	_cnfmerger4js����$�����	�D�4��:�s�+�	,������$��A�
��
�
�1�
� ��
��	#�I�.�
��3�S�9��G�G�I�D�A�q��C��F�&��
�s�A�B�%)B�BTc���|j|�}t|�dzrtd��t|�}i}t	||�D].\}}t|�}|r
|ddk(r|dd}|r||�}|||<�0|S)aReturn a properly formatted dict built from Tcl list pairs.

    If cut_minus is True, the supposed '-' prefix will be removed from
    keys. If conv is specified, it is used to convert values.

    Tcl list is expected to contain an even number of elements.
    �zNTcl list representing a dict is expected to contain an even number of elementsr�-rN)�	splitlistr�RuntimeError�iter�zipr)	�tkr3�	cut_minus�conv�t�itr'�keyrs	         r
�
_splitdictrB�s���	���Q��A�
�1�v��z��C�D�	D�	
�a��B�
�D��"�b�k�
��U��#�h����Q��3���a�b�'�C����K�E���S�	�
"��Krc��eZdZd�Zy)�_VersionInfoTypec���|jdk(r(|j�d|j�d|j��S|j�d|j�|jd�|j��S)N�final�.r)�releaselevel�major�minor�micro�serial��selfs r
�__str__z_VersionInfoType.__str__�sd������'��j�j�\��4�:�:�,�a��
�
�|�<�<��j�j�\��4�:�:�,�t�/@�/@��/C�.D�T�[�[�M�R�RrN)�__name__�
__module__�__qualname__rOr!rr
rDrD�s��SrrD)rIrJrKrHrLc���ddl}|jd|�}|j�\}}}}t|�t|�t|�}}}|dk(r|}d}d}n
d}ddd�|}t	|||||�S)Nrz(\d+)\.(\d+)([ab.])(\d+)rGrF�alpha�beta)�a�b)�re�	fullmatch�groups�intrD)�versionrX�mrIrJrHrLrKs        r
�_parse_versionr^�s���
�����0�'�:�A�)*����&�E�5�,���u�:�s�5�z�3�v�;�&�5�E��s����������$�6�2�<�@���E�5�%��v�F�Frc��eZdZdZeZdZdZeZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)y&)'�	EventType�2�3�4�5�6�7�8�9�10�11�12�13�14�15�16�17�18�19�20�21�22�23�24�25�26�27�28�29�30�31�32�33�34�35�36�37�38N)*rPrQrR�KeyPress�Key�
KeyRelease�ButtonPress�Button�
ButtonRelease�Motion�Enter�Leave�FocusIn�FocusOut�Keymap�Expose�GraphicsExpose�NoExpose�
Visibility�Create�Destroy�Unmap�Map�
MapRequest�Reparent�	Configure�ConfigureRequest�Gravity�
ResizeRequest�	Circulate�CirculateRequest�Property�SelectionClear�SelectionRequest�	Selection�Colormap�
ClientMessage�Mapping�VirtualEvent�Activate�
Deactivate�
MouseWheelr!rr
r`r`�s����H�
�C��J��K�
�F��M�
�F��E��E��G��H�
�F�
�F��N��H��J�
�F��G��E�
�C��J��H��I����G��M��I����H��N����I��H��M��G��L��H��J��Jrr`c��eZdZdZd�Zy)�Eventa�Container for the properties of an event.

    Instances of this type are generated if one of the following events occurs:

    KeyPress, KeyRelease - for keyboard events
    ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events
    Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate,
    Colormap, Gravity, Reparent, Property, Destroy, Activate,
    Deactivate - for window events.

    If a callback function for one of these events is registered
    using bind, bind_all, bind_class, or tag_bind, the callback is
    called with an Event as first argument. It will have the
    following attributes (in braces are the event types for which
    the attribute is valid):

        serial - serial number of event
    num - mouse button pressed (ButtonPress, ButtonRelease)
    focus - whether the window has the focus (Enter, Leave)
    height - height of the exposed window (Configure, Expose)
    width - width of the exposed window (Configure, Expose)
    keycode - keycode of the pressed key (KeyPress, KeyRelease)
    state - state of the event as a number (ButtonPress, ButtonRelease,
                            Enter, KeyPress, KeyRelease,
                            Leave, Motion)
    state - state as a string (Visibility)
    time - when the event occurred
    x - x-position of the mouse
    y - y-position of the mouse
    x_root - x-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    y_root - y-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    char - pressed character (KeyPress, KeyRelease)
    send_event - see X/Windows documentation
    keysym - keysym of the event as a string (KeyPress, KeyRelease)
    keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
    type - type of the event as a number
    widget - widget in which the event occurred
    delta - delta of wheel movement (MouseWheel)
    c��	�|jj�D��cic]\}}|dk7s�||��c}}�	|js�	d=n'|jdk7rt|j��	d<t	|dd�s�	d=|j
dk(r�	d=n�t
|j
t�r�|j
}d}g}t|�D]\}}|d|zzs�|j|��!|dt|�zdz
z}|s|s|jt|��d	j|��	d<|jdk(r�	d
=d}dt	|jd
|j��ddj�	fd�|D���d�Scc}}w)Nz??�char�
send_eventTr�state)
�Shift�Lock�Control�Mod1�Mod2�Mod3�Mod4�Mod5�Button1�Button2�Button3�Button4�Button5r�|�delta)r�r��keysym�keycoder��numr��focus�x�y�width�height�<�namez event�c3�>�K�|]}|�vs�d|�d�|�����y�w)r�=Nr!)�.0r2�attrss  �r
�	<genexpr>z!Event.__repr__.<locals>.<genexpr>'s!�����I�d��a�5�j��5��8�,�d�s�	��>)�__dict__r-r��repr�getattrr�rr[�	enumerate�appendr�hexrr�r()
rNr2r3r��mods�s�i�n�keysr�s
         @r
�__repr__zEvent.__repr__sh���"&�-�-�"5�"5�"7�E�"7�$�!�Q�1��9��A��"7�E���y�y��f�
�
�Y�Y�$�
� ����O�E�&�M��t�\�4�0��l�#��:�:��?��g��
��
�
�C�
(��J�J�E�K�D��A�!�$����1��A��F�#��H�H�Q�K�(��q�3�t�9�}��1�2�2�E��A�����U��$� �X�X�a�[�E�'�N��:�:��?��g��
-��

�D�I�I�v�t�y�y�1��G�G�I�d�I�I�
�	
��AFs
�
F�FN)rPrQrR�__doc__r�r!rr
r�r��s
��(�T$
rr�c��dadaby)z�Inhibit setting of default root window.

    Call this function to inhibit that the first instance of
    Tk is used for windows without an explicit parent window.
    FN)�_support_default_root�
_default_rootr!rr
�
NoDefaultRootr�/s��"���M�rc�r�tstd��t�|rtd|�d���t�}tS)N�INo master specified and tkinter is configured to not support default rootz
Too early to z: no default root window)r�r9r��Tk)�what�roots  r
�_get_default_rootr�=sE�� ��D�E�	E������t�f�4L�M�N�N��t���rc��tstd��t}|�%dat�}da|j	�d|_|S)Nr�FT)r�r9r�r��withdraw�
_temporary�r�s r
�_get_temp_rootr�IsL�� ��D�E�	E��D��|� %���t�� $���
�
������Krc�`�t|dd�r	|j�yy#t$rYywxYw)Nr�F)r��destroy�TclError��masters r
�_destroy_temp_rootr�Zs6���v�|�U�+�	��N�N��,���	��	�s�!�	-�-c��y�rNr!)�errs r
�_tkerrorr�bs��rc�b�	t|�}t|��#t$r
Yt|��wxYw)zBInternal function. Calling it will raise the exception SystemExit.)r[�
ValueError�
SystemExit)�codes r
�_exitr�gs<��
��4�y���T�
����
��
�T�
��
�s��	.�.c�t�eZdZdZdZdZdZdd�Zd�Zd�Z	d�Z
e
Zd�Zd	�Z
d
�Zd�Zd�Zd
�ZeZd�Zd�Zd�Zy)�Variablez�Class to define value holders for e.g. buttons.

    Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations
    that constrain the type of the value returned from get().r�Nc���|�t|t�std��|�td�}|j	�|_|j
|_|r||_n dtt�z|_tdz
a	|�|j|�y|jj|jjdd|j��s|j|j�yy)a.Construct a variable

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        Nzname must be a stringzcreate variable�PY_VARr�info�exists)rrr+r��_rootr<�_tk�_namer��_varnum�
initialize�
getboolean�call�_default�rNr�rr�s    r
�__init__zVariable.__init__|s�����J�t�S�$9��3�4�4��>�&�'8�9�F��\�\�^��
��9�9�����D�J�!�D��M�1�D�J��q�L�G����O�O�E�"����$�$�T�X�X�]�]�6�8�T�Z�Z�%P�Q��O�O�D�M�M�*�Rrc�h�|j�y|jj|jjdd|j��r%|jj	|j�|j
�4|j
D]}|jj
|��d|_yy)zUnset the variable in Tcl.Nrr)rr	r
r�globalunsetvar�_tclCommands�
deletecommand�rNr�s  r
�__del__zVariable.__del__�s����8�8����8�8���t�x�x�}�}�V�X�t�z�z�J�K��H�H�#�#�D�J�J�/����(��)�)�����&�&�t�,�*� $�D��)rc��|jS)z'Return the name of the variable in Tcl.)rrMs r
rOzVariable.__str__�s���z�z�rc�N�|jj|j|�S�zSet the variable to VALUE.)r�globalsetvarr�rNrs  r
�setzVariable.set�s���x�x�$�$�T�Z�Z��7�7rc�L�|jj|j�S)zReturn value of variable.)r�globalgetvarrrMs r
�getzVariable.get�s���x�x�$�$�T�Z�Z�0�0rc�z�t|d|j�j}tt	|��}	|j
}	||jz}|jj||�|j�g|_
|jj|�|S#t$rY�gwxYw#t$rY�fwxYw�N)�CallWrapperr�__call__r��id�__func__r*rPr�
createcommandrr�)rN�callback�f�cbnames    r
�	_registerzVariable._register�s�����$��
�
�3�<�<���b��e���	��(�(�H�	��h�/�/�/�F�	
�����v�q�)����$� "�D����� � ��(��
���	��	���	��	�s#�B�B.�	B+�*B+�.	B:�9B:c�~�|j|�}|jjddd|j||f�|S)a#Define a trace callback for the variable.

        Mode is one of "read", "write", "unset", or a list or tuple of
        such strings.
        Callback must be a function which is called when the variable is
        read, written or unset.

        Return the name of the callback.
        �trace�add�variable�r'rr
r�rN�moder$r&s    r
�	trace_addzVariable.trace_add�s:������)�����
�
�g�u�j��j�j�$��	�	3��
rc�Z�|jjddd|j||�|j�D](\}}|jj	|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)aDelete the trace callback for a variable.

        Mode is one of "read", "write", "unset" or a list or tuple of
        such strings.  Must be same as were specified in trace_add().
        cbname is the name of the callback returned from trace_add().
        r)�remover+rN)	rr
r�
trace_infor8rrr1r��rNr.r&r]�cas     r
�trace_removezVariable.trace_remove�s���	
���
�
�g�x���j�j�$��	0��_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s�B�	B*�)B*c���|jj}t|||jjddd|j���D��cgc]\}}||�|f��c}}Scc}}w)z&Return all trace callback information.r)rr+)rr8r	r
r)rNr8r2r3s    r
r2zVariable.trace_info�sq���H�H�&�&�	�.1�)��d�h�h�m�m�G�V�Z����L�M�/O�P�/O�d�a���1��q�!�/O�P�	P��Ps�A*c�z�|j|�}|jjdd|j||�|S)a�Define a trace callback for the variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CALLBACK must be a function which is called when
        the variable is read, written or undefined.

        Return the name of the callback.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_add() instead.
        r)r+r,r-s    r
�trace_variablezVariable.trace_variable�s3������)�����
�
�g�z�4�:�:�t�V�D��
rc��|jjdd|j||�|jj|�d}|j	�D](\}}|jj|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)aSDelete the trace callback for a variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CBNAME is the name of the callback returned from trace_variable or trace.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_remove() instead.
        r)�vdeleterN)	rr
rr8r2rrr1r�r3s     r
�
trace_vdeletezVariable.trace_vdelete�s���	
���
�
�g�y�$�*�*�d�F�C����#�#�F�+�A�.���_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s�B;�;	C�Cc���|jj|jjdd|j��D�cgc]}|jj|���c}Scc}w)z�Return all trace callback information.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_info() instead.
        r)�vinfo)rr8r
r�rNr�s  r
�trace_vinfozVariable.trace_vinfos`��04�x�x�/A�/A��H�H�M�M�'�7�D�J�J�7�09�:�09�!����"�"�1�%�09�:�	:��:s�"A(c���t|t�stS|j|jk(xrH|jj
|jj
k(xr|j|jk(Sr)rr��NotImplementedr�	__class__rPr)rN�others  r
�__eq__zVariable.__eq__s]���%��*�!�!��
�
�e�k�k�)�*��N�N�+�+�u���/G�/G�G�*��H�H��	�	�)�	+r�NNN)rPrQrRr�rrrr
rrOrrrr'r/r5r2r8r)r;r?rDr!rr
r�r�ssi��A��H�
�C��L�+�<	%��8��J�1��"
��&P��"
�E��,:�+rr�c�"�eZdZdZdZdd�Zd�Zy)�	StringVarz#Value holder for strings variables.r�Nc�4�tj||||�y)a6Construct a string variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        N�r�r
rs    r
r
zStringVar.__init__+���	���$���t�4rc��|jj|j�}t|t�r|St	|�S)z#Return value of variable as string.)rrrrrrs  r
rz
StringVar.get7s3�����%�%�d�j�j�1���e�S�!��L��5�z�rrE�rPrQrRr�rr
rr!rr
rGrG's��-��H�
5�rrGc�"�eZdZdZdZdd�Zd�Zy)�IntVarz#Value holder for integer variables.rNc�4�tj||||�y)a7Construct an integer variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zIntVar.__init__CrJrc��|jj|j�}	|jj|�S#tt
f$r't
|jj|��cYSwxYw)z/Return the value of the variable as an integer.)rrr�getintr+r�r[�	getdoublers  r
rz
IntVar.getOs`�����%�%�d�j�j�1��	2��8�8�?�?�5�)�)���8�$�	2��t�x�x�)�)�%�0�1�1�	2�s�A�3A8�7A8rErLr!rr
rNrN?s��-��H�
5�2rrNc�"�eZdZdZdZdd�Zd�Zy)�	DoubleVarz!Value holder for float variables.gNc�4�tj||||�y)a6Construct a float variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0.0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zDoubleVar.__init__\rJrc�~�|jj|jj|j��S)z,Return the value of the variable as a float.)rrRrrrMs r
rz
DoubleVar.geths*���x�x�!�!�$�(�(�"7�"7��
�
�"C�D�DrrErLr!rr
rTrTXs��+��H�
5�ErrTc�,�eZdZdZdZdd�Zd�ZeZd�Zy)�
BooleanVarz#Value holder for boolean variables.FNc�4�tj||||�y)a:Construct a boolean variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to False)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zBooleanVar.__init__qrJrc��|jj|j|jj|��Sr)rrrr	rs  r
rzBooleanVar.set}s,���x�x�$�$�T�Z�Z����1D�1D�U�1K�L�Lrc��	|jj|jj|j��S#t$rtd��wxYw)z+Return the value of the variable as a bool.� invalid literal for getboolean())rr	rrr�r�rMs r
rzBooleanVar.get�sM��	A��8�8�&�&�t�x�x�'<�'<�T�Z�Z�'H�I�I���	A��?�@�@�	A�s�=A�ArE)	rPrQrRr�rr
rrrr!rr
rXrXms"��-��H�
5�M��J�ArrXc�L�td�jj|�y)zRun the main loop of Tcl.zrun the main loopN)r�r<�mainloop)r�s r
r^r^�s���)�*�-�-�6�6�q�9rc�|�	td�jj|�S#t$rt	d��wxYw)z$Convert Tcl object to True or False.zuse getboolean()r\)r�r<r	r�r�)r�s r
r	r	�s?��=� �!3�4�7�7�B�B�1�E�E���=��;�<�<�=�s�#&�;c�X�eZdZdZdZdZd�Zd�Zd�d�Zd�Z	d�Z
d�d�ZeZd�d	�Z
d�d
�Zd�d�Zd�d�Zd
�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�d�Zd�Zd�Zd�d�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d�d$�Z)d%�Z*d&�Z+d�d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d-�Z2d�d.�Z3d�d/�Z4e4Z5d0�Z6d�d1�Z7d�d2�Z8d3�Z9d4�Z:d5�Z;d6�Z<d�d7�Z=d8�Z>d9�Z?d:�Z@d;�ZAd<�ZBd=�ZCd�d>�ZDd?�ZEd@�ZFdA�ZGdB�ZHd�dC�ZIdD�ZJdE�ZKdF�ZLdG�ZMdH�ZNdI�ZOdJ�ZPdK�ZQdL�ZRdM�ZSdN�ZTdO�ZUdP�ZVdQ�ZWdR�ZXdS�ZYdT�ZZdU�Z[dV�Z\dW�Z]dX�Z^dY�Z_d�dZ�Z`d[�Zad\�Zbd]�Zcd^�Zdd_�Zed`�Zfda�Zgdb�Zhdc�Zidd�Zjde�Zkd�df�Zld�dg�Zmd�dh�Znd�di�Zod�dj�Zpd�dk�Zqdl�Zrd�dm�Zsdn�Ztd�do�Zudp�Zvdq�Zwdr�Zxds�Zydt�Zze{du��Z|d�dv�Z}dw�Z~e~Zd�dx�Z�e�Z�dy�Z�dzZ�d{�j	e��Z�d|�Z�d}�Z�d~�Z�d�Z�d��Z�d�d��Z�e�Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d�gZ�e�fd��Z�e�Z�d��Z�e�Z�d��Z�d�d��Z�e�Z�d�d��Z�e�Z�d��Z�d��Z�ifd��Z�e�Z�d��Z�e�fd��Z�ifd��Z�e�Z�d��Z�e�Z�d�d��Z�d��Z�d��Z�d��Z�d�d��Z�d��Z�d��Z�y)��MisczRInternal class.

    Base class which defines methods common for interior widgets.Nc��|j�4|jD]}|jj|��d|_yy)zkInternal function.

        Delete all Tcl commands created for
        this widget in the Tcl interpreter.N)rr<rrs  r
r�zMisc.destroy�s?��
���(��)�)�����%�%�d�+�*� $�D��)rc��|jj|�	|jj|�y#t$rYywxYw)zDInternal function.

        Delete the Tcl command provided in NAME.N)r<rrr1r�rs  r
rzMisc.deletecommand�sA��	
�����d�#�	����$�$�T�*���	��	�s�9�	A�Ac�n�|jj|jjdd|��S)z�Set Tcl internal variable, whether the look and feel
        should adhere to Motif.

        A parameter of 1 means adhere to Motif (e.g. no color
        change if mouse passes over slider).
        Returns the set value.r�tk_strictMotif)r<r	r
�rN�booleans  r
rezMisc.tk_strictMotif�s2���w�w�!�!�$�'�'�,�,��#�W�#.�/�	/rc�:�|jjd�y)zDChange the color scheme to light brown as used in Tk 3.6 and before.�	tk_bisqueN�r<r
rMs r
rizMisc.tk_bisque�s�������[�!rc	��|jjdt|�ztt|j	���z�y)aSet a new color scheme for all widget elements.

        A single color as argument will cause that all colors of Tk
        widget elements are derived from this.
        Alternatively several keyword parameters and its associated
        colors can be given. The following keywords are valid:
        activeBackground, foreground, selectColor,
        activeForeground, highlightBackground, selectBackground,
        background, highlightColor, selectForeground,
        disabledForeground, insertBackground, troughColor.)�
tk_setPaletteN)r<r
r"rr-�rN�args�kws   r
rlzMisc.tk_setPalette�s;��	
�����'�����!)�$�r�x�x�z�*:�!;�<�	=rc�>�|jjdd|�y)z�Wait until the variable is modified.

        A parameter of type IntVar, StringVar, DoubleVar or
        BooleanVar must be given.�tkwaitr+Nrjrs  r
�
wait_variablezMisc.wait_variable�s��
	
�����X�z�4�0rc�Z�|�|}|jjdd|j�y)zQWait until a WIDGET is destroyed.

        If no parameter is given self is used.Nrq�window�r<r
�_w�rNrts  r
�wait_windowzMisc.wait_window�s&���>��F������X�x����3rc�Z�|�|}|jjdd|j�y)zxWait until the visibility of a WIDGET changes
        (e.g. it appears).

        If no parameter is given self is used.Nrq�
visibilityrurws  r
�wait_visibilityzMisc.wait_visibility�s&��
�>��F������X�|�V�Y�Y�7rc�<�|jj||�y)zSet Tcl variable NAME to VALUE.N)r<�setvar)rNr�rs   r
r}zMisc.setvar�s�������t�U�#rc�8�|jj|�S)z"Return value of Tcl variable NAME.)r<�getvarrs  r
rzMisc.getvar�s���w�w�~�~�d�#�#rc��	|jj|�S#t$r}tt	|���d}~wwxYwr)r<rQr�r�r�rNr��excs   r
rQzMisc.getint�s9��	'��7�7�>�>�!�$�$���	'��S��X�&�&��	'����	?�:�?c��	|jj|�S#t$r}tt	|���d}~wwxYwr)r<rRr�r�rr�s   r
rRzMisc.getdoubles;��	'��7�7�$�$�Q�'�'���	'��S��X�&�&��	'�r�c�j�	|jj|�S#t$rtd��wxYw)zPReturn a boolean value for Tcl boolean values true and false given as parameter.r\)r<r	r�r�)rNr�s  r
r	zMisc.getbooleans:��	A��7�7�%�%�a�(�(���	A��?�@�@�	A�s��2c�P�|jjd|j�y)z�Direct input focus to this widget.

        If the application currently does not have the focus
        this widget will get the focus if the application gets
        the focus through the window manager.r�NrurMs r
�	focus_setzMisc.focus_sets��	
�����W�d�g�g�&rc�R�|jjdd|j�y)ztDirect input focus to this widget even if the
        application does not have the focus. Use with
        caution!r�z-forceNrurMs r
�focus_forcezMisc.focus_forces��	
�����W�h����0rc�j�|jjd�}|dk(s|sy|j|�S)z�Return the widget which has currently the focus in the
        application.

        Use focus_displayof to allow working with several
        displays. Return None if application does not have
        the focus.r��noneN)r<r
�
_nametowidgetrs  r
�	focus_getzMisc.focus_gets2���w�w�|�|�G�$���6�>��d��!�!�$�'�'rc��|jjdd|j�}|dk(s|sy|j|�S)z�Return the widget which has currently the focus on the
        display where this widget is located.

        Return None if the application does not have the focus.r��
-displayofr�N�r<r
rvr�rs  r
�focus_displayofzMisc.focus_displayof(s:��
�w�w�|�|�G�\�4�7�7�;���6�>��d��!�!�$�'�'rc��|jjdd|j�}|dk(s|sy|j|�S)zyReturn the widget which would have the focus if top level
        for this widget gets the focus from the window manager.r�z-lastforr�Nr�rs  r
�
focus_lastforzMisc.focus_lastfor1s:���w�w�|�|�G�Z����9���6�>��d��!�!�$�'�'rc�:�|jjd�y)zXThe widget under mouse will get automatically focus. Can not
        be disabled easily.�tk_focusFollowsMouseNrjrMs r
r�zMisc.tk_focusFollowsMouse8s��	
�����+�,rc�v�|jjd|j�}|sy|j|�S)anReturn the next widget in the focus order which follows
        widget which has currently the focus.

        The focus order first goes to the next child, then to
        the children of the child recursively and then to the
        next sibling which is higher in the stacking order.  A
        widget is omitted if it has the takefocus resource set
        to 0.�tk_focusNextNr�rs  r
r�zMisc.tk_focusNext=s2���w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�v�|jjd|j�}|sy|j|�S)zHReturn previous widget in the focus order. See tk_focusNext for details.�tk_focusPrevNr�rs  r
r�zMisc.tk_focusPrevJs0���w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�*��������jjd|�y����fd�}	�j|_�j|���jjd|��S#t$rt	��j|_Y�SwxYw)aCall function once after given time.

        MS specifies the time in milliseconds. FUNC gives the
        function which shall be called. Additional parameters
        are given as parameters to the function call.  Return
        identifier to cancel scheduling with after_cancel.N�afterc���	���	�j��y#t$rYywxYw#	�j��w#t$rYwwxYwxYwr)rr�)rn�funcr�rNs����r
�callitzMisc.after.<locals>.callit\sY�����$�K���*�*�4�0��#�������*�*�4�0��#����s5�*��	'�'�A
�>�A
�	A
�A
�	A
�
A
)r<r
rPr*r(r')rN�msr�rnr�r�s` `` @r
r�z
Misc.afterPs}����<��G�G�L�L��"�%��
�
6�"&�-�-����>�>�&�)�D��7�7�<�<���T�2�2��	"�
6�"&�t�*�"5�"5���
6�s�A,�,#B�Bc�*�|jd|g|���S)z�Call FUNC once if the Tcl main loop has no event to
        process.

        Return an identifier to cancel the scheduling with
        after_cancel.�idle)r�)rNr�rns   r
�
after_idlezMisc.after_idlels���t�z�z�&�$�.��.�.rc��|std��	|jjdd|�}|jj|�d}|j	|�|jjdd|�y#t
$rY�)wxYw)z�Cancel scheduling of function identified with ID.

        Identifier returned by after or after_idle must be
        given as first parameter.
        z?id must be a valid identifier returned from after or after_idler�rr�cancelN)r�r<r
r8rr�)rNr!�data�scripts    r
�after_cancelzMisc.after_cancelts�����3�4�
4�	��7�7�<�<����4�D��W�W�&�&�t�,�Q�/�F����v�&�	
�����W�h��+���	��	�s�AA9�9	B�Bc�^�|jjd|j|�z�y)zRing a display's bell.)�bellN)r<r
�
_displayof�rN�	displayofs  r
r�z	Misc.bell�s �������Y�����!;�;�<rc��d|vrB|jdk(r3	d|d<|jjd|j|�z�S|jjd|j|�z�S#t$r|d=Y�;wxYw)a�Retrieve data from the clipboard on window's display.

        The window keyword defaults to the root window of the Tkinter
        application.

        The type keyword specifies the form in which the data is
        to be returned and should be an atom name such as STRING
        or FILE_NAME.  Type defaults to STRING, except on X11, where the default
        is to try UTF8_STRING and fall back to STRING.

        This command is equivalent to:

        selection_get(CLIPBOARD)
        r(�x11�UTF8_STRING)�	clipboardr)�_windowingsystemr<r
�_optionsr��rNros  r
�
clipboard_getzMisc.clipboard_get�s������� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1A4�4B�Bc��d|vr|j|d<|jjd|j|�z�y)z�Clear the data in the Tk clipboard.

        A widget specified for the optional displayof keyword
        argument specifies the target display.r�)r��clearN�rvr<r
r�r�s  r
�clipboard_clearzMisc.clipboard_clear�s7��
�b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc��d|vr|j|d<|jjd|j|�zd|fz�y)z�Append STRING to the Tk clipboard.

        A widget specified at the optional displayof keyword
        argument specifies the target display. The clipboard
        can be retrieved with selection_get.r�)r�r��--Nr�)rN�stringros   r
�clipboard_appendzMisc.clipboard_append�sE���b� �D�G�G�"�[�/������,�t�}�}�R�/@�@��v���	 rc�x�|jjdd|j�}|sy|j|�S)zOReturn widget which has currently the grab in this application
        or None.�grab�currentNr�rs  r
�grab_currentzMisc.grab_current�s4���w�w�|�|�F�I�t�w�w�7���D��!�!�$�'�'rc�R�|jjdd|j�y)z.Release grab for this widget if currently set.r��releaseNrurMs r
�grab_releasezMisc.grab_release�s�������V�Y����0rc�R�|jjdd|j�y)zwSet grab for this widget.

        A grab directs all events to this and descendant
        widgets in the application.r�rNrurMs r
�grab_setz
Misc.grab_set�s��
	
�����V�U�D�G�G�,rc�T�|jjddd|j�y)z�Set global grab for this widget.

        A global grab directs all events to this and
        descendant widgets on the display. Use with caution -
        other applications do not get events anymore.r�rz-globalNrurMs r
�grab_set_globalzMisc.grab_set_global�s��	
�����V�U�I�t�w�w�7rc�b�|jjdd|j�}|dk(rd}|S)zYReturn None, "local" or "global" if this widget has
        no, a local or a global grab.r��statusr�Nru)rNr�s  r
�grab_statuszMisc.grab_status�s/�������f�h����8���V��d�V��
rc�B�|jjdd|||�y)z�Set a VALUE (second parameter) for an option
        PATTERN (first parameter).

        An optional third parameter gives the numeric priority
        (defaults to 80).�optionr*Nrj)rN�patternr�prioritys    r
�
option_addzMisc.option_add�s��	
�����X�u�g�u�h�?rc�<�|jjdd�y)zPClear the option database.

        It will be reloaded if option_add is called.r�r�NrjrMs r
�option_clearzMisc.option_clear�s��	
�����X�w�'rc�T�|jjdd|j||�S)z�Return the value for an option NAME for this widget
        with CLASSNAME.

        Values with higher priority override lower values.r�rru)rNr��	classNames   r
�
option_getzMisc.option_get�s#��
�w�w�|�|�H�e�T�W�W�d�I�F�Frc�@�|jjdd||�y)zvRead file FILENAME into the option database.

        An optional second parameter gives the numeric
        priority.r��readfileNrj)rN�fileNamer�s   r
�option_readfilezMisc.option_readfile�s��
	
�����X�z�8�X�>rc��d|vr|j|d<|jjd|j|�z�y)zClear the current X selection.r�)�	selectionr�Nr�r�s  r
�selection_clearzMisc.selection_clear�s5���b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc�2�d|vr|j|d<d|vrB|jdk(r3	d|d<|jjd|j	|�z�S|jjd|j	|�z�S#t
$r|d=Y�;wxYw)a�Return the contents of the current X selection.

        A keyword parameter selection specifies the name of
        the selection and defaults to PRIMARY.  A keyword
        parameter displayof specifies a widget on the display
        to use. A keyword parameter type specifies the form of data to be
        fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
        before STRING.r�r(r�r�)r�r)rvr�r<r
r�r�r�s  r
�
selection_getzMisc.selection_get�s����b� �D�G�G�"�[�/����� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1B�B�Bc��|j|�}|jjd|j|�z|j|fz�y)aSpecify a function COMMAND to call if the X
        selection owned by this widget is queried by another
        application.

        This function must return the contents of the
        selection. The function will be called with the
        arguments OFFSET and LENGTH which allows the chunking
        of very long selections. The following keyword
        parameters can be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME).)r��handleN)r'r<r
r�rv)rN�commandror�s    r
�selection_handlezMisc.selection_handlesC���~�~�g�&�������,�t�}�}�R�/@�@����$�� �	!rc�z�|jjd|j|�z|jfz�y)z�Become owner of X selection.

        A keyword parameter selection specifies the name of
        the selection (default PRIMARY).�r��ownN)r<r
r�rvr�s  r
�
selection_ownzMisc.selection_owns6��
	
�����)����r�"�#�&*�g�g�Z�0�	1rc��d|vr|j|d<|jjd|j|�z�}|sy|j	|�S)z�Return owner of X selection.

        The following keyword parameter can
        be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME).r�r�N)rvr<r
r�r�)rNror�s   r
�selection_own_getzMisc.selection_own_get sO���b� �D�G�G�"�[�/��w�w�|�|�0�4�=�=��3D�D�E���D��!�!�$�'�'rc�D�|jjd||f|z�S)zDSend Tcl command CMD to different interpreter INTERP to be executed.�sendrj)rN�interp�cmdrns    r
r�z	Misc.send,s!���w�w�|�|�V�V�S�1�D�8�9�9rc�R�|jjd|j|�y)z(Lower this widget in the stacking order.�lowerNru)rN�	belowThiss  r
r�z
Misc.lower0��������W�d�g�g�y�1rc�R�|jjd|j|�y)z(Raise this widget in the stacking order.�raiseNru)rN�	aboveThiss  r
�tkraisezMisc.tkraise4r�rc�P�|jjdd�}t|�S)z-Returns the exact version of the Tcl library.r�
patchlevel)r<r
r^)rNr�s  r
�info_patchlevelzMisc.info_patchlevel:s!���W�W�\�\�&�,�7�
��j�)�)rc��d|j|�z|fz}|jj|jj|��S)z*Return integer which represents atom NAME.)�winfo�atom)r�r<rQr
)rNr�r�rns    r
�
winfo_atomzMisc.winfo_atom?s<�� �4�?�?�9�#=�=���G���w�w�~�~�d�g�g�l�l�4�0�1�1rc�h�d|j|�z|fz}|jj|�S)z'Return name of atom with identifier ID.)r��atomname)r�r<r
�rNr!r�rns    r
�winfo_atomnamezMisc.winfo_atomnameDs5��$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��|jj|jjdd|j��S)z7Return number of cells in the colormap for this widget.r��cells�r<rQr
rvrMs r
�winfo_cellszMisc.winfo_cellsJ�/���w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc���g}|jj|jjdd|j��D]#}	|j	|j|���%|S#t$rY�3wxYw)z?Return a list of all widgets which are children of this widget.r��children)r<r8r
rvr�r��KeyError)rN�result�childs   r
�winfo_childrenzMisc.winfo_childrenOsq�����W�W�&�&��G�G�L�L��*�d�g�g�6�8�E�
��
�
�d�0�0��7�8�8��
���
��
�s� A+�+	A7�6A7c�P�|jjdd|j�S)z(Return window class name of this widget.r��classrurMs r
�winfo_classzMisc.winfo_class\s���w�w�|�|�G�W�d�g�g�6�6rc��|jj|jjdd|j��S)z?Return True if at the last color request the colormap was full.r��colormapfull�r<r	r
rvrMs r
�winfo_colormapfullzMisc.winfo_colormapfull`s1���w�w�!�!��G�G�L�L��.�$�'�'�:�<�	<rc��d|j|�z||fz}|jj|�}|sy|j|�S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.)r��
containingN)r�r<r
r�)rN�rootX�rootYr�rnr�s      r
�winfo_containingzMisc.winfo_containingesL��&�����+�,�/4�e�n�=���w�w�|�|�D�!���D��!�!�$�'�'rc��|jj|jjdd|j��S)z$Return the number of bits per pixel.r��depthrrMs r
�winfo_depthzMisc.winfo_depthms*���w�w�~�~�d�g�g�l�l�7�G�T�W�W�E�F�Frc��|jj|jjdd|j��S)z"Return true if this widget exists.r�rrrMs r
�winfo_existszMisc.winfo_existsq�/���w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��|jj|jjdd|j|��S)zWReturn the number of pixels for the given distance NUMBER
        (e.g. "3c") as float.r��fpixels�r<rRr
rv�rN�numbers  r
�
winfo_fpixelszMisc.winfo_fpixelsvs7���w�w� � �������Y�����"1�2�	2rc�P�|jjdd|j�S)zFReturn geometry string for this widget in the form "widthxheight+X+Y".r��geometryrurMs r
�winfo_geometryzMisc.winfo_geometry|����w�w�|�|�G�Z����9�9rc��|jj|jjdd|j��S)zReturn height of this widget.r�r�rrMs r
�winfo_heightzMisc.winfo_height�rrc�d�t|jjdd|j�d�S)z%Return identifier ID for this widget.r�r!r)r[r<r
rvrMs r
�winfo_idz
Misc.winfo_id�s$���4�7�7�<�<���t�w�w�7��;�;rc��d|j|�z}|jj|jj|��S)z9Return the name of all Tcl interpreters for this display.)r��interps)r�r<r8r
)rNr�rns   r
�
winfo_interpszMisc.winfo_interps�s7��#�d�o�o�i�&@�@���w�w� � ������d�!3�4�4rc��|jj|jjdd|j��S)z%Return true if this widget is mapped.r��ismappedrrMs r
�winfo_ismappedzMisc.winfo_ismapped��/���w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�P�|jjdd|j�S)z/Return the window manager name for this widget.r��managerrurMs r
�
winfo_managerzMisc.winfo_manager�s���w�w�|�|�G�Y����8�8rc�P�|jjdd|j�S)zReturn the name of this widget.r�r�rurMs r
�
winfo_namezMisc.winfo_name�s���w�w�|�|�G�V�T�W�W�5�5rc�P�|jjdd|j�S)z-Return the name of the parent of this widget.r��parentrurMs r
�winfo_parentzMisc.winfo_parent�����w�w�|�|�G�X�t�w�w�7�7rc��t|t�rt|�}d|j|�z|fz}|jj|�S)z.Return the pathname of the widget given by ID.)r��pathname)rr[r�r�r<r
r�s    r
�winfo_pathnamezMisc.winfo_pathname�sH���b�#���R��B�$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��|jj|jjdd|j|��S)z'Rounded integer value of winfo_fpixels.r��pixelsrrs  r
�winfo_pixelszMisc.winfo_pixels�s1���w�w�~�~��G�G�L�L��(�D�G�G�V�<�>�	>rc��|jj|jjdd|j��S)z:Return the x coordinate of the pointer on the root window.r��pointerxrrMs r
�winfo_pointerxzMisc.winfo_pointerx�r0rc�n�|j|jjdd|j��S)zHReturn a tuple of x and y coordinates of the pointer on the root window.r��	pointerxy��_getintsr<r
rvrMs r
�winfo_pointerxyzMisc.winfo_pointerxy�s+���}�}��G�G�L�L��+�t�w�w�7�9�	9rc��|jj|jjdd|j��S)z:Return the y coordinate of the pointer on the root window.r��pointeryrrMs r
�winfo_pointeryzMisc.winfo_pointery�r0rc��|jj|jjdd|j��S)z'Return requested height of this widget.r��	reqheightrrMs r
�winfo_reqheightzMisc.winfo_reqheight�s/���w�w�~�~��G�G�L�L��+�t�w�w�7�9�	9rc��|jj|jjdd|j��S)z&Return requested width of this widget.r��reqwidthrrMs r
�winfo_reqwidthzMisc.winfo_reqwidth�r0rc�p�|j|jjdd|j|��S)zNReturn a tuple of integer RGB values in range(65536) for color in this widget.r��rgbrE)rN�colors  r
�	winfo_rgbzMisc.winfo_rgb�s-���}�}��G�G�L�L��%����%�8�:�	:rc��|jj|jjdd|j��S)zSReturn x coordinate of upper left corner of this widget on the
        root window.r��rootxrrMs r
�winfo_rootxzMisc.winfo_rootx��1���w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc��|jj|jjdd|j��S)zSReturn y coordinate of upper left corner of this widget on the
        root window.r��rootyrrMs r
�winfo_rootyzMisc.winfo_rooty�rXrc�P�|jjdd|j�S)z&Return the screen name of this widget.r��screenrurMs r
�winfo_screenzMisc.winfo_screen�r9rc��|jj|jjdd|j��S)zTReturn the number of the cells in the colormap of the screen
        of this widget.r��screencellsrrMs r
�winfo_screencellszMisc.winfo_screencells��1���w�w�~�~��G�G�L�L��-����9�;�	;rc��|jj|jjdd|j��S)z\Return the number of bits per pixel of the root window of the
        screen of this widget.r��screendepthrrMs r
�winfo_screendepthzMisc.winfo_screendepth�rbrc��|jj|jjdd|j��S)zXReturn the number of pixels of the height of the screen of this widget
        in pixel.r��screenheightrrMs r
�winfo_screenheightzMisc.winfo_screenheight�s1���w�w�~�~��G�G�L�L��.�$�'�'�:�<�	<rc��|jj|jjdd|j��S)zUReturn the number of pixels of the height of the screen of
        this widget in mm.r��screenmmheightrrMs r
�winfo_screenmmheightzMisc.winfo_screenmmheight�s2���w�w�~�~��G�G�L�L��"2�D�G�G�<�>�	>rc��|jj|jjdd|j��S)zTReturn the number of pixels of the width of the screen of
        this widget in mm.r��
screenmmwidthrrMs r
�winfo_screenmmwidthzMisc.winfo_screenmmwidth�s1���w�w�~�~��G�G�L�L��/�4�7�7�;�=�	=rc�P�|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the default
        colormodel of this screen.r��screenvisualrurMs r
�winfo_screenvisualzMisc.winfo_screenvisual�s���w�w�|�|�G�^�T�W�W�=�=rc��|jj|jjdd|j��S)zWReturn the number of pixels of the width of the screen of
        this widget in pixel.r��screenwidthrrMs r
�winfo_screenwidthzMisc.winfo_screenwidth�rbrc�P�|jjdd|j�S)zxReturn information of the X-Server of the screen of this widget in
        the form "XmajorRminor vendor vendorVersion".r��serverrurMs r
�winfo_serverzMisc.winfo_servers���w�w�|�|�G�X�t�w�w�7�7rc�n�|j|jjdd|j��S)z*Return the toplevel widget of this widget.r��toplevel)r�r<r
rvrMs r
�winfo_toplevelzMisc.winfo_toplevel	s/���!�!�$�'�'�,�,��Z����#*�+�	+rc��|jj|jjdd|j��S)zBReturn true if the widget and all its higher ancestors are mapped.r��viewablerrMs r
�winfo_viewablezMisc.winfo_viewabler0rc�P�|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the
        colormodel of this widget.r��visualrurMs r
�winfo_visualzMisc.winfo_visuals���w�w�|�|�G�X�t�w�w�7�7rc�P�|jjdd|j�S)z7Return the X identifier for the visual for this widget.r��visualidrurMs r
�winfo_visualidzMisc.winfo_visualidr%rc�.�|jjdd|j|rdnd�}|jj|�D�cgc]}|jj|���}}|D�cgc]}|j	|���c}Scc}wcc}w)z�Return a list of all visuals available for the screen
        of this widget.

        Each item in the list consists of a visual name (see winfo_visual), a
        depth and if includeids is true is given also the X identifier.r��visualsavailable�
includeidsN)r<r
rvr8�_Misc__winfo_parseitem)rNr�r�r�s    r
�winfo_visualsavailablezMisc.winfo_visualsavailables����w�w�|�|�G�%7����,6�L�D�B��.2�g�g�.?�.?��.E�F�.E�����!�!�!�$�.E��F�37�8�4�a��&�&�q�)�4�8�8��G��8s�
"B
�2Bc	�R�|ddtt|j|dd��zS)rNr)rr	�_Misc__winfo_getint)rNr?s  r
�__winfo_parseitemzMisc.__winfo_parseitem(s+����!�u�u�S��!4�!4�a���e�<�=�=�=rc��t|d�S)rr)r[r>s  r
�__winfo_getintzMisc.__winfo_getint,s���1�a�y�rc��|jj|jjdd|j��S)z�Return the height of the virtual root window associated with this
        widget in pixels. If there is no virtual root window return the
        height of the screen.r��vrootheightrrMs r
�winfo_vrootheightzMisc.winfo_vrootheight0s1���w�w�~�~��G�G�L�L��-����9�;�	;rc��|jj|jjdd|j��S)z�Return the width of the virtual root window associated with this
        widget in pixel. If there is no virtual root window return the
        width of the screen.r��
vrootwidthrrMs r
�winfo_vrootwidthzMisc.winfo_vrootwidth7s1���w�w�~�~��G�G�L�L��,����8�:�	:rc��|jj|jjdd|j��S)ziReturn the x offset of the virtual root relative to the root
        window of the screen of this widget.r��vrootxrrMs r
�winfo_vrootxzMisc.winfo_vrootx>�1���w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��|jj|jjdd|j��S)ziReturn the y offset of the virtual root relative to the root
        window of the screen of this widget.r��vrootyrrMs r
�winfo_vrootyzMisc.winfo_vrootyDr�rc��|jj|jjdd|j��S)z Return the width of this widget.r�r�rrMs r
�winfo_widthzMisc.winfo_widthJrrc��|jj|jjdd|j��S)zVReturn the x coordinate of the upper left corner of this widget
        in the parent.r�r�rrMs r
�winfo_xzMisc.winfo_xO�1���w�w�~�~��G�G�L�L��#�t�w�w�/�1�	1rc��|jj|jjdd|j��S)zVReturn the y coordinate of the upper left corner of this widget
        in the parent.r�r�rrMs r
�winfo_yzMisc.winfo_yUr�rc�:�|jjd�y)zEEnter event loop until all pending events have been processed by Tcl.r)NrjrMs r
r)zMisc.update[s�������X�rc�<�|jjdd�y)z�Enter event loop until all idle callbacks have been called. This
        will update the display of windows but not process events caused by
        the user.r)�	idletasksNrjrMs r
�update_idletaskszMisc.update_idletasks_s��	
�����X�{�+rc���|�?|jj|jjd|j��S|jjd|j|�y)a,Set or get the list of bindtags for this widget.

        With no argument return the list of all bindtags associated with
        this widget. With a list of strings as argument the bindtags are
        set to this list. The bindtags determine in which order events are
        processed (see bind).N�bindtags�r<r8r
rv)rN�tagLists  r
r�z
Misc.bindtagsesP���?��7�7�$�$������Z����1�3�
3�
�G�G�L�L��T�W�W�g�6rc���t|t�r!|jj|||fz�y|r\|j	||j
|�}|xrdxsd�d|�d|j�d�}|jj|||fz�|S|r|jj||fz�S|jj|jj|��S)r�+r��if {"[rz]" == "break"} break
N)rrr<r
r'�_substitute�_subst_format_strr8)rNr��sequencer�r*�needcleanup�funcidr�s        r
�_bindz
Misc._bindrs����d�C� ��G�G�L�L���4� 0�0�1�
��^�^�D�$�*:�*:�#�%�F��K�C�%�2�%���.�.�0�C�
�G�G�L�L���3��/�0��M�
��7�7�<�<���{� 2�3�3��7�7�$�$�T�W�W�\�\�$�%7�8�8rc�B�|jd|jf|||�S)aOBind to this widget at event SEQUENCE a call to function FUNC.

        SEQUENCE is a string of concatenated event
        patterns. An event pattern is of the form
        <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
        of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
        Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
        B3, Alt, Button4, B4, Double, Button5, B5 Triple,
        Mod1, M1. TYPE is one of Activate, Enter, Map,
        ButtonPress, Button, Expose, Motion, ButtonRelease
        FocusIn, MouseWheel, Circulate, FocusOut, Property,
        Colormap, Gravity Reparent, Configure, KeyPress, Key,
        Unmap, Deactivate, KeyRelease Visibility, Destroy,
        Leave and DETAIL is the button number for ButtonPress,
        ButtonRelease and DETAIL is the Keysym for KeyPress and
        KeyRelease. Examples are
        <Control-Button-1> for pressing Control and mouse button 1 or
        <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
        An event pattern can also be a virtual event of the form
        <<AString>> where AString can be arbitrary. This
        event can be generated by event_generate.
        If events are concatenated they must appear shortly
        after each other.

        FUNC will be called if the event sequence occurs with an
        instance of Event as argument. If the return value of FUNC is
        "break" no further bound function is invoked.

        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function.

        Bind will return an identifier to allow deletion of the bound function with
        unbind without memory leak.

        If FUNC or SEQUENCE is omitted the bound function or list
        of bound events are returned.�bind�r�rv�rNr�r�r*s    r
r�z	Misc.bind�s#��N�z�z�6�4�7�7�+�X�t�S�A�Arc�B�|jd|j|f|�y)aUnbind for this widget the event SEQUENCE.

        If FUNCID is given, only unbind the function identified with FUNCID
        and also delete the corresponding Tcl command.

        Otherwise destroy the current binding for SEQUENCE, leaving SEQUENCE
        unbound.
        r�N��_unbindrv)rNr�r�s   r
�unbindzMisc.unbind�s��	
���f�d�g�g�x�0�&�9rc�^��|�|jjg|�d���y|jj|�jd�}d|�d��dj�fd�|D��}|j	�sd}|jjg|�|���|j|�y)Nr�rr�rc3�D�K�|]}|j��s|���y�wr)�
startswith)r��line�prefixs  �r
r�zMisc._unbind.<locals>.<genexpr>�s#�����=�e�d�$(�O�O�F�$;�"�e�s� )r<r
�splitr�stripr)rNr�r��lines�keepr�s     @r
r�zMisc._unbind�s�����>��D�G�G�L�L�#�$�#��#��G�G�L�L��&�,�,�T�2�E��v�h�a�(�F��9�9�=�e�=�=�D��:�:�<����D�G�G�L�L�%�$�%��%����v�&rc�H�|j�jd|||d�S)aBind to all widgets at an event SEQUENCE a call to function FUNC.
        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function. See bind for the return value.)r��allT�rr�r�s    r
�bind_allz
Misc.bind_all�s#��
�z�z�|�!�!�/�8�T�3��M�Mrc�H�|j�jdd|f�y)z8Unbind for all widgets for event SEQUENCE all functions.r�r�N�rr�)rNr�s  r
�
unbind_allzMisc.unbind_all�s���
�
����f�e�X�6�7rc�L�|j�jd|f|||d�S)a=Bind to widgets with bindtag CLASSNAME at event
        SEQUENCE a call of function FUNC. An additional
        boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or
        whether it will replace the previous function. See bind for
        the return value.r�Tr�)rNr�r�r�r*s     r
�
bind_classzMisc.bind_class�s(���z�z�|�!�!�6�9�"5�x��s�D�Q�Qrc�H�|j�jd||f�y)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE
        all functions.r�Nr�)rNr�r�s   r
�unbind_classzMisc.unbind_class�s��	
�
�
����f�i��:�;rc�:�|jj|�y)zCall the mainloop of Tk.N)r<r^)rNr�s  r
r^z
Misc.mainloop�s��������rc�8�|jj�y)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r<�quitrMs r
r�z	Misc.quit�s�������rc��|rBtt|jj|jj	|���Syr�)rr	r<rQr8�rNr�s  r
rFz
Misc._getints�s3�����T�W�W�^�^�T�W�W�->�->�v�-F�G�H�H�rc��|rBtt|jj|jj	|���Syr�)rr	r<rRr8r�s  r
�_getdoubleszMisc._getdoubles�s5�����T�W�W�.�.����0A�0A�&�0I�J�K�K�rc�>�|r|jj|�Syr�)r<r	r�s  r
�_getbooleanzMisc._getboolean�s����7�7�%�%�f�-�-�rc�0�|rd|fS|�d|jfSy)rr�r!�rvr�s  r
r�zMisc._displayof�s(��� �)�,�,��� �$�'�'�*�*�rc��	|j�jS#t$r6|jj	dd�x}|j�_|cYSwxYw)rr<�windowingsystem)r�_windowingsystem_cachedr*r<r
)rN�wss  r
r�zMisc._windowingsystem�sR��	��:�:�<�7�7�7���	������T�+<�=�
>�B�����5��I�	�s��<A�Ac���|rt||f�}nt|�}d}|j�D]�\}}|��	|ddk(r|dd}t|�r|j|�}n�t	|t
tf�rqg}|D]Y}t	|t�r|jt|���.t	|t�r|jt|���Yndj|�}|d|z|fz}��|S)rr!N����_rr7)r4r-�callabler'rrrr[r�rr
r)rNr/ror$r2r3�nvr%s        r
r�z
Misc._optionss���
��S�"�I�&�C��C�.�C����I�I�K�D�A�q��}��R�5�C�<�Q�s��V���A�;����q�)�A���E�4�=�1��B� !��%�d�C�0��I�I�c�$�i�0�'��c�2��I�I�j��&6�7�!�
!"� �H�H�R�L���S��U�A�J�&��! �"�
rc��t|�jd�}|}|ds|j�}|dd}|D]}|s|S|j|}�|S)zPReturn the Tkinter instance of a widget identified by
        its Tcl name NAME.rGrrN)rr�rr)rNr��wr�s    r
�nametowidgetzMisc.nametowidget"se���4�y���s�#�����A�w����	�A����8�D��A������
�
�1�
�A��
�rc�j�t|||�j}tt|��}	|j}	||jz}|jj||�|r.|j�g|_	|jj|�|S#t
$rY�iwxYw#t
$rY�hwxYw)z�Return a newly created Tcl function. If this
        function is called, the Python function FUNC will
        be executed. An optional function SUBST can
        be given which will be executed before FUNC.)rr r�r!r"r*rPr<r#rr�)rNr��substr�r%r�s      r
r'zMisc._register5s���

��e�T�*�3�3���B�q�E�{��	��=�=�D�	��$�-�-�'�D�	
�����d�A�&��� � �(�$&��!����$�$�T�*�����	��	���	��	�s"�B�B&�	B#�"B#�&	B2�1B2c�T�|}|j�|j}|j��|S)rr�)rNr�s  r
rz
Misc._rootMs'�����h�h�"����A�a�h�h�"��r)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%Drc���t|�t|j�k7r|S|jj}|jj��fd�}|\}}}}}}	}
}}}
}}}}}}}}}t�}�|�|_||�|_||�|_||�|_
||�|_||	�|_||
�|_
||�|_||�|_||
�|_||_||�|_||_||�|_	t+|�|_	|j1|�|_||�|_||�|_	�|�|_|fS#t$rY��wxYw#t$rY��wxYw#t.$r
||_Y�rwxYw#t4$r
||_Y�qwxYw#t.tf$rd|_Y|fSwxYw)rc�D��	�|�S#ttf$r|cYSwxYw)z?Tk changed behavior in 8.4.2, returning "??" rather more often.)r�r�)r�rQs �r
�getint_eventz&Misc._substitute.<locals>.getint_event]s+���
��a�y� ����)�
���
�s���r)r�
_subst_formatr<r	rQr�rLr�r�r�r�r�r��timer�r�r�r�r�r��
keysym_numr`r(r�r��widgetr�x_root�y_rootr�)rNrnr	r��nsignrWr%�hr2r�r?r�r�r��A�E�K�N�W�T�X�Y�D�erQs                        @r
r�zMisc._substituteWs�����t�9��D�.�.�/�/����W�W�'�'�
�������	�GK�C��q�!�Q��1�a��A�q�!�Q��1�a��A�q�!��G���%�=����Q����!�!�}�Q�W���?��� ��O��	��q�/����a�����q�/����1�o����1�o������&�q�M�Q�\����#�A����	��q�\�A�F�	��)�)�!�,�A�H� ��?�����?���	��Q�i�A�G��t���7����������
�	��A�F�	���	��A�H�	���H�%�	��A�G��t��	�sZ�
E3�?
F�!F�2F'�#
F=�3	E?�>E?�	F�
F�F$�#F$�'F:�9F:�=G�Gc�z�tj�\}}}|j�}|j|||�yr�)�sys�exc_infor�report_callback_exception)rNr��val�tbr�s     r
�_report_exceptionzMisc._report_exception�s0���|�|�~���S�"��z�z�|���&�&�s�C��4rc���i}|jj|jj|��D]5}|jj|�}|dddf|ddz||ddd<�7|S)z;Call Tcl configure command and return the result as a dict.rrN�r<r8r
)rNrnr/r�s    r
�
_getconfigurezMisc._getconfigure�st�������"�"�<�4�7�7�<�<��#6�7�A����!�!�!�$�A��q�T�!�"�X�K�!�A�B�%�/�C��!��Q�R��M�8��
rc��|jj|jj|��}|dddf|ddzS)Nrrr�rNrnr�s   r
�_getconfigure1zMisc._getconfigure1�sB���G�G���l�d�g�g�l�l�D�1�2���!��Q�R��{�Q�q�r�U�"�"rc��|rt||f�}n
|rt|�}|�&|jt|j|f��St	|t
�r*|j
t|j|d|zf��S|jjt|j|f�|j|�z�y)rNr7)
r4rr"rvrrr
r<r
r�)rNr�r/ros    r
�
_configurezMisc._configure�s���
��S�"�I�&�C�
��C�.�C��;��%�%�h�����~�&>�?�?��c�3���&�&�x����#�s�3�w�0G�'H�I�I������X�t�w�w��n�-��
�
�c�0B�B�Crc�(�|jd||�S)z�Configure resources of a widget.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method keys.
        �	configure�r�rNr/ros   r
rzMisc.configure�s�����{�C��4�4rc�V�|jj|jdd|z�S)z4Return the resource value for a KEY given as string.�cgetr7ru�rNrAs  r
rz	Misc.cget�s!���w�w�|�|�D�G�G�V�S�3�Y�7�7rc�*�|j||i�yr)r�rNrArs   r
�__setitem__zMisc.__setitem__�s������U�|�$rc���|jj}||jj|jd��D�cgc]}||�ddd��c}Scc}w)z3Return a list of all resource names of this widget.rrrNr�)rNr8r�s   r
r�z	Misc.keys�s]���G�G�%�%�	��$�'�'�,�,�t�w�w��<�=�?�=�)*�	�!��Q����#�=�?�	?��?s�Ac��|jS)z+Return the window path name of this widget.r�rMs r
rOzMisc.__str__�s���w�w�rc�~�d|jj�d|jj�d|j�d�S)Nr�rGz object r�)rBrQrRrvrMs r
r�z
Misc.__repr__�s-���N�N�%�%�t�~�~�'B�'B�D�G�G�M�	Mr�_noarg_c���|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)aSet or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given the current setting will be returned.
        �pack�	propagateN�rarr�r<r
rv�rN�flags  r
�pack_propagatezMisc.pack_propagate��Y���4�<�<���#�#�D�G�G�L�L���T�W�W�%.�/�
/�
�G�G�L�L���d�g�g�t�<rc���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)�HReturn a list of all slaves of this widget
        in its packing order.r�slaves�r<r8r
rvr�r>s  r
�pack_slaveszMisc.pack_slaves�s_�����!�!��7�7�<�<���$�'�'�:�<�=�<�+,��"�"�1�%�<�=�	=��=��Ac���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)r$�placer%r&r>s  r
�place_slaveszMisc.place_slaves�sb�����!�!��7�7�<�<���$�'�'�3�4�5�4�+,��"�"�1�%�4�5�	5��5r(c�T�|jjdd|j|�y)z�The anchor value controls how to place the grid within the
        master when no row/column has any weight.

        The default anchor is nw.�grid�anchorNru)rNr.s  r
�grid_anchorzMisc.grid_anchor�s��
	
�����V�X�t�w�w��7rc��dd|jf}|�	|�|||fz}|�	|�|||fz}|j|jj|��xsdS)a�Return a tuple of integer coordinates for the bounding
        box of this widget controlled by the geometry manager grid.

        If COLUMN, ROW is given the bounding box applies from
        the cell with row and column 0 to the specified
        cell. If COL2 and ROW2 are given the bounding box
        starts at that cell.

        The returned integers specify the offset of the upper left
        corner in the master widget and the width and height.
        r-�bboxN)rvrFr<r
)rN�column�row�col2�row2rns      r
�	grid_bboxzMisc.grid_bboxsh�������(����#�/��6�3�-�'�D���� 0��4��,�&�D��}�}�\�T�W�W�\�\�4�0�1�9�T�9rc��t|ttjf�rI	t|�}|syd|vr|jj|�S|jj
|�S|S#ttf$rY|SwxYw)NrG)	rr�_tkinter�Tcl_Objr<rRrQr�r�)rNr�svalues   r
�_gridconvvaluezMisc._gridconvvalues���e�c�8�#3�#3�4�5�	
��U������F�]��7�7�,�,�V�4�4��7�7�>�>�&�1�1������)�
����
�s�
A,�A,�A,�,A?�>A?c	��t|t�r |s|dddk(r|dd}|dddk7rd|z}|f}n|j||�}|sHt|j|jjd||j|�|j��S|jjd||j|f|z�}t|�dk(r|j|�Sy)rr�Nr�rr7r-)r>)	rrr�rBr<r
rvr;r)rNr��indexr/ro�optionsr$s       r
�_grid_configurezMisc._grid_configure's����c�3����2�3�x�3���#�2�h���2�A�w�#�~��#�g���f�G��m�m�C��,�G�����������V�W�d�g�g�u�=��(�(�*�
*��g�g�l�l��7�D�G�G�U�3������w�<�1���&�&�s�+�+�rc�*�|jd|||�S)z�Configure column INDEX of a grid.

        Valid resources are minsize (minimum size of the column),
        weight (how much does additional space propagate to this column)
        and pad (how much space to let additionally).�columnconfigure�r?�rNr=r/ros    r
�grid_columnconfigurezMisc.grid_columnconfigure<s���#�#�$5�u�c�2�F�Frc	�z�|j|jjdd|j||��xsdS)z�Return a tuple of column and row which identify the cell
        at which the pixel at position X and Y inside the master
        widget is located.r-�locationNrE�rNr�r�s   r
�
grid_locationzMisc.grid_locationFs<���}�}��G�G�L�L��
�D�G�G�Q��
3�4�<�7;�	<rc���|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)aSet or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given, the current setting will be returned.
        r-rNrrs  r
�grid_propagatezMisc.grid_propagateNr"rc�*�|jd|||�S)z�Configure row INDEX of a grid.

        Valid resources are minsize (minimum size of the row),
        weight (how much does additional space propagate to this row)
        and pad (how much space to let additionally).�rowconfigurerBrCs    r
�grid_rowconfigurezMisc.grid_rowconfigure[s���#�#�N�E�3��C�Crc�v�|j|jjdd|j��xsdS)z<Return a tuple of the number of column and rows in the grid.r-�sizeNrErMs r
�	grid_sizezMisc.grid_sizees3���}�}��G�G�L�L������1�3�;�6:�	;rc��d}|�|d|fz}|�|d|fz}|jj|jjdd|jf|z��D�cgc]}|j	|���c}Scc}w)r$r!z-rowz-columnr-r%r&)rNr3r2rnr�s     r
�grid_slaveszMisc.grid_slavesls������?��6�3�-�'�D����9�f�-�-�D����!�!�$�'�'�,�,��H�d�g�g�.��5�#7�8�9�8�+,��"�"�1�%�8�9�	9��9s�A6c�J�dd|f|z}|jj|�y)z�Bind a virtual event VIRTUAL (of the form <<Name>>)
        to an event SEQUENCE such that the virtual event is triggered
        whenever SEQUENCE occurs.�eventr*Nrj�rN�virtual�	sequencesrns    r
�	event_addzMisc.event_add{s%�����(�9�4�������T�rc�J�dd|f|z}|jj|�y)z-Unbind a virtual event VIRTUAL from SEQUENCE.rT�deleteNrjrUs    r
�event_deletezMisc.event_delete�s#����7�+�i�7�������T�rc��dd|j|f}|j�D]\}}|d|zt|�fz}�|jj	|�y)z�Generate an event SEQUENCE. Additional
        keyword arguments specify parameter of the event
        (e.g. x, y, rootx, rooty).rT�generate�-%sN)rvr-rr<r
)rNr�rornr2r3s      r
�event_generatezMisc.event_generate�sQ����T�W�W�h�7���H�H�J�D�A�q��5�1�9�c�!�f�-�-�D�������T�rc�n�|jj|jjdd|��S)zuReturn a list of all virtual events or the information
        about the SEQUENCE bound to the virtual event VIRTUAL.rTrr)rNrVs  r
�
event_infozMisc.event_info�s/���w�w� � ��G�G�L�L��&�'�2�4�	4rc�l�|jj|jjdd��S)z*Return a list of all existing image names.�image�namesrrMs r
�image_nameszMisc.image_names��&���w�w� � ������g�w�!?�@�@rc�l�|jj|jjdd��S)z?Return a list of all available image types (e.g. photo bitmap).rc�typesrrMs r
�image_typeszMisc.image_types�rfrr)r)r�1�r�F)rrE)Nr�NNNN�NN)�rPrQrRr��_last_child_idsrr�rrerirlrr�waitvarrxr{r}rrQrRr	r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��liftr�r�r�rr	rrrrrr!r$r'r)r,r/r3r5r8r<r?rBrGrJrMrPrTrWr[r^rarerhrkrnrqrtrwrzr}r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�r�r�r�r�r�r�r�r�r^r�rFr�r�r��propertyr�r�r�r�r'�registerrr�rr�r�rrr
rr�configr�__getitem__rr�rOr�rr!rr'r%r+r/r.r6r1r;r?rDrArHrJrMrLrPrOrRrXr[r_rarerir!rr
rara�s���E�
�O��L�%��/�"�=�1��G�4�8�$�$�'�'�A�'�
�E�1�	(�(�(�-�
(�(�3�8/�,�"=�
F�.A� �(�1�-�8��@�(�G�?�A�
F�$!� 1�
(�:�2�2��D�*�
2�
"�5�
�7�<�
(�G�6�
2�:�6�
<�5�
8�
9�6�8�"�>�
8�
9�
8�
9�
8�
:�
5�5�8�;�;�<�>�=�>�;�8�
+�
8�
8�:�	9�>��;�:�6�6�5�
1�1��,�7�9�$'B�R	:�'�N�8�R�<�
��I�
L�
.�
������4�"!�M��,�H��
C�M�����/��;�z5��#�
D�5��F�8��K�%�?��M�
�k�G�")�=��I�=��F�5�8��F�:�&�D��,�*/1�G�+�O�<�#*�=�,.�D�%�L�;�
�D�
9���
�4�A�Arrac��eZdZdZd�Zd�Zy)rzwInternal class. Stores function to call when some user
    defined Tcl function is called e.g. after an event occurred.c�.�||_||_||_y)z(Store FUNC, SUBST and WIDGET as members.N)r�r�r�)rNr�r�r�s    r
r
zCallWrapper.__init__�s����	���
���rc��	|jr|j|�}|j|�S#t$r�|jj	�YyxYw)z3Apply first function SUBST to arguments, than FUNC.N)r�r�r�r�r�rNrns  r
r zCallWrapper.__call__�sQ��	,��z�z�!�t�z�z�4�(���4�9�9�d�#�#���	��	,��K�K�)�)�+�s	�),�%AN�rPrQrRr�r
r r!rr
rr�s��D��	,rrc�"�eZdZdZd�Zd�Zd�Zy)�XViewzXMix-in class for querying and changing the horizontal position
    of a widget's window.c�z�|jj|jdg|���}|s|j|�Sy)z5Query and change the horizontal position of the view.�xviewN�r<r
rvr��rNrnr$s   r
r~zXView.xview��:���d�g�g�l�l�4�7�7�G�3�d�3����#�#�C�(�(�rc�T�|jj|jdd|�y)zsAdjusts the view in the window so that FRACTION of the
        total width of the canvas is off-screen to the left.r~�movetoNru�rN�fractions  r
�xview_movetozXView.xview_moveto����	
�����T�W�W�g�x��:rc�V�|jj|jdd||�y)z\Shift the x-view according to NUMBER which is measured in "units"
        or "pages" (WHAT).r~�scrollNru�rNr r�s   r
�xview_scrollzXView.xview_scroll�� ��	
�����T�W�W�g�x���>rN)rPrQrRr�r~r�r�r!rr
r|r|�����)�;�
?rr|c�"�eZdZdZd�Zd�Zd�Zy)�YViewzVMix-in class for querying and changing the vertical position
    of a widget's window.c�z�|jj|jdg|���}|s|j|�Sy)z3Query and change the vertical position of the view.�yviewNrr�s   r
r�zYView.yview�r�rc�T�|jj|jdd|�y)zsAdjusts the view in the window so that FRACTION of the
        total height of the canvas is off-screen to the top.r�r�Nrur�s  r
�yview_movetozYView.yview_moveto�r�rc�V�|jj|jdd||�y)z\Shift the y-view according to NUMBER which is measured in
        "units" or "pages" (WHAT).r�r�Nrur�s   r
�yview_scrollzYView.yview_scroll�r�rN)rPrQrRr�r�r�r�r!rr
r�r��r�rr�c�|�eZdZdZ		d"d�ZeZd�ZeZd#d�ZeZ	d�Z
e
Zd#d�ZeZ
d�ZeZd#d	�ZeZd
�ZeZd�ZeZd#d�ZeZ		d"d
�ZeZd#d�ZeZd$d�ZeZd�ZeZd#d�Z e Z!d#d�Z"e"Z#d%d�Z$e$Z%d$d�Z&e&Z'd#d�Z(e(Z)d�Z*e*Z+d$d�Z,e,Z-d$d�Z.e.Z/d#d�Z0e0Z1d#d�Z2e2Z3d$d�Z4e4Z5d$d�Z6e6Z7d#d�Z8e8Z9d#d�Z:e:Z;d#d�Z<e<Z=d#d �Z>e>Z?d!�Z@e@ZAy)&�WmzAProvides functions for the communication with the window manager.Nc�v�|j|jjdd|j||||��S)z�Instruct the window manager to set the aspect ratio (width/height)
        of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
        of the actual values if no argument is given.�wm�aspectrE)rN�minNumer�minDenom�maxNumer�maxDenoms     r
�	wm_aspectzWm.wm_aspect�s9���}�}��G�G�L�L��x�����x��x�
)�*�	*rc�\�dd|jf|z}|jj|�S)a�This subcommand returns or sets platform specific attributes

        The first form returns a list of the platform specific flags and
        their values. The second form returns the value for the specific
        option. The third form sets one or more of the values. The values
        are as follows:

        On Windows, -disabled gets or sets whether the window is in a
        disabled state. -toolwindow gets or sets the style of the window
        to toolwindow (as defined in the MSDN). -topmost gets or sets
        whether this is a topmost window (displays above all other
        windows).

        On Macintosh, XXXXX

        On Unix, there are currently no special attribute values.
        r��
attributes)rvr<r
rys  r
�
wm_attributeszWm.wm_attributes�s,��$�l�D�G�G�,�t�3���w�w�|�|�D�!�!rc�R�|jjdd|j|�S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return
        current value.r��clientrurs  r
�	wm_clientzWm.wm_clients!���w�w�|�|�D�(�D�G�G�T�:�:rc�0�t|�dkDr|f}dd|jf|z}|r|jj|�y|jj	|jj|��D�cgc]}|j|���c}Scc}w)z�Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
        of this widget. This list contains windows whose colormaps differ from their
        parents. Return current list of widgets if WLIST is empty.rr��colormapwindowsN)rrvr<r
r8r�)rN�wlistrnr�s    r
�wm_colormapwindowszWm.wm_colormapwindowss����u�:��>��H�E��'����1�E�9����G�G�L�L���"�W�W�.�.�t�w�w�|�|�D�/A�B�D�B���&�&�q�)�B�D�
D��Ds�8Bc�R�|jjdd|j|�S)z�Store VALUE in WM_COMMAND property. It is the command
        which shall be used to invoke the application. Return current
        command if VALUE is None.r�r�rurs  r
�
wm_commandz
Wm.wm_commands!���w�w�|�|�D�)�T�W�W�e�<�<rc�P�|jjdd|j�S)z�Deiconify this widget. If it was never mapped it will not be mapped.
        On Windows it will raise this widget and give it the focus.r��	deiconifyrurMs r
�wm_deiconifyzWm.wm_deiconify&s���w�w�|�|�D�+�t�w�w�7�7rc�R�|jjdd|j|�S)z�Set focus model to MODEL. "active" means that this widget will claim
        the focus itself, "passive" means that the window manager shall give
        the focus. Return current focus model if MODEL is None.r��
focusmodelru)rN�models  r
�
wm_focusmodelzWm.wm_focusmodel-s!���w�w�|�|�D�,�����?�?rc�>�|jjdd|�y)aAThe window will be unmapped from the screen and will no longer
        be managed by wm. toplevel windows will be treated like frame
        windows once they are no longer managed by wm, however, the menu
        option configuration will be remembered and the menus will return
        once the widget is managed again.r��forgetNrjrws  r
�	wm_forgetzWm.wm_forget5s��	
�����T�8�V�,rc�P�|jjdd|j�S)zAReturn identifier for decorative frame of this widget if present.r��framerurMs r
�wm_framezWm.wm_frame?s���w�w�|�|�D�'�4�7�7�3�3rc�R�|jjdd|j|�S)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
        current value if None is given.r�r#ru)rN�newGeometrys  r
�wm_geometryzWm.wm_geometryEs!���w�w�|�|�D�*�d�g�g�{�C�Crc�v�|j|jjdd|j||||��S)aInstruct the window manager that this widget shall only be
        resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
        height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
        number of grid units requested in Tk_GeometryRequest.r�r-rE)rN�	baseWidth�
baseHeight�widthInc�	heightIncs     r
�wm_gridz
Wm.wm_gridLs8���}�}�T�W�W�\�\��&�$�'�'��z�8�Y�8�9�	9rc�R�|jjdd|j|�S)z~Set the group leader widgets for related widgets to PATHNAME. Return
        the group leader of this widget if None is given.r��groupru�rN�pathNames  r
�wm_groupzWm.wm_groupY�!���w�w�|�|�D�'�4�7�7�H�=�=rc��|�)|jjdd|jd|�S|jjdd|j|�S)a�Set bitmap for the iconified widget to BITMAP. Return
        the bitmap if None is given.

        Under Windows, the DEFAULT parameter can be used to set the icon
        for the widget and any descendants that don't have an icon set
        explicitly.  DEFAULT can be the relative path to a .ico file
        (example: root.iconbitmap(default='myicon.ico') ).  See Tk
        documentation for more information.r��
iconbitmap�-defaultru)rN�bitmap�defaults   r
�
wm_iconbitmapzWm.wm_iconbitmap`sF�����7�7�<�<��l�D�G�G�Z��Q�Q��7�7�<�<��l�D�G�G�V�D�Drc�P�|jjdd|j�S)zDisplay widget as icon.r��iconifyrurMs r
�
wm_iconifyz
Wm.wm_iconifyps���w�w�|�|�D�)�T�W�W�5�5rc�R�|jjdd|j|�S)zVSet mask for the icon bitmap of this widget. Return the
        mask if None is given.r��iconmaskru)rNr�s  r
�wm_iconmaskzWm.wm_iconmaskvs!���w�w�|�|�D�*�d�g�g�v�>�>rc�R�|jjdd|j|�S)zSSet the name of the icon for this widget. Return the name if
        None is given.r��iconnameru)rN�newNames  r
�wm_iconnamezWm.wm_iconname}s!���w�w�|�|�D�*�d�g�g�w�?�?rc��|r+|jjdd|jdg|���y|jjdd|jg|���y)a�Sets the titlebar icon for this window based on the named photo
        images passed through args. If default is True, this is applied to
        all future created toplevels as well.

        The data in the images is taken as a snapshot at the time of
        invocation. If the images are later changed, this is not reflected
        to the titlebar icons. Multiple images are accepted to allow
        different images sizes to be provided. The window manager may scale
        provided icons to an appropriate size.

        On Windows, the images are packed into a Windows icon structure.
        This will override an icon specified to wm_iconbitmap, and vice
        versa.

        On X, the images are arranged into the _NET_WM_ICON X property,
        which most modern window managers support. An icon specified by
        wm_iconbitmap may exist simultaneously.

        On Macintosh, this currently does nothing.r��	iconphotor�Nru)rNr�rns   r
�wm_iconphotozWm.wm_iconphoto�sG��(��D�G�G�L�L��{�D�G�G�Z�G�$�G��D�G�G�L�L��{�D�G�G�;�d�;rc	�r�|j|jjdd|j||��S)z�Set the position of the icon of this widget to X and Y. Return
        a tuple of the current values of X and X if None is given.r��iconpositionrErGs   r
�wm_iconpositionzWm.wm_iconposition�s3���}�}�T�W�W�\�\��.�$�'�'�1�a�1�2�	2rc�R�|jjdd|j|�S)zgSet widget PATHNAME to be displayed instead of icon. Return the current
        value if None is given.r��
iconwindowrur�s  r
�
wm_iconwindowzWm.wm_iconwindow�s!���w�w�|�|�D�,�����B�Brc�>�|jjdd|�y)z�The widget specified will become a stand alone top-level window.
        The window will be decorated with the window managers title bar,
        etc.r��manageNrj)rNr�s  r
�	wm_managezWm.wm_manage�s��	
�����T�8�V�,rc	�r�|j|jjdd|j||��S)z�Set max WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given.r��maxsizerE�rNr�r�s   r
�
wm_maxsizez
Wm.wm_maxsize��3���}�}�T�W�W�\�\��)�T�W�W�e�V�5�6�	6rc	�r�|j|jjdd|j||��S)z�Set min WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given.r��minsizerEr�s   r
�
wm_minsizez
Wm.wm_minsize�r�rc�p�|j|jjdd|j|��S)z�Instruct the window manager to ignore this widget
        if BOOLEAN is given with 1. Return the current value if None
        is given.r��overrideredirect)r�r<r
rvrfs  r
�wm_overrideredirectzWm.wm_overrideredirect�s4�����������$�d�g�g�w�!8�9�	9rc�R�|jjdd|j|�S)z�Instruct the window manager that the position of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program".r��positionfromru�rN�whos  r
�wm_positionfromzWm.wm_positionfrom�s!���w�w�|�|�D�.�$�'�'�3�?�?rc��t|�r|j|�}n|}|jjdd|j||�S)z�Bind function FUNC to command NAME for this widget.
        Return the function bound to NAME if None is given. NAME could be
        e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".r��protocol)r�r'r<r
rv)rNr�r�r�s    r
�wm_protocolzWm.wm_protocol�sB���D�>��n�n�T�*�G��G��w�w�|�|��*�d�g�g�t�W�6�	6rc�T�|jjdd|j||�S)zyInstruct the window manager whether this width can be resized
        in WIDTH or HEIGHT. Both values are boolean values.r��	resizablerur�s   r
�wm_resizablezWm.wm_resizable�s#���w�w�|�|�D�+�t�w�w��v�F�Frc�R�|jjdd|j|�S)z�Instruct the window manager that the size of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program".r��sizefromrur�s  r
�wm_sizefromzWm.wm_sizefrom�s!���w�w�|�|�D�*�d�g�g�s�;�;rc�R�|jjdd|j|�S)z�Query or set the state of this widget as one of normal, icon,
        iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).r�r�ru)rN�newstates  r
�wm_statezWm.wm_state�r�rc�R�|jjdd|j|�S)zSet the title of this widget.r��titlerur�s  r
�wm_titlezWm.wm_title�s���w�w�|�|�D�'�4�7�7�F�;�;rc�R�|jjdd|j|�S)z_Instruct the window manager that this widget is transient
        with regard to widget MASTER.r��	transientru)rNr�s  r
�wm_transientzWm.wm_transient	s!���w�w�|�|�D�+�t�w�w��?�?rc�P�|jjdd|j�S)z�Withdraw this widget from the screen such that it is unmapped
        and forgotten by the window manager. Re-draw it with wm_deiconify.r�r�rurMs r
�wm_withdrawzWm.wm_withdraw		s���w�w�|�|�D�*�d�g�g�6�6rrmrrnrl)BrPrQrRr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#r�r-r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr�r!rr
r�r��s���K�'+�&*�	*��F�"�*�J�;�
�F�D�)�O�=��G�8�
�I�@��J�-��F�4�
�E�D�
�H�%)�"&�	9��D�>�

�E�E��J�6��G�?�
�H�@�
�H�<�2�I�2�#�L�C�
�J�-��F�6��G�6��G�9�+��@�#�L�	6��H�G�
�I�<��H�>�

�E�<�
�E�@�
�I�7�
�Hrr�c�D�eZdZdZdZ		dd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)r�zzToplevel widget of Tk which represents mostly the main window
    of an application. It has an associated Tcl interpreter.rGNc
��d|_i|_d|_d|_|�Wddl}|j
j
tjd�}|j
j|�\}}|dvr||z}d}	tj||||	t|||�|_tr|jjt�|r|j!�tj"j$s|j'||�yy)aAReturn a new top level widget on screen SCREENNAME. A new Tcl interpreter will
        be created. BASENAME will be used for the identification of the profile file (see
        readprofile).
        It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
        is the name of the widget class.NFr)z.pyz.pyc)r�r�	_tkloadedr<�os�path�basenamer��argv�splitextr8�create�wantobjects�_debug�settrace�_print_command�_loadtk�flags�ignore_environment�readprofile)
rN�
screenName�baseNamer��useTk�sync�user�ext�interactives
          r
r
zTk.__init__	s��������
�����������w�w�'�'������4�H��G�G�,�,�X�6�M�H�c��/�)�#�c�>�����/�/�*�h�	�;�P[�]b�dh�jm�n�����G�G���^�,���L�L�N��y�y�+�+����X�y�1�,rc�r�|js+|jj�|j�yyr)r
r<�loadtkrrMs r
r!z	Tk.loadtk3	s%���~�~��G�G�N�N���L�L�N�rc���d|_|jjd�}|tjk7r tdtj�d|�d���t
|jjd��}|tjk7r tdtj�d|�d���|j�g|_|jjd	t�|jjd
t�|jjd	�|jjd
�trt�|a|jd|j �y)NT�
tk_versionztk.h version (z!) doesn't match libtk.a version (�)�tcl_versionztcl.h version (z") doesn't match libtcl.a version (�tkerror�exit�WM_DELETE_WINDOW)r
r<rr8�
TK_VERSIONr9r�TCL_VERSIONrr#r�r�r�r�r�r�r�)rNr#r%s   r
rz
Tk._loadtk8	s������W�W�^�^�L�1�
���,�,�,��"*�"5�"5�z� C�D�
D��$�'�'�.�.��7�8���(�.�.�.��"*�"6�"6�� E�F�
F�
���$� "�D�������i��2������f�e�,���� � ��+���� � ��(� �]�%:� �M��
�
�(�$�,�,�7rc��t|jj��D]}|j��|jjd|j�tj|�trt|urda	yyy)zhDestroy this and all descendants widgets. This will
        end the application of this Tcl interpreter.r�N)
rr�valuesr�r<r
rvrar�r��rNr0s  r
r�z
Tk.destroyR	s_���d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(����T�� �]�d�%:� �M�&;� rc�N�ddl}d|jvr|jd}n|j}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}d|i}	td|	�|jj
|�r|jjd|�|jj
|�r#tt|�j�|	�|jj
|�r|jjd|�|jj
|�r$tt|�j�|	�yy)	z�Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into
        the Tcl Interpreter and calls exec on the contents of .BASENAME.py and
        .CLASSNAME.py if such a file exists in the home directory.rN�HOMEz.%s.tclz.%s.pyrNzfrom tkinter import *�source)r�environ�curdirrr�exec�isfiler<r
�open�read)
rNrr�r�home�	class_tcl�class_py�base_tcl�base_py�dirs
          r
rzTk.readprofile\	s8��	��R�Z�Z���
�
�6�(:���Y�Y�d��G�G�L�L��y�9�'<�=�	��7�7�<�<��h��&:�;���7�7�<�<��i�(�&:�;���'�'�,�,�t�X��%8�9���t�n���
$�c�*�
�7�7�>�>�)�$��G�G�L�L��9�-�
�7�7�>�>�(�#���h��$�$�&��,�
�7�7�>�>�(�#��G�G�L�L��8�,�
�7�7�>�>�'�"���g��#�#�%�s�+�#rc��ddl}tdtj��|t_|t_|t_|t_|j|||�y)z�Report callback exception on sys.stderr.

        Applications may want to override this internal function, and
        should when sys.stderr is None.rNzException in Tkinter callback��file)	�	tracebackr,r��stderr�last_exc�	last_type�
last_value�last_traceback�print_exception)rNr�rrr@s     r
rzTk.report_callback_exceptionr	sE��
	�
�-�C�J�J�?������
��������!�!�#�s�B�/rc�.�t|j|�S)z3Delegate attribute access to the interpreter object)r�r<)rN�attrs  r
�__getattr__zTk.__getattr__	s���t�w�w��%�%r)NNr�TFN)rPrQrRr�rvr
r!rr�rrrIr!rr
r�r�	s6��@�	�B�AE�-1�2�:�
8�4!�,�,0�&rr�r>c�4�t|�}t||��y)Nr>)rr,)r�r?s  r
rr�	s����*�C�	�#�D�rc��t||||�Sr)r�)rrr�rs    r
�TclrL�	s��
�j�(�I�u�5�5rc�r�eZdZdZifd�ZexZxZZd�ZeZ	d�Z
e
ZejxZZ
ejxZZy)�PackzQGeometry manager Pack.

    Base class to use the methods pack_* in every widget.c�z�|jjdd|jf|j||�z�y)a(Pack a widget in the parent widget. Use as options:
        after=widget - pack it after you have packed widget
        anchor=NSEW (or subset) - position widget according to
                                  given direction
        before=widget - pack it before you will pack widget
        expand=bool - expand widget if parent size grows
        fill=NONE or X or Y or BOTH - fill widget if widget grows
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.
        rrN�r<r
rvr�rs   r
�pack_configurezPack.pack_configure�	s5�� 	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)z:Unmap this widget and do not use it for the packing order.rr�NrurMs r
�pack_forgetzPack.pack_forget�	��������V�X�t�w�w�/rc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zEReturn information about the packing options
        for this widget.rr�in�rBr<r
rvr��rN�ds  r
�	pack_infozPack.pack_info�	�M��
�t�w�w������V�V�T�W�W� E�F���1�9��'�'��$��0�A�d�G��rN)rPrQrRr�rQrrrtrSr�rZrrar!rr'r%r!rr
rNrN�	sZ��=�"$�(�(!/�.�D�.�9�v�0��F���D�!%�!4�!4�4�I���+�+�+�F�[rrNc�V�eZdZdZifd�ZexZxZZd�ZeZ	d�Z
e
ZejxZZ
y)�PlacezSGeometry manager Place.

    Base class to use the methods place_* in every widget.c�z�|jjdd|jf|j||�z�y)a Place a widget in the parent widget. Use as options:
        in=master - master relative to which the widget is placed
        in_=master - see 'in' option description
        x=amount - locate anchor of this widget at position x of master
        y=amount - locate anchor of this widget at position y of master
        relx=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to width of master (1.0 is right edge)
        rely=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to height of master (1.0 is bottom edge)
        anchor=NSEW (or subset) - position anchor according to given direction
        width=amount - width of this widget in pixel
        height=amount - height of this widget in pixel
        relwidth=amount - width of this widget between 0.0 and 1.0
                          relative to width of master (1.0 is the same width
                          as the master)
        relheight=amount - height of this widget between 0.0 and 1.0
                           relative to height of master (1.0 is the same
                           height as the master)
        bordermode="inside" or "outside" - whether to take border width of
                                           master widget into account
        r*rNrPrs   r
�place_configurezPlace.place_configure�	s5��,	
�������T�W�W�-��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)�Unmap this widget.r*r�NrurMs r
�place_forgetzPlace.place_forget�	s�������W�h����0rc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zEReturn information about the placing options
        for this widget.r*rrVrWrXs  r
�
place_infozPlace.place_info�	sM��
�t�w�w������W�f�d�g�g� F�G���1�9��'�'��$��0�A�d�G��rN)rPrQrRr�r_r*rrtrbr�rdrrar+r%r!rr
r]r]�	sJ��>�#%�(�4"1�0�E�0�I��1��F���D� �-�-�-�F�\rr]c��eZdZdZifd�ZexZxZZejxZ
Z	ejxZZd�Z
e
Zd�Zd�ZeZej$xZZej(xZZej,xZZej0xZZej4xZZy)�GridzQGeometry manager Grid.

    Base class to use the methods grid_* in every widget.c�z�|jjdd|jf|j||�z�y)aPosition a widget in the parent widget in a grid. Use as options:
        column=number - use cell identified with given column (starting with 0)
        columnspan=number - this widget will span several columns
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        row=number - use cell identified with given row (starting with 0)
        rowspan=number - this widget will span several rows
        sticky=NSEW - if cell is larger on which sides will this
                      widget stick to the cell boundary
        r-rNrPrs   r
�grid_configurezGrid.grid_configure
s5��	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)rar-r�NrurMs r
�grid_forgetzGrid.grid_forget
rTrc�R�|jjdd|j�y)z0Unmap this widget but remember the grid options.r-r1NrurMs r
�grid_removezGrid.grid_remove"
rTrc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zSReturn information about the options
        for positioning this widget in a grid.r-rrVrWrXs  r
�	grid_infozGrid.grid_info&
r[rN)rPrQrRr�rhr-rrtrar6r1rDrArjr�rlrnrrHrFrJrrMrLrPrOrRr%r!rr
rfrf�	s���=�
"$�(�&!/�.�D�.�9�v��~�~�%�D�9�-1�-F�-F�F�O�*�0��F�0���D�#�1�1�1�H�}�!%�!4�!4�4�I��'+�'=�'=�=�L�$��~�~�%�D�9��+�+�+�F�[rrfc�2�eZdZdZd�Ziidfd�Zd�Zdd�Zy)	�
BaseWidgetzInternal class.c���|�
t�}||_|j|_d}d|vr|d}|d=|s�|jjj�}|dj
�r|dz
}|j�i|_|jj|d�dz}||j|<|dk(rd|��}nd||fz}||_	|jdk(rd|z|_
n|jdz|z|_
i|_|j|jjvr1|jj|jj�||jj|j<y)	z6Internal function. Sets up information about children.Nr�r��!rrz!%s%drG)
r�r�r<rBrPr��isdigitrorrrvrr�)rNr�r/r��counts     r
�_setupzBaseWidget._setup9
sS���>�&�(�F�����)�)������S�=��v�;�D��F����>�>�*�*�0�0�2�D��B�x���!������%�%�-�)+��&��*�*�.�.�t�Q�7�!�;�E�+0�F�"�"�4�(���z� $����$���.����
��9�9�c�>��D�j�D�G��i�i�#�o��,�D�G���
��:�:����-�-�-��K�K� � ����,�4�4�6�+/������T�Z�Z�(rr!c��|r
t||f�}||_|j||�|j�g|_|j	�D��cgc]\}}t|t�s�||f��}}}|D]\}}||=�
|jj||jf|z|j|�z�|D]\}}|j||��ycc}}w)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME
        and appropriate options.N)r4�
widgetNamerurr-rr(r<r
rvr�r)	rNr�rwr/ro�extrar2r3�classess	         r
r
zBaseWidget.__init__Y
s�����S�"�I�&�C�$������F�C� ����$� "�D��&)�i�i�k�I�k�d�a��Z��4�5H�A�q�6�k��I��D�A�q��A��������
����!�E�)�D�M�M�#�,>�>�	@��D�A�q�
�K�K��a� ���Js�C�(Cc�p�t|jj��D]}|j��|jjd|j�|j|jjvr!|jj|j=tj|�y)z)Destroy this and all descendants widgets.r�N)
rrr,r�r<r
rvrr�rar-s  r
r�zBaseWidget.destroyj
sr���d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(��:�:����-�-�-����$�$�T�Z�Z�0����T�rc�V�|jj|j|f|z�Srru)rNr�rns   r
�_dozBaseWidget._dor
s"���w�w�|�|�T�W�W�d�O�d�2�3�3rN)r!)rPrQrRr�rur
r�r|r!rr
rprp6
s#���0�@02�b��!�"�4rrpc��eZdZdZy)�WidgetzxInternal class.

    Base class for a widget which can be positioned with the geometry managers
    Pack, Place or Grid.N)rPrQrRr�r!rr
r~r~w
s���	rr~c��eZdZdZdifd�Zy)�Toplevelz"Toplevel widget, e.g. for dialogs.Nc��|r
t||f�}d}dD],}||vs�||}|ddk(r	d|ddz}nd|z}|||fz}||=�.tj||d|i|�|j�}|j	|j	��|j|j��|j
d|j�y)	a%Construct a toplevel widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, menu, relief, screen, takefocus,
        use, visual, width.r!)r]�class_rr�colormapr�r�r7Nryr()r4rpr
rr�rr�r�)	rNr�r/rorx�wmkeyr�optr�s	         r
r
zToplevel.__init__�
s�����S�"�I�&�C����E���|��%�j����9��#�3�u�S�b�z�>�S���I�c���c�
�*����J��	���D�&�*�c�2�u�E��z�z�|���
�
�d�m�m�o�&��
�
�4�:�:�<� ��
�
�(�$�,�,�7r�rPrQrRr�r
r!rr
r�r�
s��,�"��8rr�c�(�eZdZdZdifd�Zd�Zd�Zy)r�zButton widget.Nc�6�tj||d||�y)aUConstruct a button widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, repeatdelay,
            repeatinterval, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            command, compound, default, height,
            overrelief, state, width
        �buttonN�r~r
�rNr�r/ros    r
r
zButton.__init__�
s��&	����f�h��R�8rc�P�|jj|jd�y)a_Flash the button.

        This is accomplished by redisplaying
        the button several times, alternating between active and
        normal colors. At the end of the flash the button is left
        in the same normal/active state as when the command was
        invoked. This command is ignored if the button's state is
        disabled.
        �flashNrurMs r
r�zButton.flash�
s��	
�����T�W�W�g�&rc�N�|jj|jd�S)aInvoke the command associated with the button.

        The return value is the return value from the command,
        or an empty string if there is no command associated with
        the button. This command is ignored if the button's state
        is disabled.
        �invokerurMs r
r�z
Button.invoke�
s���w�w�|�|�D�G�G�X�.�.r)rPrQrRr�r
r�r�r!rr
r�r��
s���"��9�*
'�/rr�c��eZdZdZdifd�Zd�Zd�Zd�Zd�Zd<d�Z	d	�Z
d
�Zd�Zd�Z
d=d
�Zd>d�Zd=d�Zd=d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d<d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d=d-�Z.e.Z/d.�Z0e0Z1d/�Z2d?d0�Z3ifd1�Z4d2�Z5e5xZ6Z7d3�Z8d4�Z9d@d5�Z:d6�Z;d7�Z<d8�Z=d9�Z>d:�Z?d;�Z@y)A�Canvasz?Canvas widget to display graphical elements like lines or text.Nc�6�tj||d||�y)aConstruct a canvas widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, closeenough,
        confine, cursor, height, highlightbackground, highlightcolor,
        highlightthickness, insertbackground, insertborderwidth,
        insertofftime, insertontime, insertwidth, offset, relief,
        scrollregion, selectbackground, selectborderwidth, selectforeground,
        state, takefocus, width, xscrollcommand, xscrollincrement,
        yscrollcommand, yscrollincrement.�canvasNr�r�s    r
r
zCanvas.__init__�
s��	����f�h��R�8rc�X�|jj|jdf|z�y)r�addtagNrurys  r
r�z
Canvas.addtag�
� �������d�g�g�x�(�4�/�0rc�*�|j|d|�y)z*Add tag NEWTAG to all items above TAGORID.�aboveN�r��rN�newtag�tagOrIds   r
�addtag_abovezCanvas.addtag_above�
������F�G�W�-rc�(�|j|d�y)zAdd tag NEWTAG to all items.r�Nr�)rNr�s  r
�
addtag_allzCanvas.addtag_all�
s�����F�E�"rc�*�|j|d|�y)z*Add tag NEWTAG to all items below TAGORID.�belowNr�r�s   r
�addtag_belowzCanvas.addtag_below�
r�rc�0�|j|d||||�y)z�Add tag NEWTAG to item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken.�closestNr�)rNr�r�r��halo�starts      r
�addtag_closestzCanvas.addtag_closest�
s��
	
���F�I�q�!�T�5�9rc�0�|j|d||||�y)zLAdd tag NEWTAG to all items in the rectangle defined
        by X1,Y1,X2,Y2.�enclosedNr��rNr��x1�y1�x2�y2s      r
�addtag_enclosedzCanvas.addtag_enclosed�
s��	
���F�J��B��B�7rc�0�|j|d||||�y)zWAdd tag NEWTAG to all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.�overlappingNr�r�s      r
�addtag_overlappingzCanvas.addtag_overlapping�
s��	
���F�M�2�r�2�r�:rc�*�|j|d|�y)z)Add tag NEWTAG to all items with TAGORID.�withtagNr�r�s   r
�addtag_withtagzCanvas.addtag_withtag�
s�����F�I�w�/rc�|�|j|jj|jdf|z��xsdS)z|Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses all items with tags specified as arguments.r1NrErys  r
r1zCanvas.bboxs;���}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�<�7;�	<rc�D�|j|jd||f|�y)zbUnbind for all items with TAGORID for event SEQUENCE  the
        function identified with FUNCID.r�Nr�)rNr�r�r�s    r
�
tag_unbindzCanvas.tag_unbinds��	
���d�g�g�v�w��9�6�Brc�D�|j|jd|f|||�S)a&Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value.r�r�)rNr�r�r�r*s     r
�tag_bindzCanvas.tag_binds)���z�z�4�7�7�F�G�4��D�#�'�	'rc��|jj|jj|jd||��S)zrReturn the canvas x coordinate of pixel position SCREENX rounded
        to nearest multiple of GRIDSPACING units.�canvasxr)rN�screenx�gridspacings   r
r�zCanvas.canvasx�7���w�w� � �������G�G�Y���"6�7�	7rc��|jj|jj|jd||��S)zrReturn the canvas y coordinate of pixel position SCREENY rounded
        to nearest multiple of GRIDSPACING units.�canvasyr)rN�screenyr�s   r
r�zCanvas.canvasyr�rc��t|�}|jj|jj|jdf|z��D�cgc]}|jj|���c}Scc}w)z8Return a list of coordinates for the item given in ARGS.�coords)r"r<r8r
rvrRr	s   r
r�z
Canvas.coords sp����~���7�7�,�,��7�7�<�<����(� 3�d� :�;�=�>�=�*+����!�!�!�$�=�>�	>��>s�"A6c
��t|�}|d}t|ttf�r|dd}ni}|jj|jj|jd|g||j||�z����S)rr�Nr)	r"rr'rr<rQr
rvr�)rN�itemTypernror/s     r
�_createzCanvas._create's{����~���2�h���c�D�%�=�)����9�D��C��w�w�~�~�l�d�g�g�l�l��G�G�X�x�.��T�]�]�3��+�+�.�/�	/rc�(�|jd||�S)z6Create arc shaped region with coordinates x1,y1,x2,y2.�arc�r�rms   r
�
create_arczCanvas.create_arc3s���|�|�E�4��,�,rc�(�|jd||�S)z%Create bitmap with coordinates x1,y1.r�r�rms   r
�
create_bitmapzCanvas.create_bitmap7����|�|�H�d�B�/�/rc�(�|jd||�S)z)Create image item with coordinates x1,y1.rcr�rms   r
�create_imagezCanvas.create_image;s���|�|�G�T�2�.�.rc�(�|jd||�S)z-Create line with coordinates x1,y1,...,xn,yn.r�r�rms   r
�create_linezCanvas.create_line?����|�|�F�D�"�-�-rc�(�|jd||�S)z)Create oval with coordinates x1,y1,x2,y2.�ovalr�rms   r
�create_ovalzCanvas.create_ovalCr�rc�(�|jd||�S)z0Create polygon with coordinates x1,y1,...,xn,yn.�polygonr�rms   r
�create_polygonzCanvas.create_polygonGs���|�|�I�t�R�0�0rc�(�|jd||�S)z.Create rectangle with coordinates x1,y1,x2,y2.�	rectangler�rms   r
�create_rectanglezCanvas.create_rectangleKs���|�|�K��r�2�2rc�(�|jd||�S)z#Create text with coordinates x1,y1.�textr�rms   r
�create_textzCanvas.create_textOr�rc�(�|jd||�S)z+Create window with coordinates x1,y1,x2,y2.rtr�rms   r
�
create_windowzCanvas.create_windowSr�rc�X�|jj|jdf|z�y)z�Delete characters of text items identified by tag or id in ARGS (possibly
        several times) from FIRST to LAST character (including).�dcharsNrurys  r
r�z
Canvas.dcharsW�"��	
�����d�g�g�x�(�4�/�0rc�X�|jj|jdf|z�y)z<Delete items identified by all tag or ids contained in ARGS.rZNrurys  r
rZz
Canvas.delete\r�rc�X�|jj|jdf|z�y)ziDelete tag or id given as last arguments in ARGS from items
        identified by first argument in ARGS.�dtagNrurys  r
r�zCanvas.dtag`s"��	
�����d�g�g�v�&��-�.rc�|�|j|jj|jdf|z��xsdS)r�findr!rErys  r
r�zCanvas.finde�9���}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�:�79�	:rc�&�|jd|�S)zReturn items above TAGORID.r��r��rNr�s  r
�
find_abovezCanvas.find_abovej����y�y��'�*�*rc�$�|jd�S)zReturn all items.r�r�rMs r
�find_allzCanvas.find_allns���y�y���rc�&�|jd|�S)zReturn all items below TAGORID.r�r�r�s  r
�
find_belowzCanvas.find_belowrr�rc�,�|jd||||�S)z�Return item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken.r�r�)rNr�r�r�r�s     r
�find_closestzCanvas.find_closestvs��
�y�y��A�q�$��6�6rc�,�|jd||||�S)z=Return all items in rectangle defined
        by X1,Y1,X2,Y2.r�r��rNr�r�r�r�s     r
�
find_enclosedzCanvas.find_enclosed}s���y�y��R��R��4�4rc�,�|jd||||�S)zLReturn all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.r�r�r�s     r
�find_overlappingzCanvas.find_overlapping�s���y�y���B��B�7�7rc�&�|jd|�S)zReturn all items with TAGORID.r�r�r�s  r
�find_withtagzCanvas.find_withtag�s���y�y��G�,�,rc�V�|jj|jdf|z�S)z.Set focus to the first item specified in ARGS.r�rurys  r
r�zCanvas.focus�s#���w�w�|�|�T�W�W�g�.��5�6�6rc��|jj|jj|jdf|z��S)z=Return tags associated with the first item specified in ARGS.�gettagsr�rys  r
rzCanvas.gettags�s7���w�w� � ��G�G�L�L�$�'�'�9�-��4�5�7�	7rc�X�|jj|jdf|z�y)zdSet cursor at position POS in the item identified by TAGORID.
        In ARGS TAGORID must be first.�icursorNrurys  r
rzCanvas.icursor�s"��	
�����d�g�g�y�)�D�0�1rc��|jj|jj|jdf|z��S)z?Return position of cursor as integer in item specified in ARGS.r=rrys  r
r=zCanvas.index�s0���w�w�~�~�d�g�g�l�l�D�G�G�W�+=��+D�E�F�Frc�X�|jj|jdf|z�y)zSInsert TEXT in item TAGORID at position POS. ARGS must
        be TAGORID POS TEXT.�insertNrurys  r
rz
Canvas.insert�r�rc�`�|jj|jdf|d|zfz�S)z9Return the resource value for an OPTION for item TAGORID.�itemcgetr7ru)rNr�r�s   r
rzCanvas.itemcget�s1���w�w�|�|�
�W�W�j�!�W�c�&�j�$9�9�;�	;rc�,�|jd|f||�S)z�Configure resources of an item TAGORID.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method without arguments.
        �
itemconfigurer�rNr�r/ros    r
r	zCanvas.itemconfigure�s�������9�3��C�Crc�X�|jj|jdf|z�y)zJLower an item TAGORID given in ARGS
        (optional below another item).r�Nrurys  r
�	tag_lowerzCanvas.tag_lower��"��	
�����d�g�g�w�'�$�.�/rc�X�|jj|jdf|z�y)z#Move an item TAGORID given in ARGS.�moveNrurys  r
rzCanvas.move�s �������d�g�g�v�&��-�.rc�V�|jj|jd|||�y)a}Move the items given by TAGORID in the canvas coordinate
        space so that the first coordinate pair of the bottommost
        item with tag TAGORID is located at position (X,Y).
        X and Y may be the empty string, in which case the
        corresponding coordinate will be unchanged. All items matching
        TAGORID remain in the same positions relative to each other.r�Nru)rNr�r�r�s    r
r�z
Canvas.moveto�s ��	
�����T�W�W�h���A�6rc�v�|jj|jdf|j||�z�S)z�Print the contents of the canvas to a postscript
        file. Valid options: colormap, colormode, file, fontmap,
        height, pageanchor, pageheight, pagewidth, pagex, pagey,
        rotate, width, x, y.�
postscriptrPrs   r
rzCanvas.postscript�s7��
�w�w�|�|�T�W�W�l�3��M�M�#�r�*�+�,�	,rc�X�|jj|jdf|z�y)zJRaise an item TAGORID given in ARGS
        (optional above another item).r�Nrurys  r
�	tag_raisezCanvas.tag_raise�r
rc�X�|jj|jdf|z�y)z9Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.�scaleNrurys  r
rzCanvas.scale�s �������d�g�g�w�'�$�.�/rc�V�|jj|jdd||�y�z&Remember the current X, Y coordinates.�scan�markNrurGs   r
�	scan_markzCanvas.scan_mark���������T�W�W�f�f�a��3rc�X�|jj|jdd|||�y)z�Adjust the view of the canvas to GAIN times the
        difference between X and Y and the coordinates given in
        scan_mark.r�dragtoNru)rNr�r��gains    r
�scan_dragtozCanvas.scan_dragto�s"��	
�����T�W�W�f�h��1�d�;rc�V�|jj|jdd||�y)zLAdjust the end of the selection near the cursor of an item TAGORID to index.�select�adjustNru�rNr�r=s   r
�
select_adjustzCanvas.select_adjust�s�������T�W�W�h��'�5�Arc�R�|jj|jdd�y)�,Clear the selection if it is in this widget.r"r�NrurMs r
�select_clearzCanvas.select_clear�s�������T�W�W�h��0rc�V�|jj|jdd||�y)z:Set the fixed end of a selection in item TAGORID to INDEX.r"�fromNrur$s   r
�select_fromzCanvas.select_from�s�������T�W�W�h����?rc�X�|jj|jdd�xsdS)z(Return the item which has the selection.r"r%NrurMs r
�select_itemzCanvas.select_item�s"���w�w�|�|�D�G�G�X�v�6�>�$�>rc�V�|jj|jdd||�y)z=Set the variable end of a selection in item TAGORID to INDEX.r"�toNrur$s   r
�	select_tozCanvas.select_to�s�������T�W�W�h��g�u�=rc�X�|jj|jd|�xsdS)z$Return the type of the item TAGORID.r(Nrur�s  r
r(zCanvas.type�s"���w�w�|�|�D�G�G�V�W�5�=��=rrnrrE)r�r�)�
)ArPrQrRr�r
r�r�r�r�r�r�r�r�r1r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rZr�r�r�r�r�r�r�r�r�r�rrr=rrr	�
itemconfigrr�rr�rrrqr�rrr r%r(r+r-r0r(r!rr
r�r��
sK��I�"��
9�1�.�#�.�:�8�
;�
0�<�C�
'�7�7�>�
/�-�0�/�.�.�1�3�.�0�1�
1�/�
:�
+� �+�7�5�
8�
-�7�7�
2�
G�1�
;�
D��J�0�

�E�/�7� �,�0�
��D�7�0�4�<�B�1�@�?�>�>rr�c�L��eZdZdZdifd�Z�fd�Zd�Zd�Zd�Zd�Z	d	�Z
�xZS)
�Checkbuttonz7Checkbutton widget which is either in on- or off-state.Nc�6�tj||d||�y)aConstruct a checkbutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, offvalue, onvalue, padx, pady, relief,
        selectcolor, selectimage, state, takefocus, text, textvariable,
        underline, variable, width, wraplength.�checkbuttonNr�r�s    r
r
zCheckbutton.__init__���	����f�m�S�"�=rc���|jd�s<|jjj�}tdz
ad|�dt��|d<t
�|�||�y)Nr�rrrr7)rrBrPr��_checkbutton_count�superru)rNr�r/r�rBs    �r
ruzCheckbutton._setups[����w�w�v���>�>�*�*�0�0�2�D��!�#���d�V�1�%7�$8�9�C��K�
���v�s�#rc�P�|jj|jd�y�zPut the button in off-state.�deselectNrurMs r
r>zCheckbutton.deselects�������T�W�W�j�)rc�P�|jj|jd�y�zFlash the button.r�NrurMs r
r�zCheckbutton.flash"��������T�W�W�g�&rc�N�|jj|jd�S�z<Toggle the button and invoke a command if given as resource.r�rurMs r
r�zCheckbutton.invoke&����w�w�|�|�D�G�G�X�.�.rc�P�|jj|jd�y�zPut the button in on-state.r"NrurMs r
r"zCheckbutton.select*��������T�W�W�h�'rc�P�|jj|jd�y)zToggle the button.�toggleNrurMs r
rIzCheckbutton.toggle.rGr)rPrQrRr�r
rur>r�r�r"rI�
__classcell__)rBs@r
r5r5s.���A�"��
>�$�*�'�/�(�(rr5c��eZdZdZdifd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�ZeZ
d�ZeZd
�ZeZd�ZeZd�ZeZd�ZeZy)�Entryz1Entry widget which allows displaying simple text.Nc�6�tj||d||�y)aConstruct an entry widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, highlightbackground,
        highlightcolor, highlightthickness, insertbackground,
        insertborderwidth, insertofftime, insertontime, insertwidth,
        invalidcommand, invcmd, justify, relief, selectbackground,
        selectborderwidth, selectforeground, show, state, takefocus,
        textvariable, validate, validatecommand, vcmd, width,
        xscrollcommand.�entryNr�r�s    r
r
zEntry.__init__6s��	����f�g�s�B�7rc�T�|jj|jd||�y)z.Delete text from FIRST to LAST (not included).rZNru�rN�first�lasts   r
rZzEntry.deleteC��������T�W�W�h��t�4rc�N�|jj|jd�S)zReturn the text.rrurMs r
rz	Entry.getG����w�w�|�|�D�G�G�U�+�+rc�R�|jj|jd|�y)zInsert cursor at INDEX.rNru�rNr=s  r
rz
Entry.icursorKs�������T�W�W�i��/rc��|jj|jj|jd|��S)zReturn position of cursor.r=rrWs  r
r=zEntry.indexOs1���w�w�~�~�d�g�g�l�l��G�G�W�e�%�&�	&rc�T�|jj|jd||�y)zInsert STRING at INDEX.rNru)rNr=r�s   r
rzEntry.insertTs�������T�W�W�h��v�6rc�T�|jj|jdd|�yrrur>s  r
rzEntry.scan_markXs�������T�W�W�f�f�a�0rc�T�|jj|jdd|�y)z�Adjust the view of the canvas to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrur>s  r
r zEntry.scan_dragto\s��	
�����T�W�W�f�h��2rc�T�|jj|jdd|�y)z9Adjust the end of the selection near the cursor to INDEX.r�r#NrurWs  r
�selection_adjustzEntry.selection_adjustb��������T�W�W�k�8�U�;rc�R�|jj|jdd�y)r'r�r�NrurMs r
r�zEntry.selection_clearhs�������T�W�W�k�7�3rc�T�|jj|jdd|�y)�*Set the fixed end of a selection to INDEX.r�r*NrurWs  r
�selection_fromzEntry.selection_fromns�������T�W�W�k�6�5�9rc��|jj|jj|jdd��S)zSReturn True if there are characters selected in the entry, False
        otherwise.r��presentrrMs r
�selection_presentzEntry.selection_presentt�3���w�w�!�!��G�G�L�L����+�y�9�;�	;rc�V�|jj|jdd||�y)�3Set the selection from START to END (not included).r��rangeNru�rNr��ends   r
�selection_rangezEntry.selection_range|s�������T�W�W�k�7�E�3�?rc�T�|jj|jdd|�y)�-Set the variable end of a selection to INDEX.r�r/NrurWs  r
�selection_tozEntry.selection_to�s�������T�W�W�k�4��7rr)rPrQrRr�r
rZrrr=rrr r]r%r�r(rbr+re�select_presentrl�select_rangeror0r!rr
rLrL3s{��;�"��8�5�,�0�&�
7�1�3�<�%�M�4�#�L�:�!�K�;�'�N�@�#�L�8��IrrLc��eZdZdZdifd�Zy)�FramezFFrame widget which may contain other widgets and can have a 3D border.Nc��t||f�}d}d|vrd|df}|d=nd|vr
d|df}|d=tj||d|i|�y)aConstruct a frame widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, relief, takefocus, visual, width.r!r�z-classrr�N)r4r~r
)rNr�r/rorxs     r
r
zFrame.__init__�se����b�	�"�����s�?��s�8�}�-�E��H�
�
��^��s�7�|�,�E��G������f�g�s�B��>rr�r!rr
rsrs�s��P�"��?rrsc��eZdZdZdifd�Zy)�Labelz0Label widget which can display text and bitmaps.Nc�6�tj||d||�y)a�Construct a label widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            height, state, width

        �labelNr�r�s    r
r
zLabel.__init__�s��$	����f�g�s�B�7rr�r!rr
rvrv�s��:�"��8rrvc��eZdZdZdifd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZeZdd�ZeZd�ZeZdd�ZeZd�Zd�Zdd�ZeZy)�Listboxz3Listbox widget which can display a list of strings.Nc�6�tj||d||�y)a�Construct a listbox widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, height, highlightbackground,
        highlightcolor, highlightthickness, relief, selectbackground,
        selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
        width, xscrollcommand, yscrollcommand, listvariable.�listboxNr�r�s    r
r
zListbox.__init__�s��	����f�i��b�9rc�R�|jj|jd|�y)z"Activate item identified by INDEX.�activateNrurWs  r
r~zListbox.activate���������T�W�W�j�%�0rc�v�|j|jj|jd|��xsdS)zxReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses the item identified by the given index.r1NrErWs  r
r1zListbox.bbox�s-���}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�t�|j|jj|jd��xsdS)z.Return the indices of currently selected item.�curselectionr!rErMs r
r�zListbox.curselection�s)���}�}�T�W�W�\�\�$�'�'�>�B�C�I�r�Irc�T�|jj|jd||�y)z+Delete items from FIRST to LAST (included).rZNrurPs   r
rZzListbox.delete�rSrc���|�A|jj|jj|jd||��S|jj|jd|�S)z0Get list of items from FIRST to LAST (included).rr�rPs   r
rzListbox.get�sX�����7�7�$�$�T�W�W�\�\������t�&-�.�
.��7�7�<�<������6�6rc��|jj|jd|�}|dk(ry|jj|�S)z+Return index of item identified with INDEX.r=r�N�r<r
rvrQ�rNr=r�s   r
r=z
Listbox.index�s8���G�G�L�L����'�5�1����;�t��w�w�~�~�a� � rc�Z�|jj|jd|f|z�y)zInsert ELEMENTS at INDEX.rNru)rNr=�elementss   r
rzListbox.insert�s"�������d�g�g�x��/�(�:�;rc��|jj|jj|jd|��S)z5Get index of item which is nearest to y coordinate Y.�nearestr)rNr�s  r
r�zListbox.nearest�s1���w�w�~�~�d�g�g�l�l��G�G�Y��#�$�	$rc�V�|jj|jdd||�yrrurGs   r
rzListbox.scan_mark�rrc�V�|jj|jdd||�y)z�Adjust the view of the listbox to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrurGs   r
r zListbox.scan_dragto�� ��	
�����T�W�W�f�h��1�5rc�R�|jj|jd|�y)z"Scroll such that INDEX is visible.�seeNrurWs  r
r�zListbox.see���������T�W�W�e�U�+rc�T�|jj|jdd|�y)z-Set the fixed end oft the selection to INDEX.r�r.NrurWs  r
�selection_anchorzListbox.selection_anchor�r^rc�V�|jj|jdd||�y)z2Clear the selection from FIRST to LAST (included).r�r�NrurPs   r
r�zListbox.selection_clear�s!�������T�W�W��g�u�d�	4rc��|jj|jj|jdd|��S)z.Return True if INDEX is part of the selection.r��includesrrWs  r
�selection_includeszListbox.selection_includes
s5���w�w�!�!�$�'�'�,�,��G�G�[�*�e�#5�6�	6rc�V�|jj|jdd||�y)ziSet the selection from FIRST to LAST (included) without
        changing the currently selected elements.r�rNrurPs   r
�
selection_setzListbox.selection_set
s ��	
�����T�W�W�k�5�%��>rc��|jj|jj|jd��S)z-Return the number of elements in the listbox.rOrrMs r
rOzListbox.size
s(���w�w�~�~�d�g�g�l�l�4�7�7�F�;�<�<rc�`�|jj|jdf|d|zfz�S)z4Return the resource value for an ITEM and an OPTION.rr7ru�rNr=r�s   r
rzListbox.itemcget
s1���w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�,�|jd|f||�S)a9Configure resources of an ITEM.

        The values for resources are specified as keyword arguments.
        To get an overview about the allowed keyword arguments
        call the method without arguments.
        Valid resource names: background, bg, foreground, fg,
        selectbackground, selectforeground.r	rrCs    r
r	zListbox.itemconfigure
s�������7��b�A�Arr)rPrQrRr�r
r~r1r�rZrr=rr�rr r�r��
select_anchorr�r(r��select_includesr��
select_setrOrr	r3r!rr
rzrz�s���=�"��:�1�K�
J�5�7�!�<�$�
4�6�,�<�%�M�4�
#�L�6�
)�O�?�
�J�=�9�
B��Jrrzc���eZdZdZdifd�Zdd�Zd�Zifd�Zifd�Zifd�Z	ifd	�Z
ifd
�Zifd�Zifd�Z
ifd
�Zifd�Zifd�Zifd�Zifd�Zdd�Zd�Zdd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�MenuzPMenu widget which allows displaying menu bars, pull-down menus and pop-up menus.Nc�6�tj||d||�y)aAConstruct menu widget with the parent MASTER.

        Valid resource names: activebackground, activeborderwidth,
        activeforeground, background, bd, bg, borderwidth, cursor,
        disabledforeground, fg, font, foreground, postcommand, relief,
        selectcolor, takefocus, tearoff, tearoffcommand, title, type.�menuNr�r�s    r
r
z
Menu.__init__,
s��	����f�f�c�2�6rc�V�|jjd|j|||�y)z/Post the menu at position X,Y with entry ENTRY.�tk_popupNru)rNr�r�rNs    r
r�z
Menu.tk_popup5
s�������Z����!�Q��6rc�R�|jj|jd|�y)zActivate entry at INDEX.r~NrurWs  r
r~z
Menu.activate9
rrc�z�|jj|jd|f|j||�z�y)rr*NrP)rNr�r/ros    r
r*zMenu.add=
s2�������d�g�g�u�h�/����s�B�'�(�	)rc�0�|jd|xs|�y)zAdd hierarchical menu item.�cascadeN�r*rs   r
�add_cascadezMenu.add_cascadeB
�������C�I�2�&rc�0�|jd|xs|�y)zAdd checkbutton menu item.r7Nr�rs   r
�add_checkbuttonzMenu.add_checkbuttonF
��������	�r�*rc�0�|jd|xs|�y)zAdd command menu item.r�Nr�rs   r
�add_commandzMenu.add_commandJ
r�rc�0�|jd|xs|�y)zAdd radio menu item.�radiobuttonNr�rs   r
�add_radiobuttonzMenu.add_radiobuttonN
r�rc�0�|jd|xs|�y)zAdd separator.�	separatorNr�rs   r
�
add_separatorzMenu.add_separatorR
s������c�i�R�(rc�|�|jj|jd||f|j||�z�y)rrNrP)rNr=r�r/ros     r
rzMenu.insertV
s4�������d�g�g�x���9����s�B�'�(�	)rc�2�|j|d|xs|�y)z$Add hierarchical menu item at INDEX.r�N�rrCs    r
�insert_cascadezMenu.insert_cascade[
������E�9�c�i�R�0rc�2�|j|d|xs|�y)z#Add checkbutton menu item at INDEX.r7Nr�rCs    r
�insert_checkbuttonzMenu.insert_checkbutton_
������E�=�#�)��4rc�2�|j|d|xs|�y)zAdd command menu item at INDEX.r�Nr�rCs    r
�insert_commandzMenu.insert_commandc
r�rc�2�|j|d|xs|�y)zAdd radio menu item at INDEX.r�Nr�rCs    r
�insert_radiobuttonzMenu.insert_radiobuttong
r�rc�2�|j|d|xs|�y)zAdd separator at INDEX.r�Nr�rCs    r
�insert_separatorzMenu.insert_separatork
s�����E�;��	�r�2rc�`�|�|}|j|�|j|�}}|�|�d\}}t||dz�D]E}d|j|�vs�t|j	|d��}|s�5|j|��G|jj|jd||�y)z7Delete menu items between INDEX1 and INDEX2 (included).N)rr�rr�rZ)	r=ri�entryconfigr�	entrycgetrr<r
rv)rN�index1�index2�
num_index1�
num_index2r�r0s       r
rZzMenu.deleteo
s����>��F�!%���F�!3�T�Z�Z��5G�J�
���J�$6�%*�"�J�
��z�:��>�2�A��D�,�,�Q�/�/�����q�)�4�5����&�&�q�)�	3�
	
�����T�W�W�h���7rc�X�|jj|jd|d|z�S)z=Return the resource value of a menu item for OPTION at INDEX.r�r7rur�s   r
r�zMenu.entrycget
s#���w�w�|�|�D�G�G�[�%��v��F�Frc�,�|jd|f||�S)zConfigure a menu item at INDEX.�entryconfigurerrCs    r
r�zMenu.entryconfigure�
s����� 0�%�8�#�r�B�Brc��|jj|jd|�}|dvrdS|jj|�S)z4Return the index of a menu item identified by INDEX.r=)r�r�Nr�r�s   r
r=z
Menu.index�
s;���G�G�L�L����'�5�1���L�(�t�?�d�g�g�n�n�Q�.?�?rc�P�|jj|jd|�S)zRInvoke a menu item identified by INDEX and execute
        the associated command.r�rurWs  r
r�zMenu.invoke�
s���w�w�|�|�D�G�G�X�u�5�5rc�T�|jj|jd||�y)zDisplay a menu at position X,Y.�postNrurGs   r
r�z	Menu.post�
s�������T�W�W�f�a��+rc�P�|jj|jd|�S)z*Return the type of the menu item at INDEX.r(rurWs  r
r(z	Menu.type�
s���w�w�|�|�D�G�G�V�U�3�3rc�P�|jj|jd�y)z
Unmap a menu.�unpostNrurMs r
r�zMenu.unpost�
rGrc��|jj|jj|jd|��S)zNReturn the x-position of the leftmost pixel of the menu item
        at INDEX.�	xpositionrrWs  r
r�zMenu.xposition�
s,���w�w�~�~�d�g�g�l�l�4�7�7�K��G�H�Hrc��|jj|jj|jd|��S)zEReturn the y-position of the topmost pixel of the menu item at INDEX.�	ypositionrrWs  r
r�zMenu.yposition�
s1���w�w�~�~�d�g�g�l�l��G�G�[�%�)�*�	*r�r�r)rPrQrRr�r
r�r~r*r�r�r�r�r�rr�r�r�r�r�rZr�r�r�r=r�r�r(r�r�r�r!rr
r�r�)
s���Z�"��7�7�1�!#�)�
!�'�#%�+�!�'�#%�+�!#�)�+-�)�
)+�1�-/�5�)+�1�-/�5�+-�3�8� G�C�!�K�@�
6�
,�4�(�I�
*rr�c��eZdZdZdifd�Zy)�
Menubuttonz(Menubutton widget, obsolete since Tk8.0.Nc�6�tj||d||�y)N�
menubuttonr�r�s    r
r
zMenubutton.__init__�
s������f�l�C��<rr�r!rr
r�r��
s��2�"��=rr�c��eZdZdZdifd�Zy)�MessagezKMessage widget to display multiline text. Obsolete since Label does it too.Nc�6�tj||d||�y)N�messager�r�s    r
r
zMessage.__init__�
s������f�i��b�9rr�r!rr
r�r��
s��U�"��:rr�c�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.Nc�6�tj||d||�y)a�Construct a radiobutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, padx, pady, relief, selectcolor, selectimage,
        state, takefocus, text, textvariable, underline, value, variable,
        width, wraplength.r�Nr�r�s    r
r
zRadiobutton.__init__�
r8rc�P�|jj|jd�yr=rurMs r
r>zRadiobutton.deselect�
s��	
�����T�W�W�j�)rc�P�|jj|jd�yr@rurMs r
r�zRadiobutton.flash�
rArc�N�|jj|jd�SrCrurMs r
r�zRadiobutton.invoke�
rDrc�P�|jj|jd�yrFrurMs r
r"zRadiobutton.select�
rGr)	rPrQrRr�r
r>r�r�r"r!rr
r�r��
s#��Q�"��
>�*�
'�/�(rr�c�6�eZdZdZdifd�Zd�Zd�Zdd�Zd�Zy)	�Scalez1Scale widget which can display a numerical scale.Nc�6�tj||d||�y)a�Construct a scale widget with the parent MASTER.

        Valid resource names: activebackground, background, bigincrement, bd,
        bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
        highlightbackground, highlightcolor, highlightthickness, label,
        length, orient, relief, repeatdelay, repeatinterval, resolution,
        showvalue, sliderlength, sliderrelief, state, takefocus,
        tickinterval, to, troughcolor, variable, width.rNr�r�s    r
r
zScale.__init__�
s��	����f�g�s�B�7rc���|jj|jd�}	|jj|�S#tt
tf$r|jj|�cYSwxYw)z*Get the current value as integer or float.r)r<r
rvrQr�r+r�rRrs  r
rz	Scale.get�
s]�������T�W�W�e�,��	,��7�7�>�>�%�(�(���I�x�0�	,��7�7�$�$�U�+�+�	,�s�A�/A5�4A5c�R�|jj|jd|�y)zSet the value to VALUE.rNrurs  r
rz	Scale.set�
r�rc�n�|j|jj|jd|��S)z�Return a tuple (X,Y) of the point along the centerline of the
        trough that corresponds to VALUE or the current value if None is
        given.r�rErs  r
r�zScale.coords�
s(��
�}�}�T�W�W�\�\�$�'�'�8�U�C�D�Drc�R�|jj|jd||�S)zcReturn where the point X,Y lies. Valid return values are "slider",
        "though1" and "though2".�identifyrurGs   r
r�zScale.identify�
�!���w�w�|�|�D�G�G�Z��A�6�6rr)	rPrQrRr�r
rrr�r�r!rr
r�r��
s$��;�"��	8�,�,�E�7rr�c�B�eZdZdZdifd�Zd
d�Zd�Zd�Zd�Zd�Z	d	�Z
y)�	Scrollbarz?Scrollbar widget which displays a slider at a certain position.Nc�6�tj||d||�y)alConstruct a scrollbar widget with the parent MASTER.

        Valid resource names: activebackground, activerelief,
        background, bd, bg, borderwidth, command, cursor,
        elementborderwidth, highlightbackground,
        highlightcolor, highlightthickness, jump, orient,
        relief, repeatdelay, repeatinterval, takefocus,
        troughcolor, width.�	scrollbarNr�r�s    r
r
zScrollbar.__init__s��	����f�k�3��;rc�X�|jj|jd|�xsdS)a�Marks the element indicated by index as active.
        The only index values understood by this method are "arrow1",
        "slider", or "arrow2".  If any other value is specified then no
        element of the scrollbar will be active.  If index is not specified,
        the method returns the name of the element that is currently active,
        or None if no element is active.r~NrurWs  r
r~zScrollbar.activates$���w�w�|�|�D�G�G�Z��7�?�4�?rc��|jj|jj|jd||��S)znReturn the fractional change of the scrollbar setting if it
        would be moved by DELTAX or DELTAY pixels.r�r)rN�deltax�deltays   r
r�zScrollbar.deltas5���w�w� � ��G�G�L�L����'�6�6�:�<�	<rc��|jj|jj|jd||��S)zRReturn the fractional value which corresponds to a slider
        position of X,Y.r�rrGs   r
r�zScrollbar.fractions0���w�w� � ������d�g�g�z�1�a�!H�I�Irc�R�|jj|jd||�S)zYReturn the element under position X,Y as one of
        "arrow1","slider","arrow2" or "".r�rurGs   r
r�zScrollbar.identify"r�rc�l�|j|jj|jd��S)zZReturn the current fractional values (upper and lower end)
        of the slider position.r)r�r<r
rvrMs r
rz
Scrollbar.get's(����������T�W�W�e� <�=�=rc�T�|jj|jd||�y)ziSet the fractional values of the slider position (upper and
        lower ends as value between 0 and 1).rNrurPs   r
rz
Scrollbar.set,s��	
�����T�W�W�e�U�D�1rr)rPrQrRr�r
r~r�r�r�rrr!rr
r�r�s/��I�"��	<�@�<�J�
7�
>�
2rr�c��eZdZdZdifd�Zd�Zd�Zd�Zd8d�Zd8d�Z	d	�Z
d9d
�Zd�Zd8d�Z
d
�Zd�Zd�Zd�Zd8d�Zd�Zd8d�Zifd�Zd�Zd�Zd�Zd8d�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Z d �Z!d!�Z"d"�Z#			d:d#�Z$d$�Z%d%�Z&d8d&�Z'd8d'�Z(d;d(�Z)d)�Z*d8d*�Z+e+Z,d+�Z-d8d,�Z.d8d-�Z/d8d.�Z0d8d/�Z1d8d0�Z2d1�Z3d8d2�Z4d3�Z5d8d4�Z6e6Z7ifd5�Z8d6�Z9d7�Z:y)<�Textz4Text widget which can display text in various forms.Nc�6�tj||d||�y)a�Construct a text widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor,
            exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, padx, pady,
            relief, selectbackground,
            selectborderwidth, selectforeground,
            setgrid, takefocus,
            xscrollcommand, yscrollcommand,

        WIDGET-SPECIFIC OPTIONS

            autoseparators, height, maxundo,
            spacing1, spacing2, spacing3,
            state, tabs, undo, width, wrap,

        r�Nr�r�s    r
r
z
Text.__init__5s��.	����f�f�c�2�6rc�v�|j|jj|jd|��xsdS)z�Return a tuple of (x,y,width,height) which gives the bounding
        box of the visible part of the character at the given index.r1NrErWs  r
r1z	Text.bboxNs5���}�}������T�W�W�f�e�4�6�>�9=�	>rc	��|jj|jj|jd|||��S)z�Return whether between index INDEX1 and index INDEX2 the
        relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.�comparer)rNr��opr�s    r
rzText.compareTs9���w�w�!�!�$�'�'�,�,��G�G�Y���F�#4�5�	5rc��|D�cgc]}d|z��	}}|||gz
}|jj|jdg|���xsd}|�t|�dkr|fS|Scc}w)a�Counts the number of relevant things between the two indices.
        If index1 is after index2, the result will be a negative number
        (and this holds for each of the possible options).

        The actual items which are counted depends on the options given by
        args. The result is a list of integers, one for the result of each
        counting option given. Valid counting options are "chars",
        "displaychars", "displayindices", "displaylines", "indices",
        "lines", "xpixels" and "ypixels". There is an additional possible
        option "update", which if given then all subsequent options ensure
        that any possible out of date information is recalculated.r^rtN�)r<r
rvr)rNr�r�rn�argr$s      r
rtz
Text.countZso��(,�,�t�����t��,���� � ���d�g�g�l�l�4�7�7�G�3�d�3�;�t���?�s�4�y�A�~��7�N��J��
-s�Ac���|�?|jj|jj|jd��S|jj|jd|�y)zjTurn on the internal consistency checks of the B-Tree inside the text
        widget according to BOOLEAN.N�debugrrfs  r
rz
Text.debugnsI���?��7�7�%�%�d�g�g�l�l�4�7�7�G�&D�E�E������T�W�W�g�w�/rc�T�|jj|jd||�y)z?Delete the characters between INDEX1 and INDEX2 (not included).rZNru�rNr�r�s   r
rZzText.deleteus�������T�W�W�h���7rc�n�|j|jj|jd|��S)z�Return tuple (x,y,width,height,baseline) giving the bounding box
        and baseline position of the visible part of the line containing
        the character at INDEX.�	dlineinforErWs  r
rzText.dlineinfoys(���}�}�T�W�W�\�\�$�'�'�;��F�G�Grc��g}d}d}|s	g}|fd�}|}	t|t�s|j|�x}}|d|gz
}|D]}	||	s�	|jd|	z��|j|�|r|j|�|jj
|jdg|���||r|j|�SS#|r|j|�wwxYw)a�Return the contents of the widget between index1 and index2.

        The type of contents returned in filtered based on the keyword
        parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are
        given and true, then the corresponding items are returned. The result
        is a list of triples of the form (key, value, index). If none of the
        keywords are true then 'all' is used by default.

        If the 'command' argument is given, it is called once for each element
        of the list of triples, with the values of each triple serving as the
        arguments to the function. In this case the list is not returned.Nc�,�|j|||f�yr)r�)rArr=rs    r
�
append_triplez Text.dump.<locals>.append_triple�s���
�
�s�E�5�1�2rz-commandr7�dump)rrr'r�r<r
rvr)
rNr�r�r�rorn�	func_namerrrAs
          r
rz	Text.dumps������	����
�F�8>�
3�#�G�
	.��g�s�+�&*�n�n�W�&=�=�	�G��Z��)�)�D����c�7�D�K�K��c�	�2���K�K�������F�#��D�G�G�L�L����&�0�4�0����"�"�9�-���y��"�"�9�-��s�4C�A#C�Cc�R�|jj|jdg|���S)arInternal method

        This method controls the undo mechanism and
        the modified flag. The exact behavior of the
        command depends on the option argument that
        follows the edit argument. The following forms
        of the command are currently supported:

        edit_modified, edit_redo, edit_reset, edit_separator
        and edit_undo

        �editrurys  r
rz	Text.edit�s$���t�w�w�|�|�D�G�G�V�3�d�3�3rc�&�|jd|�S)a;Get or Set the modified flag

        If arg is not specified, returns the modified
        flag of the widget. The insert, delete, edit undo and
        edit redo commands or the user can set or clear the
        modified flag. If boolean is specified, sets the
        modified flag of the widget to arg.
        �modified�r)rNr
s  r
�
edit_modifiedzText.edit_modified�s���y�y��S�)�)rc�$�|jd�S)aRedo the last undone edit

        When the undo option is true, reapplies the last
        undone edits provided no other edits were done since
        then. Generates an error when the redo stack is empty.
        Does nothing when the undo option is false.
        �redorrMs r
�	edit_redozText.edit_redo�s���y�y�� � rc�$�|jd�S)z(Clears the undo and redo stacks
        �resetrrMs r
�
edit_resetzText.edit_reset�s���y�y��!�!rc�$�|jd�S)znInserts a separator (boundary) on the undo stack.

        Does nothing when the undo option is false
        r�rrMs r
�edit_separatorzText.edit_separator�s��
�y�y��%�%rc�$�|jd�S)aDUndoes the last edit action

        If the undo option is true. An edit action is defined
        as all the insert and delete commands that are recorded
        on the undo stack in between two separators. Generates
        an error when the undo stack is empty. Does nothing
        when the undo option is false
        �undorrMs r
�	edit_undozText.edit_undo�s���y�y�� � rc�R�|jj|jd||�S)z5Return the text from INDEX1 to INDEX2 (not included).rrurs   r
rzText.get�s���w�w�|�|�D�G�G�U�F�F�;�;rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z9Return the value of OPTION of an embedded image at INDEX.Nrr7r�r�rcrrur�s   r
�
image_cgetzText.image_cget�sQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�W�f�e�V�D�Drc�.�|jdd|f||�S)z%Configure an embedded image at INDEX.rcrrrCs    r
�image_configurezText.image_configure�s�������e�<�c�2�F�Frc�v�|jj|jdd|g|j||����S)z"Create an embedded image at INDEX.rcrrPrCs    r
�image_createzText.image_create�s9���t�w�w�|�|����'�8�U�*��-�-��R�(�*�	*rc�P�|jj|jdd�S)z3Return all names of embedded images in this widget.rcrdrurMs r
rezText.image_names�s���w�w�|�|�D�G�G�W�g�6�6rc�b�t|jj|jd|��S)z1Return the index in the form line.char for INDEX.r=)rr<r
rvrWs  r
r=z
Text.index�s"���4�7�7�<�<�����%�8�9�9rc�\�|jj|jd||f|z�y)z�Insert CHARS before the characters at INDEX. An additional
        tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.rNru)rNr=�charsrns    r
rzText.inserts&��	
�����d�g�g�x���6��=�>rc�V�|jj|jdd||f�S)z�Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
        Return the current value if None is given for DIRECTION.r�gravityru)rN�markName�	directions   r
�mark_gravityzText.mark_gravitys+���w�w�|�|�
�W�W�f�i��9�=�?�	?rc��|jj|jj|jdd��S)zReturn all mark names.rrdr�rMs r
�
mark_nameszText.mark_namess3���w�w� � �������G�G�V�W�"&�'�	'rc�V�|jj|jdd||�y)z0Set mark MARKNAME before the character at INDEX.rrNru)rNr4r=s   r
�mark_setz
Text.mark_sets�������T�W�W�f�e�X�u�=rc�Z�|jj|jddf|z�y)zDelete all marks in MARKNAMES.r�unsetNru)rN�	markNamess  r
�
mark_unsetzText.mark_unsets"�������d�g�g�v�w�/�)�;�<rc�Z�|jj|jdd|�xsdS)z-Return the name of the next mark after INDEX.r�nextNrurWs  r
�	mark_nextzText.mark_nexts$���w�w�|�|�D�G�G�V�V�U�;�C�t�Crc�Z�|jj|jdd|�xsdS)z2Return the name of the previous mark before INDEX.r�previousNrurWs  r
�
mark_previouszText.mark_previouss$���w�w�|�|�D�G�G�V�Z��?�G�4�Grc�x�|jj|jdd|g|j||����y)aCreates a peer text widget with the given newPathName, and any
        optional standard configuration options. By default the peer will
        have the same start and end line as the parent widget, but
        these can be overridden with the standard configuration options.�peerrNrP)rN�newPathNamer/ros    r
�peer_createzText.peer_create!s5��
	������T�W�W�f�h��	%�
�]�]�3��
#�	%rc��|jj|jj|jdd��S)zYReturns a list of peers of this widget (this does not include
        the widget itself).rFrdr�rMs r
�
peer_nameszText.peer_names)s.���w�w� � ������d�g�g�v�w�!G�H�Hrc�Z�|jj|jd|||g|���y)z�Replaces the range of characters between index1 and index2 with
        the given characters and tags specified by args.

        See the method insert for some more information about args, and the
        method delete for information about the indices.rNru)rNr�r�r1rns     r
rzText.replace.s'��	������T�W�W�i����F��Frc�V�|jj|jdd||�yrrurGs   r
rzText.scan_mark6rrc�V�|jj|jdd||�y)z~Adjust the view of the text to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrurGs   r
r zText.scan_dragto:r�rc�D�|jdg}|r|jd�|r|jd�|r|jd�|r|jd�|r|jd�|
r|jd�|	r"|jd�|j|	�|r|d	d
k(r|jd�|j|�|j|�|r|j|�t|jj	t|���S)z�Search PATTERN beginning from INDEX until STOPINDEX.
        Return the index of the first character of a match or an
        empty string.rz	-forwardsz
-backwardsz-exactz-regexpz-nocasez-elidez-countrr7r�)rvr�rr<r
r)rNr�r=�	stopindex�forwards�	backwards�exact�regexp�nocasert�eliderns            r
rzText.search@s�������"���T�[�[��-��d�k�k�,�/��$�+�+�h�'��4�;�;�y�)��4�;�;�y�)��$�+�+�h�'��$�+�+�h�'����U�);��w�q�z�S�(�$�+�+�d�*;����G�����E���d�k�k�)�,��4�7�7�<�<��d��,�-�-rc�R�|jj|jd|�y)z3Scroll such that the character at INDEX is visible.r�NrurWs  r
r�zText.seeTr�rc�^�|jj|jdd||f|z�y)z|Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
        Additional pairs of indices may follow in ARGS.�tagr*Nru)rN�tagNamer�rns    r
�tag_addzText.tag_addXs+��	
�����
�W�W�e�U�G�V�4�t�;�	=rc�D�|j|jdd||f|�S)zgUnbind for all characters with TAGNAME for event SEQUENCE  the
        function identified with FUNCID.rXr�r�)rNrYr�r�s    r
r�zText.tag_unbind^s$���|�|�T�W�W�e�V�W�h�G��P�Prc�F�|j|jdd|f|||�S)a+Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value.rXr�r��rNrYr�r�r*s     r
r�z
Text.tag_bindcs+���z�z�4�7�7�E�6�7�;��D�#�'�	'rc�F�|j|jdd|f|||�S)NrXr�r�r]s     r
�	_tag_bindzText._tag_bindls)���z�z�4�7�7�E�6�7�;��D�#�'�	'rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z+Return the value of OPTION for tag TAGNAME.Nrr7r�r�rXrru)rNrYr�s   r
�tag_cgetz
Text.tag_cgetqsQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�U�F�G�V�D�Drc�.�|jdd|f||�S)zConfigure a tag TAGNAME.rXrr)rNrYr/ros    r
�
tag_configurezText.tag_configureys������{�G�<�c�2�F�Frc�Z�|jj|jddf|z�y)zDelete all tags in TAGNAMES.rXrZNru)rN�tagNamess  r
�
tag_deletezText.tag_deletes"�������d�g�g�u�h�/�(�:�;rc�V�|jj|jdd||�y)z`Change the priority of tag TAGNAME such that it is lower
        than the priority of BELOWTHIS.rXr�Nru)rNrYr�s   r
rzText.tag_lower�s ��	
�����T�W�W�e�W�g�y�Arc��|jj|jj|jdd|��S)zReturn a list of all tag names.rXrdr�rWs  r
�	tag_nameszText.tag_names�s3���w�w� � ��G�G�L�L����%��%�8�:�	:rc
��|jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched forward from INDEX1.rX�	nextranger��rNrYr�r�s    r
�
tag_nextrangezText.tag_nextrange��>���w�w� � �������G�G�U�K��&�&�"B�C�	Crc
��|jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched backwards from INDEX1.rX�	prevranger�rls    r
�
tag_prevrangezText.tag_prevrange�rnrc�V�|jj|jdd||�y)zaChange the priority of tag TAGNAME such that it is higher
        than the priority of ABOVETHIS.rXr�Nru)rNrYr�s   r
rzText.tag_raise�s#��	
������G�G�U�G�W�i�	9rc��|jj|jj|jdd|��S)z7Return a list of ranges of text which have tag TAGNAME.rX�rangesr�)rNrYs  r
�
tag_rangeszText.tag_ranges�s5���w�w� � �������G�G�U�H�g�"/�0�	0rc�X�|jj|jdd|||�y)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.rXr1Nrurls    r
�
tag_removezText.tag_remove�s#��������G�G�U�H�g�v�v�	?rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z:Return the value of OPTION of an embedded window at INDEX.Nrr7r�r�rtrrur�s   r
�window_cgetzText.window_cget�sQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�X�v�u�f�E�Erc�.�|jdd|f||�S)z&Configure an embedded window at INDEX.rtrrrCs    r
�window_configurezText.window_configure�s������+�u�=�s�B�G�Grc�|�|jj|jdd|f|j||�z�y)zCreate a window at INDEX.rtrNrPrCs    r
�
window_createzText.window_create�s5��������w�w��(�E�2��
�
�c�2�&�'�	(rc��|jj|jj|jdd��S)z4Return all names of embedded windows in this widget.rtrdr�rMs r
�window_nameszText.window_names�s1���w�w� � ��G�G�L�L����(�G�4�6�	6rc�Z�|jj|jddf|z�y)zObsolete function, use see.r�z
-pickplaceNru)rNr�s  r
�yview_pickplacezText.yview_pickplace�s"�������d�g�g�w��5��<�=rrrn)NNNNNNNNrE);rPrQrRr�r
r1rrtrrZrrrrrr!r#r&rr)r+r-rer=rr6r8r:r>rArDrHrJrrr rr�rZr�r�r_rarc�
tag_configrfrrirmrqrrurwryr{�
window_configr}rr�r!rr
rr2sI��>�"��7�2>�5��(0�8�H�%.�P
4�	*�!�"�
&�	!�<�
E�G�')�*�7�:�?�
?�'�
>�=�D�H�,.�%�I�
G�4�6�04�04�7;�.�(,�=�Q�
'�'�
E�G��J�<�B�
:�
C�C�9�0�
?�
F�H�%�M�')�(�6�
>rrc��eZdZdZdd�Zd�Zy)�_setitz>Internal class. It wraps the command in the widget OptionMenu.Nc�.�||_||_||_yr)�
_setit__value�_setit__var�_setit__callback)rN�varrr$s    r
r
z_setit.__init__�s�������
�"��rc��|jj|j�|j�|j|jg|���yyr)r�rr�r�rys  r
r z_setit.__call__�s<���
�
���t�|�|�$��?�?�&��D�O�O�D�L�L�0�4�0�'rrrzr!rr
r�r��s��H�#�
1rr�c�"�eZdZdZd�Zd�Zd�Zy)�
OptionMenuz?OptionMenu which allows the user to select a value from a menu.c	��d|dtddd�}tj||d|�d|_t	|dd�	�x}|_|j|_|jd
�}d
|vr|d
=|r tdtt|��z��|j|t|||���|D] }	|j|	t||	|����"||d<y
)z�Construct an optionmenu widget with the parent MASTER, with
        the resource textvariable set to VARIABLE, the initially selected
        value VALUE, the other menu values VALUES and an additional
        keyword argument command.r6rr0)�borderwidth�textvariable�indicatoron�reliefr.�highlightthicknessr��
tk_optionMenur�r)r��tearoffr�zunknown option -)rxr�N)�RAISEDr~r
rwr��_OptionMenu__menurv�menunamerr�r@r:r�r�)
rNr�r+rr,�kwargsror�r$r3s
          r
r
zOptionMenu.__init__�s���
���&�C�$%�'��	����f�l�B�7�)���!�$�V�Q�?�?��t�{�����
��:�:�i�(������y�!���-�d�4��<�.@�@�A�A����u���%��:�	�	<��A����1�#�H�a��:�
�
<����V�rc�P�|dk(r|jStj||�S)Nr�)r�r~rurs  r
ruzOptionMenu.__getitem__�s&���6�>��;�;���!�!�$��-�-rc�<�tj|�d|_y)z,Destroy this widget and the associated menu.N)r�r�r�rMs r
r�zOptionMenu.destroy�s�����4� ���rN)rPrQrRr�r
rur�r!rr
r�r��s��I��2.�
rr�c�V�eZdZdZdZdidfd�Zd�Zd�Zd�Zd�Z	d	�Z
e
Zd
�Zd�Z
d�Zy)
�ImagezBase class for images.rNc�r�d|_|�td�}t|d|�|_|s,txj
dz
c_dtj
��}|r|rt
||f�}n|r|}d}|j�D]\}}|d|z|fz}�|jjdd||f|z�||_y)	Nzcreate imager<r�pyimager!r7rcr)	r�r�r�r<r��_last_idr4r-r
)	rN�imgtyper�r/r�ror>r2r3s	         r
r
zImage.__init__s�����	��>�&�~�6�F��&�$��/�����N�N�a��N�"'�.�.�2�D�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���Q���
�*�G� ������g�x��$�8�7�B�C���	rc��|jSr)r�rMs r
rOz
Image.__str__s��d�i�i�'rc��|jr)	|jjdd|j�yy#t$rYywxYw)NrcrZ)r�r<r
r�rMs r
rz
Image.__del__s?���9�9�
������W�h��	�	�:����
��
�s�'7�	A�Ac�Z�|jj|jdd|z|�y�Nrr7�r<r
r�rs   r
rzImage.__setitem__s �������T�Y�Y��S��W�e�<rc�V�|jj|jdd|z�Sr�r�rs  r
ruzImage.__getitem__s!���w�w�|�|�D�I�I�{�C��G�<�<rc���d}t|�j�D]\}}|��	|ddk(r|dd}|d|z|fz}�!|jj|jdf|z�y)zConfigure the image.r!Nr�r�r7rt)r4r-r<r
r�)rNror$r2r3s     r
rzImage.configure"sn�����b�M�'�'�)�D�A�q��}��R�5�C�<�Q�s��V���S��U�A�J�&��*�	
�����d�i�i��*�S�0�1rc��|jj|jjdd|j��S)zReturn the height of the image.rcr��r<rQr
r�rMs r
r�zImage.height-s/���w�w�~�~��G�G�L�L��(�D�I�I�6�8�	8rc�P�|jjdd|j�S)z7Return the type of the image, e.g. "photo" or "bitmap".rcr(r�rMs r
r(z
Image.type2s���w�w�|�|�G�V�T�Y�Y�7�7rc��|jj|jjdd|j��S)zReturn the width of the image.rcr�r�rMs r
r�zImage.width6s/���w�w�~�~��G�G�L�L��'�4�9�9�5�7�	7r)rPrQrRr�r�r
rOrrrurrtr�r(r�r!rr
r�r��sE�� ��H�%)�r�$�� (��=�=�2��F�8�
8�7rr�c�h�eZdZdZdidfd�Zd�Zd�Zd�Zd�Zdd�Z	dd	�Z
d
�Zdd�Zdd�Z
d
�Zd�Zy)�
PhotoImagez=Widget which can display images in PGM, PPM, GIF, PNG format.Nc�8�tj|d|||fi|��y)ztCreate an image with NAME.

        Valid resource names: data, format, file, gamma, height, palette,
        width.�photoN�r�r
�rNr�r/r�ros     r
r
zPhotoImage.__init__?s��
	���t�W�d�C��>�2�>rc�P�|jj|jd�y)zDisplay a transparent image.�blankNr�rMs r
r�zPhotoImage.blankFs�������T�Y�Y��(rc�V�|jj|jdd|z�S)zReturn the value of OPTION.rr7r�)rNr�s  r
rzPhotoImage.cgetJs!���w�w�|�|�D�I�I�v�s�V�|�<�<rc�V�|jj|jdd|z�S)Nrr7r�rs  r
ruzPhotoImage.__getitem__Os!���w�w�|�|�D�I�I�v�s�S�y�9�9rc��t|j��}|jj|d|j�|S)z;Return a new PhotoImage with the same image as this widget.r��copy�r�r<r
r�)rN�	destImages  r
r�zPhotoImage.copySs.���d�g�g�.�	������Y���	�	�2��rc��t|j��}|dk(r|}|jj|d|jd||�|S)z�Return a new PhotoImage with the same image as this widget
        but zoom it with a factor of x in the X direction and y in the Y
        direction.  If y is not given, the default value is the same as x.
        r�r�r�z-zoomr��rNr�r�r�s    r
�zoomzPhotoImage.zoomYsA��
�d�g�g�.�	��b�5�A�!������Y���	�	�7�1�Q�?��rc��t|j��}|dk(r|}|jj|d|jd||�|S)z�Return a new PhotoImage based on the same image as this widget
        but use only every Xth or Yth pixel.  If y is not given, the
        default value is the same as x.
        r�r�r�z
-subsampler�r�s    r
�	subsamplezPhotoImage.subsamplecsA��
�d�g�g�.�	��b�5�A�!������Y���	�	�<��!�D��rc�R�|jj|jd||�S)z8Return the color (red, green, blue) of the pixel at X,Y.rr�rGs   r
rzPhotoImage.getms���w�w�|�|�D�I�I�u�a��3�3rc��|jd|f}|r|ddk(r|dd}|dzt|�z}|jj|�y)zzPut row formatted colors to image starting from
        position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))�putr�-torN)r��r�rr<r
)rNr�r/rns    r
r�zPhotoImage.putqsO���	�	�5�$�'��
��!�u��~����V���(�?�U�2�Y�.�D������T�rc��|jd|f}|r|d|fz}|r|dzt|�z}|jj|�y)zRWrite image to file FILENAME in FORMAT starting from
        position FROM_COORDS.�writez-format)z-fromNr�)rN�filename�format�from_coordsrns     r
r�zPhotoImage.write|sM���	�	�7�H�-����9�f�-�-�D���*�$�u�[�'9�9�D������T�rc	��|jj|jj|jdd||��S)z/Return True if the pixel at x,y is transparent.�transparencyr)r<r	r
r�rGs   r
�transparency_getzPhotoImage.transparency_get�s7���w�w�!�!�$�'�'�,�,��I�I�~�u�a��#4�5�	5rc�X�|jj|jdd|||�y)z)Set the transparency of the pixel at x,y.r�rNr�)rNr�r�rgs    r
�transparency_setzPhotoImage.transparency_set�s �������T�Y�Y���q�!�W�Err�rrn)rPrQrRr�r
r�rrur�r�r�rr�r�r�r�r!rr
r�r�<sI��G� �b��?�)�=�
:����4���5�
Frr�c��eZdZdZdidfd�Zy)�BitmapImagez.Widget which can display images in XBM format.Nc�8�tj|d|||fi|��y)zqCreate a bitmap with NAME.

        Valid resource names: background, data, file, foreground, maskdata, maskfile.r�Nr�r�s     r
r
zBitmapImage.__init__�s��	���t�X�t�S�&�?�B�?rr�r!rr
r�r��s��8� �b��@rr�c�n�td�j}|j|jdd��S)Nzuse image_names()rcrd�r�r<r8r
�r<s r
rere��-��	�.�	/�	2�	2�B�
�<�<������1�2�2rc�n�td�j}|j|jdd��S)Nzuse image_types()rcrhr�r�s r
riri�r�rc��eZdZdZdifd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zy)�Spinboxzspinbox widget.Nc�6�tj||d||�y)a�Construct a spinbox widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, background, borderwidth,
            cursor, exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, justify, relief,
            repeatdelay, repeatinterval,
            selectbackground, selectborderwidth
            selectforeground, takefocus, textvariable
            xscrollcommand.

        WIDGET-SPECIFIC OPTIONS

            buttonbackground, buttoncursor,
            buttondownrelief, buttonuprelief,
            command, disabledbackground,
            disabledforeground, format, from,
            invalidcommand, increment,
            readonlybackground, state, to,
            validate, validatecommand values,
            width, wrap,
        �spinboxNr�r�s    r
r
zSpinbox.__init__�s��6	����f�i��b�9rc�v�|j|jj|jd|��xsdS)a�Return a tuple of X1,Y1,X2,Y2 coordinates for a
        rectangle which encloses the character given by index.

        The first two elements of the list give the x and y
        coordinates of the upper-left corner of the screen
        area covered by the character (in pixels relative
        to the widget) and the last two elements give the
        width and height of the character, in pixels. The
        bounding box may refer to a region outside the
        visible area of the window.
        r1NrErWs  r
r1zSpinbox.bbox�s-���}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�R�|jj|jd||�S)aWDelete one or more elements of the spinbox.

        First is the index of the first character to delete,
        and last is the index of the character just after
        the last one to delete. If last isn't specified it
        defaults to first+1, i.e. a single character is
        deleted.  This command returns an empty string.
        rZrurPs   r
rZzSpinbox.delete�s!���w�w�|�|�D�G�G�X�u�d�;�;rc�N�|jj|jd�S)zReturns the spinbox's stringrrurMs r
rzSpinbox.get�rUrc�P�|jj|jd|�S)z�Alter the position of the insertion cursor.

        The insertion cursor will be displayed just before
        the character given by index. Returns an empty string
        rrurWs  r
rzSpinbox.icursor�s���w�w�|�|�D�G�G�Y��6�6rc�R�|jj|jd||�S)z{Returns the name of the widget at position x, y

        Return value is one of: none, buttondown, buttonup, entry
        r�rurGs   r
r�zSpinbox.identify�s!��
�w�w�|�|�D�G�G�Z��A�6�6rc�P�|jj|jd|�S)z;Returns the numerical index corresponding to index
        r=rurWs  r
r=z
Spinbox.index�s���w�w�|�|�D�G�G�W�e�4�4rc�R�|jj|jd||�S)zDInsert string s at index

         Returns an empty string.
        rru)rNr=r�s   r
rzSpinbox.insert�s!��
�w�w�|�|�D�G�G�X�u�a�8�8rc�P�|jj|jd|�S)z�Causes the specified element to be invoked

        The element could be buttondown or buttonup
        triggering the action associated with it.
        r�ru�rN�elements  r
r�zSpinbox.invoke�s���w�w�|�|�D�G�G�X�w�7�7rc�|�|j|jj|jdf|z��xsdS)rrr!rErys  r
rzSpinbox.scanr�rc�&�|jd|�S)z�Records x and the current view in the spinbox window;

        used in conjunction with later scan dragto commands.
        Typically this command is associated with a mouse button
        press in the widget. It returns an empty string.
        r�rr>s  r
rzSpinbox.scan_mark	s���y�y���#�#rc�&�|jd|�S)a�Compute the difference between the given x argument
        and the x argument to the last scan mark command

        It then adjusts the view left or right by 10 times the
        difference in x-coordinates. This command is typically
        associated with mouse motion events in the widget, to
        produce the effect of dragging the spinbox at high speed
        through the window. The return value is an empty string.
        rr�r>s  r
r zSpinbox.scan_dragtos���y�y��1�%�%rc�|�|j|jj|jdf|z��xsdS)rr�r!rErys  r
r�zSpinbox.selections9���}�}��G�G�L�L�$�'�'�;�/�$�6�7�9�?�<>�	?rc�&�|jd|�S)a�Locate the end of the selection nearest to the character
        given by index,

        Then adjust that end of the selection to be at index
        (i.e including but not going beyond index). The other
        end of the selection is made the anchor point for future
        select to commands. If the selection isn't currently in
        the spinbox, then a new selection is created to include
        the characters between index and the most recent selection
        anchor point, inclusive.
        r#�r�rWs  r
r]zSpinbox.selection_adjust#s���~�~�h��.�.rc�$�|jd�S)zsClear the selection

        If the selection isn't in this widget then the
        command has no effect.
        r�r�rMs r
r�zSpinbox.selection_clear1s���~�~�g�&�&rc�R�|jj|jdd|�S)z�Sets or gets the currently selected element.

        If a spinbutton element is specified, it will be
        displayed depressed.
        r�r�rur�s  r
�selection_elementzSpinbox.selection_element9s!���w�w�|�|�D�G�G�[�)�W�E�Erc�(�|jd|�y)rar*Nr�rWs  r
rbzSpinbox.selection_fromAs�����v�u�%rc��|jj|jj|jdd��S)zUReturn True if there are characters selected in the spinbox, False
        otherwise.r�rdrrMs r
rezSpinbox.selection_presentErfrc�*�|jd||�y)rhriNr�rjs   r
rlzSpinbox.selection_rangeKs�����w��s�+rc�(�|jd|�y)rnr/Nr�rWs  r
rozSpinbox.selection_toOs�����t�U�#rr)rPrQrRr�r
r1rZrrr�r=rr�rrr r�r]r�r�rbrerlror!rr
r�r��sp���"��:�:K�	<�,�7�7�5�
9�8�:�
$�
&�?�
/�'�F�&�;�,�$rr�c��eZdZdZdifd�Zy)�
LabelFramezlabelframe widget.Nc�6�tj||d||�y)a�Construct a labelframe widget with the parent MASTER.

        STANDARD OPTIONS

            borderwidth, cursor, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, padx, pady, relief,
            takefocus, text

        WIDGET-SPECIFIC OPTIONS

            background, class, colormap, container,
            height, labelanchor, labelwidget,
            visual, width
        �
labelframeNr�r�s    r
r
zLabelFrame.__init__Ys�� 	����f�l�C��<rr�r!rr
r�r�Vs���"��=rr�c�z�eZdZdZdifd�Zd�Zd�ZeZd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�ZeZd�Zy)�PanedWindowzpanedwindow widget.Nc�6�tj||d||�y)aTConstruct a panedwindow widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor, height,
            orient, relief, width

        WIDGET-SPECIFIC OPTIONS

            handlepad, handlesize, opaqueresize,
            sashcursor, sashpad, sashrelief,
            sashwidth, showhandle,
        �panedwindowNr�r�s    r
r
zPanedWindow.__init__qs��	����f�m�S�"�=rc�x�|jj|jd|f|j|�z�y)a+Add a child widget to the panedwindow in a new pane.

        The child argument is the name of the child widget
        followed by pairs of arguments that specify how to
        manage the windows. The possible options and values
        are the ones accepted by the paneconfigure method.
        r*NrP)rNrros   r
r*zPanedWindow.add�s-��	
�����d�g�g�u�e�,�t�}�}�R�/@�@�Arc�R�|jj|jd|�y)z�Remove the pane containing child from the panedwindow

        All geometry management options for child will be forgotten.
        r�Nru)rNrs  r
r1zPanedWindow.remove�s��
	
�����T�W�W�h��.rc�R�|jj|jd||�S)a�Identify the panedwindow component at point x, y

        If the point is over a sash or a sash handle, the result
        is a two element list containing the index of the sash or
        handle, and a word indicating whether it is over a sash
        or a handle, such as {0 sash} or {2 handle}. If the point
        is over any other part of the panedwindow, the result is
        an empty list.
        r�rurGs   r
r�zPanedWindow.identify�s!���w�w�|�|�D�G�G�Z��A�6�6rc�|�|j|jj|jdf|z��xsdS)r�proxyr!rErys  r
r�zPanedWindow.proxy�s9���}�}��G�G�L�L�$�'�'�7�+�d�2�3�5�;�8:�	;rc�$�|jd�S)zBReturn the x and y pair of the most recent proxy location
        �coord�r�rMs r
�proxy_coordzPanedWindow.proxy_coord�s���z�z�'�"�"rc�$�|jd�S)z+Remove the proxy from the display.
        r�rrMs r
�proxy_forgetzPanedWindow.proxy_forget�s���z�z�(�#�#rc�(�|jd||�S)z:Place the proxy at the given x and y coordinates.
        r*rrGs   r
�proxy_placezPanedWindow.proxy_place�s���z�z�'�1�a�(�(rc�|�|j|jj|jdf|z��xsdS)r�sashr!rErys  r
r	zPanedWindow.sash�r�rc�&�|jd|�S)aAReturn the current x and y pair for the sash given by index.

        Index must be an integer between 0 and 1 less than the
        number of panes in the panedwindow. The coordinates given are
        those of the top left corner of the region containing the sash.
        pathName sash dragto index x y This command computes the
        difference between the given coordinates and the coordinates
        given to the last sash coord command for the given sash. It then
        moves that sash the computed difference. The return value is the
        empty string.
        r�r	rWs  r
�
sash_coordzPanedWindow.sash_coord�s���y�y��%�(�(rc�&�|jd|�S)zRecords x and y for the sash given by index;

        Used in conjunction with later dragto commands to move the sash.
        rrrWs  r
�	sash_markzPanedWindow.sash_mark�s��
�y�y���'�'rc�*�|jd|||�S)z?Place the sash given by index at the given coordinates
        r*r)rNr=r�r�s    r
�
sash_placezPanedWindow.sash_place�s���y�y��%��A�.�.rc�`�|jj|jdf|d|zfz�S)zwQuery a management option for window.

        Option may be any value allowed by the paneconfigure subcommand
        �panecgetr7ru)rNrr�s   r
rzPanedWindow.panecget�s3��
�w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�"�|�|s|j|jd|�St|t�r#|s!|j	|jd|d|z�S|j
j
|jd|f|j||�z�y)a�
Query or modify the management options for window.

        If no option is specified, returns a list describing all
        of the available options for pathName.  If option is
        specified with no value, then the command returns a list
        describing the one named option (this list will be identical
        to the corresponding sublist of the value returned if no
        option is specified). If one or more option-value pairs are
        specified, then the command modifies the given widget
        option(s) to have the given value(s); in this case the
        command returns an empty string. The following options
        are supported:

        after window
            Insert the window after the window specified. window
            should be the name of a window already managed by pathName.
        before window
            Insert the window before the window specified. window
            should be the name of a window already managed by pathName.
        height size
            Specify a height for the window. The height will be the
            outer dimension of the window including its border, if
            any. If size is an empty string, or if -height is not
            specified, then the height requested internally by the
            window will be used initially; the height may later be
            adjusted by the movement of sashes in the panedwindow.
            Size may be any value accepted by Tk_GetPixels.
        minsize n
            Specifies that the size of the window cannot be made
            less than n. This constraint only affects the size of
            the widget in the paned dimension -- the x dimension
            for horizontal panedwindows, the y dimension for
            vertical panedwindows. May be any value accepted by
            Tk_GetPixels.
        padx n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the X-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        pady n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the Y-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        sticky style
            If a window's pane is larger than the requested
            dimensions of the window, this option may be used
            to position (or stretch) the window within its pane.
            Style is a string that contains zero or more of the
            characters n, s, e or w. The string can optionally
            contains spaces or commas, but they are ignored. Each
            letter refers to a side (north, south, east, or west)
            that the window will "stick" to. If both n and s
            (or e and w) are specified, the window will be
            stretched to fill the entire height (or width) of
            its cavity.
        width size
            Specify a width for the window. The width will be
            the outer dimension of the window including its
            border, if any. If size is an empty string, or
            if -width is not specified, then the width requested
            internally by the window will be used initially; the
            width may later be adjusted by the movement of sashes
            in the panedwindow. Size may be any value accepted by
            Tk_GetPixels.

        N�
paneconfigurer7)rrvrrr
r<r
r�r
s    r
rzPanedWindow.paneconfigure�s���H�;�r��%�%�d�g�g���H�H��c�3����&�&�����'�3�s�7�<�
<������d�g�g���8����s�B�'�(�	)rc��|jj|jj|jd��S)z+Returns an ordered list of the child panes.�panesr�rMs r
rzPanedWindow.panes)s*���w�w� � ������d�g�g�w�!?�@�@rr)rPrQrRr�r
r*r1r�r�r�rrrr	rrrrr�
paneconfigrr!rr
r�r�nsg���"��>� B�/��F�
7�;�
#�
$�
)�
:�
)�(�/�
9�J)�X�J�Arr�c��t�}d|jd�z}|dz
}t||��}|j�t	|d|fd���}|j�||_t	|d|j��}|j�|j�|j�|j�|j�y)	NzThis is Tcl/Tk %s�
tk_patchLevelu
This should be a cedilla: ç�r�z	Click me!c�Z�|jjd|jdz��S)Nz[%s]r�r)�testrr�s r
�<lambda>z_test.<locals>.<lambda>7s)���	�	�(;�(;���	�	�&� 1�1�)<�)3r)r�r��QUIT)r�rrvrr�rr�r�r)r�r^)r�r�rxrr�s     r
�_testr0s���
�4�D���!2�!2�?�!C�C�D��.�.�D��$�T�"�E�	�J�J�L��$�[�"&�3�4�D�	�I�I�K��D�I��$�V�T�\�\�:�D��I�I�K�	�L�L�N��K�K�M��N�N���M�M�Orr�>r�__main__)TNrrk)NNr�F)gr��collections�enumr�rhr8r��tkinter.constantsrXrr�floatr)�	TkVersionr*�
TclVersion�READABLE�WRITABLE�	EXCEPTION�compiler�ASCIIrrr
r"r*r4rB�
namedtuplerDr^�_simple_enum�StrEnumr`r�r�r�r�r�r�r�r�r�rr�rGrNrTrXr^r[rQrRr	rarr|r�r�r�rArrLrNr]rfrpr~r�r�r�r:r5rLrsrvrzr�r�r�r�r�r�rr�r�r�r�r�rerir�r�r�r�globalsr-r�r�
ModuleType�__all__rP)r��objs00r
�<module>r3s@���@��
��������	���	���(�%�%�&�	�
�8�'�'�
(�
������������	�
�B�J�J�{�#�	��B�J�J�y�"�(�(�+�	�,�
�8��!�!�X��$�#�#�Y��.S�-�{�-�-�.@�=�?�S�G�����4�<�<� �'�'�!�'�TO
�O
�d���
��	��"�	�
���q+�q+�h���02�X�2�2E��E�*A��A�<:�


���	�=�A�A�D(,�,�,?�?�*?�?�*m�m�`	p&��r�p&�f!$�
�
��,6�+,�+,�\0.�0.�f4,�4,�n>4��>4�B	�Z��u�d�	�8�z�2�8�<,/�V�,/�^q>�V�U�E�q>�h	��.(�&�.(�bS�F�E�S�l?�F�?�(8�F�8�0q�f�e�U�q�h~*�6�~*�B=��=�:�f�:�(�&�(�B$7�F�$7�N/2��/2�dT>�6�5�%�T>�n1�1�$��$�N;7�;7�|QF��QF�h@�%�@�3�
3�
m$�f�e�m$�d=��=�0}A�&�}A�D�*")����!2�,�!2�I�D�#��/�/�#�&�z�#�u�?O�?O�/P��?�*��!2�,���z��	�G���EO��t���,��t���PN,s*�0M2�?M>�,4N
�2M;�:M;�>N�N__pycache__/__init__.cpython-312.opt-2.pyc000064400000532371151710635150014175 0ustar00�

T��hp����	ddlZddlZddlZddlZddlZej
Zddl�ddlZdZdZ	e
ej�Ze
ej�ZejZej Zej"Zej$d�Zej$dej(�Zd�Zd�Zd	�Zej0Zd
�Zej4Zdtd�ZGd
�dej8dd��Zd�Zej>ej@�Gd�d��Z!Gd�d�Z"da#da$d�Z%dud�Z&d�Z'd�Z(d�Z)dvd�Z*da+Gd�d�Z,Gd�de,�Z-Gd�d e,�Z.Gd!�d"e,�Z/Gd#�d$e,�Z0dvd%�Z1e2Z3e
Z4d&�Z5Gd'�d(�Z6Gd)�d*�Z7Gd+�d,�Z8Gd-�d.�Z9Gd/�d0�Z:Gd1�d2e6e:�Z;ejxd3�d4�Z=dwd5�Z>Gd6�d7�Z?Gd8�d9�Z@Gd:�d;�ZAGd<�d=e6�ZBGd>�d?eBe?e@eA�ZCGd@�dAeBe:�ZDGdB�dCeC�ZEGdD�dEeCe8e9�ZFdaGGdF�dGeC�ZHGdH�dIeCe8�ZIGdJ�dKeC�ZJGdL�dMeC�ZKGdN�dOeCe8e9�ZLGdP�dQeC�ZMGdR�dSeC�ZNGdT�dUeC�ZOGdV�dWeC�ZPGdX�dYeC�ZQGdZ�d[eC�ZRGd\�d]eCe8e9�ZSGd^�d_�ZTGd`�daeN�ZUGdb�dc�ZVGdd�deeV�ZWGdf�dgeV�ZXdh�ZYdi�ZZGdj�dkeCe8�Z[Gdl�dmeC�Z\Gdn�doeC�Z]dp�Z^e_�j��D��cgc]/\}}|j�dq�seb|ej��s|drvr|��1c}}Zdeedsk(re^�yy#e$rY���wxYw#e$rY���wxYwcc}}w)x�N)�*�Fz([\\{}])z([\s])c�B�	djtt|��S)N� )�join�map�
_stringify��values �)/usr/lib64/python3.12/tkinter/__init__.py�_joinr
:s����8�8�C�
�E�*�+�+�c�(�	t|ttf�rHt|�dk(r*t	|d�}t
j
|�rd|z}|Sdt|�z}|St|t�r
t|d�}nt|�}|sd}|St
j
|�rMt
jd|�}|jdd�}tjd|�}|dd	k(rd
|z}|S|dd	k(stj
|�rd|z}|S)Nrrz{%s}�latin1z{}z\\\1�
z\n�"�\)
�
isinstance�list�tuple�lenr	�	_magic_re�searchr
�bytes�str�sub�replace�	_space_rer
s rr	r	?s����%�$���'��u�:��?��u�Q�x�(�E�����&�����&�L�#�U�5�\�)�E�"�L��e�U�#���x�(�E���J�E���E��L��
�
�e�
$��M�M�'�5�1�E��M�M�$��.�E��M�M�'�5�1�E��Q�x�3���u����L��1�X��_�	� 0� 0�� 7��U�N�E��Lrc�v�	d}|D]0}t|ttf�r|t|�z}�(|��+||fz}�2|S)N�)rrr�_flatten)�seq�res�items   rr!r![sH���
�C����d�U�D�M�*�����&�C�
�
����-�C�	�
�Jrc�8�	t|t�r|St|td�tf�r|Si}t	|�D]}	|j|��|S#ttf$r3}td|�|j�D]
\}}|||<�Yd}~�Vd}~wwxYw)Nz_cnfmerge: fallback due to:)
r�dict�typerr!�update�AttributeError�	TypeError�print�items)�cnfs�cnf�c�msg�k�vs      r�	_cnfmerger3js�����$�����	�D�4��:�s�+�	,������$��A�
��
�
�1�
� ��
��	#�I�.�
��3�S�9��G�G�I�D�A�q��C��F�&��
�s�A�B�&)B�BTc���	|j|�}t|�dzrtd��t|�}i}t	||�D].\}}t|�}|r
|ddk(r|dd}|r||�}|||<�0|S)N�zNTcl list representing a dict is expected to contain an even number of elementsr�-r)�	splitlistr�RuntimeError�iter�zipr)	�tkr2�	cut_minus�conv�t�itr&�keyrs	         r�
_splitdictrA�s����	���Q��A�
�1�v��z��C�D�	D�	
�a��B�
�D��"�b�k�
��U��#�h����Q��3���a�b�'�C����K�E���S�	�
"��Krc��eZdZd�Zy)�_VersionInfoTypec���|jdk(r(|j�d|j�d|j��S|j�d|j�|jd�|j��S)N�final�.r)�releaselevel�major�minor�micro�serial��selfs r�__str__z_VersionInfoType.__str__�sd������'��j�j�\��4�:�:�,�a��
�
�|�<�<��j�j�\��4�:�:�,�t�/@�/@��/C�.D�T�[�[�M�R�RrN)�__name__�
__module__�__qualname__rNr rrrCrC�s��SrrC)rHrIrJrGrKc���ddl}|jd|�}|j�\}}}}t|�t|�t|�}}}|dk(r|}d}d}n
d}ddd�|}t	|||||�S)Nrz(\d+)\.(\d+)([ab.])(\d+)rFrE�alpha�beta)�a�b)�re�	fullmatch�groups�intrC)�versionrW�mrHrIrGrKrJs        r�_parse_versionr]�s���
�����0�'�:�A�)*����&�E�5�,���u�:�s�5�z�3�v�;�&�5�E��s����������$�6�2�<�@���E�5�%��v�F�Frc��eZdZdZeZdZdZeZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)y&)'�	EventType�2�3�4�5�6�7�8�9�10�11�12�13�14�15�16�17�18�19�20�21�22�23�24�25�26�27�28�29�30�31�32�33�34�35�36�37�38N)*rOrPrQ�KeyPress�Key�
KeyRelease�ButtonPress�Button�
ButtonRelease�Motion�Enter�Leave�FocusIn�FocusOut�Keymap�Expose�GraphicsExpose�NoExpose�
Visibility�Create�Destroy�Unmap�Map�
MapRequest�Reparent�	Configure�ConfigureRequest�Gravity�
ResizeRequest�	Circulate�CirculateRequest�Property�SelectionClear�SelectionRequest�	Selection�Colormap�
ClientMessage�Mapping�VirtualEvent�Activate�
Deactivate�
MouseWheelr rrr_r_�s����H�
�C��J��K�
�F��M�
�F��E��E��G��H�
�F�
�F��N��H��J�
�F��G��E�
�C��J��H��I����G��M��I����H��N����I��H��M��G��L��H��J��Jrr_c��eZdZ	d�Zy)�Eventc��	�|jj�D��cic]\}}|dk7s�||��c}}�	|js�	d=n'|jdk7rt|j��	d<t	|dd�s�	d=|j
dk(r�	d=n�t
|j
t�r�|j
}d}g}t|�D]\}}|d|zzs�|j|��!|dt|�zdz
z}|s|s|jt|��d	j|��	d<|jdk(r�	d
=d}dt	|jd
|j��ddj�	fd�|D���d�Scc}}w)Nz??�char�
send_eventTr�state)
�Shift�Lock�Control�Mod1�Mod2�Mod3�Mod4�Mod5�Button1�Button2�Button3�Button4�Button5r�|�delta)r�r��keysym�keycoder��numr��focus�x�y�width�height�<�namez event�c3�>�K�|]}|�vs�d|�d�|�����y�w)r�=Nr )�.0r1�attrss  �r�	<genexpr>z!Event.__repr__.<locals>.<genexpr>'s!�����I�d��a�5�j��5��8�,�d�s�	��>)�__dict__r,r��repr�getattrr�rrZ�	enumerate�appendr�hexrr�r')
rMr1r2r��mods�s�i�n�keysr�s
         @r�__repr__zEvent.__repr__sh���"&�-�-�"5�"5�"7�E�"7�$�!�Q�1��9��A��"7�E���y�y��f�
�
�Y�Y�$�
� ����O�E�&�M��t�\�4�0��l�#��:�:��?��g��
��
�
�C�
(��J�J�E�K�D��A�!�$����1��A��F�#��H�H�Q�K�(��q�3�t�9�}��1�2�2�E��A�����U��$� �X�X�a�[�E�'�N��:�:��?��g��
-��

�D�I�I�v�t�y�y�1��G�G�I�d�I�I�
�	
��AFs
�
F�FN)rOrPrQr�r rrr�r��s
��(�T$
rr�c��	dadaby)NF)�_support_default_root�
_default_rootr rr�
NoDefaultRootr�/s���"���M�rc�r�tstd��t�|rtd|�d���t�}tS)N�INo master specified and tkinter is configured to not support default rootz
Too early to z: no default root window)r�r8r��Tk)�what�roots  r�_get_default_rootr�=sE�� ��D�E�	E������t�f�4L�M�N�N��t���rc��tstd��t}|�%dat�}da|j	�d|_|S)Nr�FT)r�r8r�r��withdraw�
_temporary�r�s r�_get_temp_rootr�IsL�� ��D�E�	E��D��|� %���t�� $���
�
������Krc�`�t|dd�r	|j�yy#t$rYywxYw)Nr�F)r��destroy�TclError��masters r�_destroy_temp_rootr�Zs6���v�|�U�+�	��N�N��,���	��	�s�!�	-�-c��	y�Nr )�errs r�_tkerrorr�bs���rc�d�		t|�}t|��#t$r
Yt|��wxYwr�)rZ�
ValueError�
SystemExit)�codes r�_exitr�gs?��L�
��4�y���T�
����
��
�T�
��
�s��	/�/c�r�eZdZ	dZdZdZdd�Zd�Zd�Zd�Z	e	Z
d�Zd�Zd	�Z
d
�Zd�Zd�ZeZd
�Zd�Zd�Zy)�Variabler�Nc���	|�t|t�std��|�td�}|j	�|_|j
|_|r||_n dtt�z|_tdz
a	|�|j|�y|jj|jjdd|j��s|j|j�yy)Nzname must be a stringzcreate variable�PY_VARr�info�exists)rrr*r��_rootr;�_tk�_namer��_varnum�
initialize�
getboolean�call�_default�rMr�rr�s    r�__init__zVariable.__init__|s���	���J�t�S�$9��3�4�4��>�&�'8�9�F��\�\�^��
��9�9�����D�J�!�D��M�1�D�J��q�L�G����O�O�E�"����$�$�T�X�X�]�]�6�8�T�Z�Z�%P�Q��O�O�D�M�M�*�Rrc�j�	|j�y|jj|jjdd|j��r%|jj	|j�|j
�4|j
D]}|jj
|��d|_yy)Nrr)rrrr�globalunsetvar�_tclCommands�
deletecommand�rMr�s  r�__del__zVariable.__del__�s���(��8�8����8�8���t�x�x�}�}�V�X�t�z�z�J�K��H�H�#�#�D�J�J�/����(��)�)�����&�&�t�,�*� $�D��)rc��	|jSr�)rrLs rrNzVariable.__str__�s��5��z�z�rc�P�	|jj|j|�Sr�)r�globalsetvarr�rMrs  r�setzVariable.set�s ��(��x�x�$�$�T�Z�Z��7�7rc�N�	|jj|j�Sr�)r�globalgetvarrrLs r�getzVariable.get�s��'��x�x�$�$�T�Z�Z�0�0rc�z�t|d|j�j}tt	|��}	|j
}	||jz}|jj||�|j�g|_
|jj|�|S#t$rY�gwxYw#t$rY�fwxYwr�)�CallWrapperr�__call__r��id�__func__r)rOr�
createcommandrr�)rM�callback�f�cbnames    r�	_registerzVariable._register�s�����$��
�
�3�<�<���b��e���	��(�(�H�	��h�/�/�/�F�	
�����v�q�)����$� "�D����� � ��(��
���	��	���	��	�s#�B�B.�	B+�*B+�.	B:�9B:c��	|j|�}|jjddd|j||f�|S)N�trace�add�variable�r#rrr�rM�moder r"s    r�	trace_addzVariable.trace_add�s?��	�����)�����
�
�g�u�j��j�j�$��	�	3��
rc�\�	|jjddd|j||�|j�D](\}}|jj	|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)Nr%�remover'r)	rrr�
trace_infor7rrr-r��rMr*r"r\�cas     r�trace_removezVariable.trace_remove�s���	�	
���
�
�g�x���j�j�$��	0��_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s�B�	B+�*B+c���	|jj}t|||jjddd|j���D��cgc]\}}||�|f��c}}Scc}}w)Nr%rr')rr7rrr)rMr7r1r2s    rr.zVariable.trace_info�st��4��H�H�&�&�	�.1�)��d�h�h�m�m�G�V�Z����L�M�/O�P�/O�d�a���1��q�!�/O�P�	P��Ps�A+c�|�	|j|�}|jjdd|j||�|S)Nr%r'r(r)s    r�trace_variablezVariable.trace_variable�s8��
	�����)�����
�
�g�z�4�:�:�t�V�D��
rc��	|jjdd|j||�|jj|�d}|j	�D](\}}|jj|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)Nr%�vdeleter)	rrrr7r.rrr-r�r/s     r�
trace_vdeletezVariable.trace_vdelete�s���	�	
���
�
�g�y�$�*�*�d�F�C����#�#�F�+�A�.���_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s� B<�<	C�Cc���	|jj|jjdd|j��D�cgc]}|jj|���c}Scc}w)Nr%�vinfo)rr7rr�rMr�s  r�trace_vinfozVariable.trace_vinfose��	�04�x�x�/A�/A��H�H�M�M�'�7�D�J�J�7�09�:�09�!����"�"�1�%�09�:�	:��:s�"A)c���t|t�stS|j|jk(xrH|jj
|jj
k(xr|j|jk(Sr�)rr��NotImplementedr�	__class__rOr)rM�others  r�__eq__zVariable.__eq__s]���%��*�!�!��
�
�e�k�k�)�*��N�N�+�+�u���/G�/G�G�*��H�H��	�	�)�	+r�NNN)rOrPrQr	rrrrrNrrrr#r+r1r.r4r%r7r;r@r rrr�r�ssi��A��H�
�C��L�+�<	%��8��J�1��"
��&P��"
�E��,:�+rr�c� �eZdZ	dZdd�Zd�Zy)�	StringVarr�Nc�6�	tj||||�yr��r�rr
s    rrzStringVar.__init__+���	�	���$���t�4rc��	|jj|j�}t|t�r|St	|�Sr�)rrrrrrs  rrz
StringVar.get7s6��1����%�%�d�j�j�1���e�S�!��L��5�z�rrA�rOrPrQr	rrr rrrCrC's��-��H�
5�rrCc� �eZdZ	dZdd�Zd�Zy)�IntVarrNc�6�	tj||||�yr�rEr
s    rrzIntVar.__init__CrFrc��	|jj|j�}	|jj|�S#tt
f$r't
|jj|��cYSwxYwr�)rrr�getintr*r�rZ�	getdoublers  rrz
IntVar.getOsc��=����%�%�d�j�j�1��	2��8�8�?�?�5�)�)���8�$�	2��t�x�x�)�)�%�0�1�1�	2�s�A�3A9�8A9rArHr rrrJrJ?s��-��H�
5�2rrJc� �eZdZ	dZdd�Zd�Zy)�	DoubleVargNc�6�	tj||||�yr�rEr
s    rrzDoubleVar.__init__\rFrc��	|jj|jj|j��Sr�)rrNrrrLs rrz
DoubleVar.geths-��:��x�x�!�!�$�(�(�"7�"7��
�
�"C�D�DrrArHr rrrPrPXs��+��H�
5�ErrPc�*�eZdZ	dZdd�Zd�ZeZd�Zy)�
BooleanVarFNc�6�	tj||||�yr�rEr
s    rrzBooleanVar.__init__qrFrc��	|jj|j|jj|��Sr�)rrrrrs  rrzBooleanVar.set}s/��(��x�x�$�$�T�Z�Z����1D�1D�U�1K�L�Lrc��		|jj|jj|j��S#t$rtd��wxYw�N� invalid literal for getboolean())rrrrr�r�rLs rrzBooleanVar.get�sP��9�	A��8�8�&�&�t�x�x�'<�'<�T�Z�Z�'H�I�I���	A��?�@�@�	A�s�=A�ArA)rOrPrQr	rrrrr rrrTrTms"��-��H�
5�M��J�ArrTc�N�	td�jj|�y)Nzrun the main loop)r�r;�mainloop)r�s rr[r[�s��#��)�*�-�-�6�6�q�9rc�~�		td�jj|�S#t$rt	d��wxYw)Nzuse getboolean()rY)r�r;rr�r�)r�s rrr�sB��.�=� �!3�4�7�7�B�B�1�E�E���=��;�<�<�=�s�#'�<c�V�eZdZ	dZdZd�Zd�Zd�d�Zd�Zd�Z	d�d�Z
e
Zd�d�Zd�d	�Z
d�d
�Zd�d�Zd�Zd
�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�d�Zd�Zd�Zd�d�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd�d#�Z(d$�Z)d%�Z*d�d&�Z+d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d�d-�Z2d�d.�Z3e3Z4d/�Z5d�d0�Z6d�d1�Z7d2�Z8d3�Z9d4�Z:d5�Z;d�d6�Z<d7�Z=d8�Z>d9�Z?d:�Z@d;�ZAd<�ZBd�d=�ZCd>�ZDd?�ZEd@�ZFdA�ZGd�dB�ZHdC�ZIdD�ZJdE�ZKdF�ZLdG�ZMdH�ZNdI�ZOdJ�ZPdK�ZQdL�ZRdM�ZSdN�ZTdO�ZUdP�ZVdQ�ZWdR�ZXdS�ZYdT�ZZdU�Z[dV�Z\dW�Z]dX�Z^d�dY�Z_dZ�Z`d[�Zad\�Zbd]�Zcd^�Zdd_�Zed`�Zfda�Zgdb�Zhdc�Zidd�Zjd�de�Zkd�df�Zld�dg�Zmd�dh�Znd�di�Zod�dj�Zpdk�Zqd�dl�Zrdm�Zsd�dn�Ztdo�Zudp�Zvdq�Zwdr�Zxds�Zyezdt��Z{d�du�Z|dv�Z}e}Z~d�dw�ZeZ�dx�Z�dyZ�dz�je��Z�d{�Z�d|�Z�d}�Z�d~�Z�d�Z�d�d��Z�e�Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d�gZ�e�fd��Z�e�Z�d��Z�e�Z�d��Z�d�d��Z�e�Z�d�d��Z�e�Z�d��Z�d��Z�ifd��Z�e�Z�d��Z�e�fd��Z�ifd��Z�e�Z�d��Z�e�Z�d�d��Z�d��Z�d��Z�d��Z�d�d��Z�d��Z�d��Z�y)��MiscNc��	|j�4|jD]}|jj|��d|_yyr�)rr;rrs  rr�zMisc.destroy�sD��	/����(��)�)�����%�%�d�+�*� $�D��)rc��	|jj|�	|jj|�y#t$rYywxYwr�)r;rrr-r�rs  rrzMisc.deletecommand�sF��	4�	
�����d�#�	����$�$�T�*���	��	�s�:�	A�Ac�p�	|jj|jjdd|��S)Nr�tk_strictMotif)r;rr�rM�booleans  rrbzMisc.tk_strictMotif�s7��	"��w�w�!�!�$�'�'�,�,��#�W�#.�/�	/rc�<�	|jjd�y)N�	tk_bisque�r;rrLs rrfzMisc.tk_bisque�s��R������[�!rc	��	|jjdt|�ztt|j	���z�y)N)�
tk_setPalette)r;rr!rr,�rM�args�kws   rrizMisc.tk_setPalette�s@��		>�	
�����'�����!)�$�r�x�x�z�*:�!;�<�	=rc�@�	|jjdd|�y)N�tkwaitr'rgrs  r�
wait_variablezMisc.wait_variable�s��	%�	
�����X�z�4�0rc�\�	|�|}|jjdd|j�y)Nrn�window�r;r�_w�rMrqs  r�wait_windowzMisc.wait_window�s+��	2��>��F������X�x����3rc�\�	|�|}|jjdd|j�y)Nrn�
visibilityrrrts  r�wait_visibilityzMisc.wait_visibility�s+��	2��>��F������X�|�V�Y�Y�7rc�>�	|jj||�yr�)r;�setvar)rMr�rs   rrzzMisc.setvar�s��-������t�U�#rc�:�	|jj|�Sr�)r;�getvarrs  rr|zMisc.getvar�s��0��w�w�~�~�d�#�#rc��	|jj|�S#t$r}tt	|���d}~wwxYwr�)r;rMr�r�r�rMr��excs   rrMzMisc.getint�s9��	'��7�7�>�>�!�$�$���	'��S��X�&�&��	'����	?�:�?c��	|jj|�S#t$r}tt	|���d}~wwxYwr�)r;rNr�r�rr~s   rrNzMisc.getdoubles;��	'��7�7�$�$�Q�'�'���	'��S��X�&�&��	'�r�c�l�		|jj|�S#t$rtd��wxYwrX)r;rr�r�)rMr�s  rrzMisc.getbooleans=��^�	A��7�7�%�%�a�(�(���	A��?�@�@�	A�s��3c�R�	|jjd|j�y�Nr�rrrLs r�	focus_setzMisc.focus_sets��	1�
	
�����W�d�g�g�&rc�T�	|jjdd|j�y)Nr�z-forcerrrLs r�focus_forcezMisc.focus_forces!��	�	
�����W�h����0rc�l�	|jjd�}|dk(s|sy|j|�S)Nr��none)r;r�
_nametowidgetrs  r�	focus_getzMisc.focus_gets7��	��w�w�|�|�G�$���6�>��d��!�!�$�'�'rc��	|jjdd|j�}|dk(s|sy|j|�S)Nr��
-displayofr��r;rrsr�rs  r�focus_displayofzMisc.focus_displayof(s@��	C��w�w�|�|�G�\�4�7�7�;���6�>��d��!�!�$�'�'rc��	|jjdd|j�}|dk(s|sy|j|�S)Nr�z-lastforr�r�rs  r�
focus_lastforzMisc.focus_lastfor1s>��	C��w�w�|�|�G�Z����9���6�>��d��!�!�$�'�'rc�<�	|jjd�y)N�tk_focusFollowsMousergrLs rr�zMisc.tk_focusFollowsMouse8s��	������+�,rc�x�	|jjd|j�}|sy|j|�S)N�tk_focusNextr�rs  rr�zMisc.tk_focusNext=s7��	��w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�x�	|jjd|j�}|sy|j|�S)N�tk_focusPrevr�rs  rr�zMisc.tk_focusPrevJs3��V��w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�,�����	���jjd|�y����fd�}	�j|_�j|���jjd|��S#t$rt	��j|_Y�SwxYw)N�afterc���	���	�j��y#t$rYywxYw#	�j��w#t$rYwwxYwxYwr�)rr�)rk�funcr�rMs����r�callitzMisc.after.<locals>.callit\sY�����$�K���*�*�4�0��#�������*�*�4�0��#����s5�*��	'�'�A
�>�A
�	A
�A
�	A
�
A
)r;rrOr)r'r#)rM�msr�rkr�r�s` `` @rr�z
Misc.afterPs����	>��<��G�G�L�L��"�%��
�
6�"&�-�-����>�>�&�)�D��7�7�<�<���T�2�2��	"�
6�"&�t�*�"5�"5���
6�s�A-�-#B�Bc�,�	|jd|g|���S)N�idle)r�)rMr�rks   r�
after_idlezMisc.after_idlels!��	�
�t�z�z�&�$�.��.�.rc��	|std��	|jjdd|�}|jj|�d}|j	|�|jjdd|�y#t
$rY�)wxYw)Nz?id must be a valid identifier returned from after or after_idler�rr�cancel)r�r;rr7rr�)rMr�data�scripts    r�after_cancelzMisc.after_cancelts���	�
��3�4�
4�	��7�7�<�<����4�D��W�W�&�&�t�,�Q�/�F����v�&�	
�����W�h��+���	��	�s�AA:�:	B�Bc�`�	|jjd|j|�z�y)N)�bell)r;r�
_displayof�rM�	displayofs  rr�z	Misc.bell�s#��$������Y�����!;�;�<rc��	d|vrB|jdk(r3	d|d<|jjd|j|�z�S|jjd|j|�z�S#t$r|d=Y�;wxYw)Nr'�x11�UTF8_STRING)�	clipboardr)�_windowingsystemr;r�_optionsr��rMrls  r�
clipboard_getzMisc.clipboard_get�s���
	����� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1A5�5B�Bc��	d|vr|j|d<|jjd|j|�z�y)Nr�)r��clear�rsr;rr�r�s  r�clipboard_clearzMisc.clipboard_clear�s<��	2��b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc��	d|vr|j|d<|jjd|j|�zd|fz�y)Nr�)r�r��--r�)rM�stringrls   r�clipboard_appendzMisc.clipboard_append�sJ��	0�
�b� �D�G�G�"�[�/������,�t�}�}�R�/@�@��v���	 rc�z�	|jjdd|j�}|sy|j|�S)N�grab�currentr�rs  r�grab_currentzMisc.grab_current�s7��	��w�w�|�|�F�I�t�w�w�7���D��!�!�$�'�'rc�T�	|jjdd|j�y)Nr��releaserrrLs r�grab_releasezMisc.grab_release�s��<������V�Y����0rc�T�	|jjdd|j�y)Nr�rrrrLs r�grab_setz
Misc.grab_set�s!��	'�	
�����V�U�D�G�G�,rc�V�	|jjddd|j�y)Nr�rz-globalrrrLs r�grab_set_globalzMisc.grab_set_global�s#��	9�
	
�����V�U�I�t�w�w�7rc�d�	|jjdd|j�}|dk(rd}|S)Nr��statusr�rr)rMr�s  r�grab_statuszMisc.grab_status�s2��	)������f�h����8���V��d�V��
rc�D�	|jjdd|||�y)N�optionr&rg)rM�patternr�prioritys    r�
option_addzMisc.option_add�s!��	�
	
�����X�u�g�u�h�?rc�>�	|jjdd�y)Nr�r�rgrLs r�option_clearzMisc.option_clear�s��	8�	
�����X�w�'rc�V�	|jjdd|j||�S)Nr�rrr)rMr��	classNames   r�
option_getzMisc.option_get�s(��	>��w�w�|�|�H�e�T�W�W�d�I�F�Frc�B�	|jjdd||�y)Nr��readfilerg)rM�fileNamer�s   r�option_readfilezMisc.option_readfile�s��	�	
�����X�z�8�X�>rc��	d|vr|j|d<|jjd|j|�z�y)Nr�)�	selectionr�r�r�s  r�selection_clearzMisc.selection_clear�s8��,��b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc�4�	d|vr|j|d<d|vrB|jdk(r3	d|d<|jjd|j	|�z�S|jjd|j	|�z�S#t
$r|d=Y�;wxYw)Nr�r'r�r�)r�r)rsr�r;rr�r�r�s  r�
selection_getzMisc.selection_get�s���	��b� �D�G�G�"�[�/����� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1B�B�Bc��	|j|�}|jjd|j|�z|j|fz�y)N)r��handle)r#r;rr�rs)rM�commandrlr�s    r�selection_handlezMisc.selection_handlesI��
	B��~�~�g�&�������,�t�}�}�R�/@�@����$�� �	!rc�|�	|jjd|j|�z|jfz�y)N�r��own)r;rr�rsr�s  r�
selection_ownzMisc.selection_owns;��	,�	
�����)����r�"�#�&*�g�g�Z�0�	1rc��	d|vr|j|d<|jjd|j|�z�}|sy|j	|�S)Nr�r�)rsr;rr�r�)rMrlr�s   r�selection_own_getzMisc.selection_own_get sU��	B��b� �D�G�G�"�[�/��w�w�|�|�0�4�=�=��3D�D�E���D��!�!�$�'�'rc�F�	|jjd||f|z�S)N�sendrg)rM�interp�cmdrks    rr�z	Misc.send,s$��R��w�w�|�|�V�V�S�1�D�8�9�9rc�T�	|jjd|j|�y�N�lowerrr)rM�	belowThiss  rr�z
Misc.lower0���6������W�d�g�g�y�1rc�T�	|jjd|j|�y�N�raiserr)rM�	aboveThiss  r�tkraisezMisc.tkraise4r�rc�R�	|jjdd�}t|�S)Nr�
patchlevel)r;rr])rMr�s  r�info_patchlevelzMisc.info_patchlevel:s$��;��W�W�\�\�&�,�7�
��j�)�)rc��	d|j|�z|fz}|jj|jj|��S)N)�winfo�atom)r�r;rMr)rMr�r�rks    r�
winfo_atomzMisc.winfo_atom?s?��8� �4�?�?�9�#=�=���G���w�w�~�~�d�g�g�l�l�4�0�1�1rc�j�	d|j|�z|fz}|jj|�S)N)r��atomname)r�r;r�rMrr�rks    r�winfo_atomnamezMisc.winfo_atomnameDs8��5�$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��	|jj|jjdd|j��S)Nr��cells�r;rMrrsrLs r�winfo_cellszMisc.winfo_cellsJs2��E��w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc��	g}|jj|jjdd|j��D]#}	|j	|j|���%|S#t$rY�3wxYw)Nr��children)r;r7rrsr�r��KeyError)rM�result�childs   r�winfo_childrenzMisc.winfo_childrenOst��M����W�W�&�&��G�G�L�L��*�d�g�g�6�8�E�
��
�
�d�0�0��7�8�8��
���
��
�s� A,�,	A8�7A8c�R�	|jjdd|j�S)Nr��classrrrLs r�winfo_classzMisc.winfo_class\s ��6��w�w�|�|�G�W�d�g�g�6�6rc��	|jj|jjdd|j��S)Nr��colormapfull�r;rrrsrLs r�winfo_colormapfullzMisc.winfo_colormapfull`s4��M��w�w�!�!��G�G�L�L��.�$�'�'�:�<�	<rc��	d|j|�z||fz}|jj|�}|sy|j|�S)N)r��
containing)r�r;rr�)rM�rootX�rootYr�rkr�s      r�winfo_containingzMisc.winfo_containingesO��N�&�����+�,�/4�e�n�=���w�w�|�|�D�!���D��!�!�$�'�'rc��	|jj|jjdd|j��S)Nr��depthrrLs r�winfo_depthzMisc.winfo_depthms-��2��w�w�~�~�d�g�g�l�l�7�G�T�W�W�E�F�Frc��	|jj|jjdd|j��S)Nr�rrrLs r�winfo_existszMisc.winfo_existsqs2��0��w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��	|jj|jjdd|j|��S)Nr��fpixels�r;rNrrs�rM�numbers  r�
winfo_fpixelszMisc.winfo_fpixelsvs:��	!��w�w� � �������Y�����"1�2�	2rc�R�	|jjdd|j�S)Nr��geometryrrrLs r�winfo_geometryzMisc.winfo_geometry|s ��T��w�w�|�|�G�Z����9�9rc��	|jj|jjdd|j��S)Nr�r�rrLs r�winfo_heightzMisc.winfo_height�s2��+��w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc�f�	t|jjdd|j�d�S)Nr�rr)rZr;rrsrLs r�winfo_idz
Misc.winfo_id�s'��3��4�7�7�<�<���t�w�w�7��;�;rc��	d|j|�z}|jj|jj|��S)N)r��interps)r�r;r7r)rMr�rks   r�
winfo_interpszMisc.winfo_interps�s:��G�#�d�o�o�i�&@�@���w�w� � ������d�!3�4�4rc��	|jj|jjdd|j��S)Nr��ismappedrrLs r�winfo_ismappedzMisc.winfo_ismapped�s2��3��w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�R�	|jjdd|j�S)Nr��managerrrrLs r�
winfo_managerzMisc.winfo_manager�s ��=��w�w�|�|�G�Y����8�8rc�R�	|jjdd|j�S)Nr�r�rrrLs r�
winfo_namezMisc.winfo_name�s ��-��w�w�|�|�G�V�T�W�W�5�5rc�R�	|jjdd|j�S)Nr��parentrrrLs r�winfo_parentzMisc.winfo_parent�s ��;��w�w�|�|�G�X�t�w�w�7�7rc��	t|t�rt|�}d|j|�z|fz}|jj|�S)N)r��pathname)rrZr�r�r;rr�s    r�winfo_pathnamezMisc.winfo_pathname�sK��<��b�#���R��B�$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��	|jj|jjdd|j|��S)Nr��pixelsrrs  r�winfo_pixelszMisc.winfo_pixels�s4��5��w�w�~�~��G�G�L�L��(�D�G�G�V�<�>�	>rc��	|jj|jjdd|j��S)Nr��pointerxrrLs r�winfo_pointerxzMisc.winfo_pointerx��2��H��w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�p�	|j|jjdd|j��S)Nr��	pointerxy��_getintsr;rrsrLs r�winfo_pointerxyzMisc.winfo_pointerxy�s.��V��}�}��G�G�L�L��+�t�w�w�7�9�	9rc��	|jj|jjdd|j��S)Nr��pointeryrrLs r�winfo_pointeryzMisc.winfo_pointery�r>rc��	|jj|jjdd|j��S)Nr��	reqheightrrLs r�winfo_reqheightzMisc.winfo_reqheight�s2��5��w�w�~�~��G�G�L�L��+�t�w�w�7�9�	9rc��	|jj|jjdd|j��S)Nr��reqwidthrrLs r�winfo_reqwidthzMisc.winfo_reqwidth�s2��4��w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�r�	|j|jjdd|j|��S)Nr��rgbrA)rM�colors  r�	winfo_rgbzMisc.winfo_rgb�s0��\��}�}��G�G�L�L��%����%�8�:�	:rc��	|jj|jjdd|j��S)Nr��rootxrrLs r�winfo_rootxzMisc.winfo_rootx��4��	��w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc��	|jj|jjdd|j��S)Nr��rootyrrLs r�winfo_rootyzMisc.winfo_rooty�rTrc�R�	|jjdd|j�S)Nr��screenrrrLs r�winfo_screenzMisc.winfo_screen�s ��4��w�w�|�|�G�X�t�w�w�7�7rc��	|jj|jjdd|j��S)Nr��screencellsrrLs r�winfo_screencellszMisc.winfo_screencells�s4��	��w�w�~�~��G�G�L�L��-����9�;�	;rc��	|jj|jjdd|j��S)Nr��screendepthrrLs r�winfo_screendepthzMisc.winfo_screendepth�s4��	"��w�w�~�~��G�G�L�L��-����9�;�	;rc��	|jj|jjdd|j��S)Nr��screenheightrrLs r�winfo_screenheightzMisc.winfo_screenheight�s4��	��w�w�~�~��G�G�L�L��.�$�'�'�:�<�	<rc��	|jj|jjdd|j��S)Nr��screenmmheightrrLs r�winfo_screenmmheightzMisc.winfo_screenmmheight�s5��	��w�w�~�~��G�G�L�L��"2�D�G�G�<�>�	>rc��	|jj|jjdd|j��S)Nr��
screenmmwidthrrLs r�winfo_screenmmwidthzMisc.winfo_screenmmwidth�s4��	��w�w�~�~��G�G�L�L��/�4�7�7�;�=�	=rc�R�	|jjdd|j�S)Nr��screenvisualrrrLs r�winfo_screenvisualzMisc.winfo_screenvisual�s$��	&��w�w�|�|�G�^�T�W�W�=�=rc��	|jj|jjdd|j��S)Nr��screenwidthrrLs r�winfo_screenwidthzMisc.winfo_screenwidth�s4��	!��w�w�~�~��G�G�L�L��-����9�;�	;rc�R�	|jjdd|j�S)Nr��serverrrrLs r�winfo_serverzMisc.winfo_servers"��	9��w�w�|�|�G�X�t�w�w�7�7rc�p�	|j|jjdd|j��S)Nr��toplevel)r�r;rrsrLs r�winfo_toplevelzMisc.winfo_toplevel	s2��8��!�!�$�'�'�,�,��Z����#*�+�	+rc��	|jj|jjdd|j��S)Nr��viewablerrLs r�winfo_viewablezMisc.winfo_viewables2��P��w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�R�	|jjdd|j�S)Nr��visualrrrLs r�winfo_visualzMisc.winfo_visuals$��	&��w�w�|�|�G�X�t�w�w�7�7rc�R�	|jjdd|j�S)Nr��visualidrrrLs r�winfo_visualidzMisc.winfo_visualids ��E��w�w�|�|�G�Z����9�9rc�0�	|jjdd|j|rdnd�}|jj|�D�cgc]}|jj|���}}|D�cgc]}|j	|���c}Scc}wcc}w)Nr��visualsavailable�
includeids)r;rrsr7�_Misc__winfo_parseitem)rMr�r�r�s    r�winfo_visualsavailablezMisc.winfo_visualsavailables���	K�
�w�w�|�|�G�%7����,6�L�D�B��.2�g�g�.?�.?��.E�F�.E�����!�!�!�$�.E��F�37�8�4�a��&�&�q�)�4�8�8��G��8s�"B�3Bc	�T�	|ddtt|j|dd��zS�Nr)rr�_Misc__winfo_getint)rMr>s  r�__winfo_parseitemzMisc.__winfo_parseitem(s.�� ���!�u�u�S��!4�!4�a���e�<�=�=�=rc��	t|d�S)Nr)rZr:s  r�__winfo_getintzMisc.__winfo_getint,s�� ��1�a�y�rc��	|jj|jjdd|j��S)Nr��vrootheightrrLs r�winfo_vrootheightzMisc.winfo_vrootheight0s6��	!��w�w�~�~��G�G�L�L��-����9�;�	;rc��	|jj|jjdd|j��S)Nr��
vrootwidthrrLs r�winfo_vrootwidthzMisc.winfo_vrootwidth7s6��	 ��w�w�~�~��G�G�L�L��,����8�:�	:rc��	|jj|jjdd|j��S)Nr��vrootxrrLs r�winfo_vrootxzMisc.winfo_vrootx>�4��	0��w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��	|jj|jjdd|j��S)Nr��vrootyrrLs r�winfo_vrootyzMisc.winfo_vrootyDr�rc��	|jj|jjdd|j��S)Nr�r�rrLs r�winfo_widthzMisc.winfo_widthJs2��.��w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc��	|jj|jjdd|j��S)Nr�r�rrLs r�winfo_xzMisc.winfo_xO�4��	��w�w�~�~��G�G�L�L��#�t�w�w�/�1�	1rc��	|jj|jjdd|j��S)Nr�r�rrLs r�winfo_yzMisc.winfo_yUr�rc�<�	|jjd�y)Nr(rgrLs rr(zMisc.update[s��S������X�rc�>�	|jjdd�y)Nr(�	idletasksrgrLs r�update_idletaskszMisc.update_idletasks_s��	�	
�����X�{�+rc���	|�?|jj|jjd|j��S|jjd|j|�y)N�bindtags�r;r7rrs)rM�tagLists  rr�z
Misc.bindtagsesU��	!��?��7�7�$�$������Z����1�3�
3�
�G�G�L�L��T�W�W�g�6rc���	t|t�r!|jj|||fz�y|r\|j	||j
|�}|xrdxsd�d|�d|j�d�}|jj|||fz�|S|r|jj||fz�S|jj|jj|��S)N�+r��if {"[rz]" == "break"} break
)rrr;rr#�_substitute�_subst_format_strr7)rMr��sequencer�r&�needcleanup�funcidr�s        r�_bindz
Misc._bindrs��� ��d�C� ��G�G�L�L���4� 0�0�1�
��^�^�D�$�*:�*:�#�%�F��K�C�%�2�%���.�.�0�C�
�G�G�L�L���3��/�0��M�
��7�7�<�<���{� 2�3�3��7�7�$�$�T�W�W�\�\�$�%7�8�8rc�D�	|jd|jf|||�S�N�bind�r�rs�rMr�r�r&s    rr�z	Misc.bind�s(��$	)�L�z�z�6�4�7�7�+�X�t�S�A�Arc�D�	|jd|j|f|�yr���_unbindrs)rMr�r�s   r�unbindzMisc.unbind�s"��	�	
���f�d�g�g�x�0�&�9rc�^��|�|jjg|�d���y|jj|�jd�}d|�d��dj�fd�|D��}|j	�sd}|jjg|�|���|j|�y)Nr�rr�rc3�D�K�|]}|j��s|���y�wr�)�
startswith)r��line�prefixs  �rr�zMisc._unbind.<locals>.<genexpr>�s#�����=�e�d�$(�O�O�F�$;�"�e�s� )r;r�splitr�stripr)rMr�r��lines�keepr�s     @rr�zMisc._unbind�s�����>��D�G�G�L�L�#�$�#��#��G�G�L�L��&�,�,�T�2�E��v�h�a�(�F��9�9�=�e�=�=�D��:�:�<����D�G�G�L�L�%�$�%��%����v�&rc�J�	|j�jd|||d�S)N)r��allT�rr�r�s    r�bind_allz
Misc.bind_all�s)��	Q��z�z�|�!�!�/�8�T�3��M�Mrc�J�	|j�jdd|f�y)Nr�r��rr�)rMr�s  r�
unbind_allzMisc.unbind_all�s ��F��
�
����f�e�X�6�7rc�N�	|j�jd|f|||d�S)Nr�Tr�)rMr�r�r�r&s     r�
bind_classzMisc.bind_class�s-��	��z�z�|�!�!�6�9�"5�x��s�D�Q�Qrc�J�	|j�jd||f�yr�r�)rMr�r�s   r�unbind_classzMisc.unbind_class�s"��	��
�
����f�i��:�;rc�<�	|jj|�yr�)r;r[)rMr�s  rr[z
Misc.mainloop�s��&�������rc�:�	|jj�yr�)r;�quitrLs rr�z	Misc.quit�s��F������rc��	|rBtt|jj|jj	|���Syr�)rrr;rMr7�rMr�s  rrBz
Misc._getints�s6�� ����T�W�W�^�^�T�W�W�->�->�v�-F�G�H�H�rc��	|rBtt|jj|jj	|���Syr�)rrr;rNr7r�s  r�_getdoubleszMisc._getdoubles�s8�� ����T�W�W�.�.����0A�0A�&�0I�J�K�K�rc�@�	|r|jj|�Syr�)r;rr�s  r�_getbooleanzMisc._getboolean�s"�� ���7�7�%�%�f�-�-�rc�2�	|rd|fS|�d|jfSy)Nr�r �rsr�s  rr�zMisc._displayof�s+�� �� �)�,�,��� �$�'�'�*�*�rc��		|j�jS#t$r6|jj	dd�x}|j�_|cYSwxYw)Nr;�windowingsystem)r�_windowingsystem_cachedr)r;r)rM�wss  rr�zMisc._windowingsystem�sU�� �	��:�:�<�7�7�7���	������T�+<�=�
>�B�����5��I�	�s��<A�Ac���	|rt||f�}nt|�}d}|j�D]�\}}|��	|ddk(r|dd}t|�r|j|�}n�t	|t
tf�rqg}|D]Y}t	|t�r|jt|���.t	|t�r|jt|���Yndj|�}|d|z|fz}��|S)Nr ����_rr6)r3r,�callabler#rrrrZr�rr	r)rMr.rlr#r1r2�nvr$s        rr�z
Misc._optionss��� �
��S�"�I�&�C��C�.�C����I�I�K�D�A�q��}��R�5�C�<�Q�s��V���A�;����q�)�A���E�4�=�1��B� !��%�d�C�0��I�I�c�$�i�0�'��c�2��I�I�j��&6�7�!�
!"� �H�H�R�L���S��U�A�J�&��! �"�
rc��	t|�jd�}|}|ds|j�}|dd}|D]}|s|S|j|}�|S)NrFrr)rr�rr)rMr��wr�s    r�nametowidgetzMisc.nametowidget"sh��	��4�y���s�#�����A�w����	�A����8�D��A������
�
�1�
�A��
�rc�l�	t|||�j}tt|��}	|j}	||jz}|jj||�|r.|j�g|_	|jj|�|S#t
$rY�iwxYw#t
$rY�hwxYwr�)rrr�rrr)rOr;rrr�)rMr��substr�r!r�s      rr#zMisc._register5s���	8�
��e�T�*�3�3���B�q�E�{��	��=�=�D�	��$�-�-�'�D�	
�����d�A�&��� � �(�$&��!����$�$�T�*�����	��	���	��	�s"�B�B'�	B$�#B$�'	B3�2B3c�V�	|}|j�|j}|j��|Sr�r�)rMr�s  rrz
Misc._rootMs*�� ����h�h�"����A�a�h�h�"��r)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%Drc���	t|�t|j�k7r|S|jj}|jj��fd�}|\}}}}}}	}
}}}
}}}}}}}}}t�}�|�|_||�|_||�|_||�|_
||�|_||	�|_||
�|_
||�|_||�|_||
�|_||_||�|_||_||�|_	t+|�|_	|j1|�|_||�|_||�|_	�|�|_|fS#t$rY��wxYw#t$rY��wxYw#t.$r
||_Y�rwxYw#t4$r
||_Y�qwxYw#t.tf$rd|_Y|fSwxYw)Nc�F��		�|�S#ttf$r|cYSwxYwr�)r�r�)r�rMs �r�getint_eventz&Misc._substitute.<locals>.getint_event]s.���Q�
��a�y� ����)�
���
�s�� � r)r�
_subst_formatr;rrMr�rKr�r�r�r�r�r��timer�r�r�r�r�r��
keysym_numr_r'r�r��widgetr�x_root�y_rootr�)rMrkrr��nsignrVr!�hr1r�r>r�r�r��A�E�K�N�W�T�X�Y�D�erMs                        @rr�zMisc._substituteWs���� ��t�9��D�.�.�/�/����W�W�'�'�
�������	�GK�C��q�!�Q��1�a��A�q�!�Q��1�a��A�q�!��G���%�=����Q����!�!�}�Q�W���?��� ��O��	��q�/����a�����q�/����1�o����1�o������&�q�M�Q�\����#�A����	��q�\�A�F�	��)�)�!�,�A�H� ��?�����?���	��Q�i�A�G��t���7����������
�	��A�F�	���	��A�H�	���H�%�	��A�G��t��	�sZ�
E4�
F�"F�3F(�$
F>�4	F�?F�	F�F�F%�$F%�(F;�:F;�>G�Gc�|�	tj�\}}}|j�}|j|||�yr�)�sys�exc_infor�report_callback_exception)rMr�val�tbr�s     r�_report_exceptionzMisc._report_exception�s3�� ��|�|�~���S�"��z�z�|���&�&�s�C��4rc���	i}|jj|jj|��D]5}|jj|�}|dddf|ddz||ddd<�7|S�Nrr�r;r7r)rMrkr.r�s    r�
_getconfigurezMisc._getconfigure�sw��I������"�"�<�4�7�7�<�<��#6�7�A����!�!�!�$�A��q�T�!�"�X�K�!�A�B�%�/�C��!��Q�R��M�8��
rc��|jj|jj|��}|dddf|ddzSrr�rMrkr�s   r�_getconfigure1zMisc._getconfigure1�sB���G�G���l�d�g�g�l�l�D�1�2���!��Q�R��{�Q�q�r�U�"�"rc��	|rt||f�}n
|rt|�}|�&|jt|j|f��St	|t
�r*|j
t|j|d|zf��S|jjt|j|f�|j|�z�y)Nr6)
r3rr!rsrrrr;rr�)rMr�r.rls    r�
_configurezMisc._configure�s��� �
��S�"�I�&�C�
��C�.�C��;��%�%�h�����~�&>�?�?��c�3���&�&�x����#�s�3�w�0G�'H�I�I������X�t�w�w��n�-��
�
�c�0B�B�Crc�*�	|jd||�S)N�	configure�r
�rMr.rls   rrzMisc.configure�s��	����{�C��4�4rc�X�	|jj|jdd|z�S�N�cgetr6rr�rMr@s  rrz	Misc.cget�s$��B��w�w�|�|�D�G�G�V�S�3�Y�7�7rc�*�|j||i�yr�)r�rMr@rs   r�__setitem__zMisc.__setitem__�s������U�|�$rc���	|jj}||jj|jd��D�cgc]}||�ddd��c}Scc}w)Nrrrr�)rMr7r�s   rr�z	Misc.keys�s`��A��G�G�%�%�	��$�'�'�,�,�t�w�w��<�=�?�=�)*�	�!��Q����#�=�?�	?��?s�Ac��	|jSr�r�rLs rrNzMisc.__str__�s��9��w�w�rc�~�d|jj�d|jj�d|j�d�S)Nr�rFz object r�)r>rPrQrsrLs rr�z
Misc.__repr__�s-���N�N�%�%�t�~�~�'B�'B�D�G�G�M�	Mr�_noarg_c���	|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)N�pack�	propagate�r^rr�r;rrs�rM�flags  r�pack_propagatezMisc.pack_propagate��^��	��4�<�<���#�#�D�G�G�L�L���T�W�W�%.�/�
/�
�G�G�L�L���d�g�g�t�<rc���	|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)Nr�slaves�r;r7rrsr�r:s  r�pack_slaveszMisc.pack_slaves�sd��	!����!�!��7�7�<�<���$�'�'�:�<�=�<�+,��"�"�1�%�<�=�	=��=��Ac���	|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)N�placer#r$r:s  r�place_slaveszMisc.place_slaves�sg��	!����!�!��7�7�<�<���$�'�'�3�4�5�4�+,��"�"�1�%�4�5�	5��5r&c�V�	|jjdd|j|�y)N�grid�anchorrr)rMr,s  r�grid_anchorzMisc.grid_anchor�s#��	%�	
�����V�X�t�w�w��7rc��	dd|jf}|�	|�|||fz}|�	|�|||fz}|j|jj|��xsdS)Nr+�bbox)rsrBr;r)rM�column�row�col2�row2rks      r�	grid_bboxzMisc.grid_bboxsm��
	������(����#�/��6�3�-�'�D���� 0��4��,�&�D��}�}�\�T�W�W�\�\�4�0�1�9�T�9rc��t|ttjf�rI	t|�}|syd|vr|jj|�S|jj
|�S|S#ttf$rY|SwxYw)NrF)	rr�_tkinter�Tcl_Objr;rNrMr�r�)rMr�svalues   r�_gridconvvaluezMisc._gridconvvalues���e�c�8�#3�#3�4�5�	
��U������F�]��7�7�,�,�V�4�4��7�7�>�>�&�1�1������)�
����
�s�
A,�A,�A,�,A?�>A?c	��	t|t�r |s|dddk(r|dd}|dddk7rd|z}|f}n|j||�}|sHt|j|jjd||j|�|j��S|jjd||j|f|z�}t|�dk(r|j|�Sy)Nr�r�rr6r+)r=)	rrr�rAr;rrsr9r)rMr��indexr.rl�optionsr#s       r�_grid_configurezMisc._grid_configure's��� ��c�3����2�3�x�3���#�2�h���2�A�w�#�~��#�g���f�G��m�m�C��,�G�����������V�W�d�g�g�u�=��(�(�*�
*��g�g�l�l��7�D�G�G�U�3������w�<�1���&�&�s�+�+�rc�,�	|jd|||�S)N�columnconfigure�r=�rMr;r.rls    r�grid_columnconfigurezMisc.grid_columnconfigure<s!��	9�
�#�#�$5�u�c�2�F�Frc	�|�	|j|jjdd|j||��xsdS)Nr+�locationrA�rMr�r�s   r�
grid_locationzMisc.grid_locationFsA��	��}�}��G�G�L�L��
�D�G�G�Q��
3�4�<�7;�	<rc���	|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)Nr+rrrs  r�grid_propagatezMisc.grid_propagateNr!rc�,�	|jd|||�S)N�rowconfigurer@rAs    r�grid_rowconfigurezMisc.grid_rowconfigure[s ��	9�
�#�#�N�E�3��C�Crc�x�	|j|jjdd|j��xsdS)Nr+�sizerArLs r�	grid_sizezMisc.grid_sizees6��J��}�}��G�G�L�L������1�3�;�6:�	;rc��	d}|�|d|fz}|�|d|fz}|jj|jjdd|jf|z��D�cgc]}|j	|���c}Scc}w)Nr z-rowz-columnr+r#r$)rMr1r0rkr�s     r�grid_slaveszMisc.grid_slavesls���	!����?��6�3�-�'�D����9�f�-�-�D����!�!�$�'�'�,�,��H�d�g�g�.��5�#7�8�9�8�+,��"�"�1�%�8�9�	9��9s�A7c�L�	dd|f|z}|jj|�y)N�eventr&rg�rM�virtual�	sequencesrks    r�	event_addzMisc.event_add{s*��	%����(�9�4�������T�rc�L�	dd|f|z}|jj|�y)NrR�deletergrSs    r�event_deletezMisc.event_delete�s&��;���7�+�i�7�������T�rc��	dd|j|f}|j�D]\}}|d|zt|�fz}�|jj	|�y)NrR�generate�-%s)rsr,rr;r)rMr�rlrkr1r2s      r�event_generatezMisc.event_generate�sV��	&���T�W�W�h�7���H�H�J�D�A�q��5�1�9�c�!�f�-�-�D�������T�rc�p�	|jj|jjdd|��S)NrRrr)rMrTs  r�
event_infozMisc.event_info�s3��	B��w�w� � ��G�G�L�L��&�'�2�4�	4rc�n�	|jj|jjdd��S�N�image�namesrrLs r�image_nameszMisc.image_names�s)��8��w�w� � ������g�w�!?�@�@rc�n�	|jj|jjdd��S)Nrb�typesrrLs r�image_typeszMisc.image_types�s)��M��w�w� � ������g�w�!?�@�@rr�)r�)r��1�r�F)rrAr��NNNN�NN)�rOrPrQ�_last_child_idsrr�rrbrfriro�waitvarrurxrzr|rMrNrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��liftr�r�r�rrrrrrrrr"r$r&r)r,r/r1r4r7r:r=rCrFrIrLrPrSrWrZr]r`rcrfrirlrorrrurxr{r~r�r�r�r�r�r�r�r�r�r�r(r�r�r�r�r�r�r�r�r�r�r[r�rBr�r�r��propertyr�r�r�r�r#�registerrr�rr�r�rrrr
r�configr�__getitem__rr�rNr�rr rr%r#r)r-r,r4r/r9r=rBr?rFrHrKrJrNrMrPrVrYr]r_rdrgr rrr^r^�s���E�
�O��L�%��/�"�=�1��G�4�8�$�$�'�'�A�'�
�E�1�	(�(�(�-�
(�(�3�8/�,�"=�
F�.A� �(�1�-�8��@�(�G�?�A�
F�$!� 1�
(�:�2�2��D�*�
2�
"�5�
�7�<�
(�G�6�
2�:�6�
<�5�
8�
9�6�8�"�>�
8�
9�
8�
9�
8�
:�
5�5�8�;�;�<�>�=�>�;�8�
+�
8�
8�:�	9�>��;�:�6�6�5�
1�1��,�7�9�$'B�R	:�'�N�8�R�<�
��I�
L�
.�
������4�"!�M��,�H��
C�M�����/��;�z5��#�
D�5��F�8��K�%�?��M�
�k�G�")�=��I�=��F�5�8��F�:�&�D��,�*/1�G�+�O�<�#*�=�,.�D�%�L�;�
�D�
9���
�4�A�Arr^c��eZdZ	d�Zd�Zy)rc�0�	||_||_||_yr�)r�r�r�)rMr�r�r�s    rrzCallWrapper.__init__�s��6���	���
���rc��		|jr|j|�}|j|�S#t$r�|jj	�YyxYwr�)r�r�r�r�r�rMrks  rrzCallWrapper.__call__�sT��A�	,��z�z�!�t�z�z�4�(���4�9�9�d�#�#���	��	,��K�K�)�)�+�s	�)-�%AN�rOrPrQrrr rrrr�s��D��	,rrc� �eZdZ	d�Zd�Zd�Zy)�XViewc�|�	|jj|jdg|���}|s|j|�Sy)N�xview�r;rrsr��rMrkr#s   rr|zXView.xview�s=��C��d�g�g�l�l�4�7�7�G�3�d�3����#�#�C�(�(�rc�V�	|jj|jdd|�y)Nr|�movetorr�rM�fractions  r�xview_movetozXView.xview_moveto��"��	@������T�W�W�g�x��:rc�X�	|jj|jdd||�y)Nr|�scrollrr�rMrr�s   r�xview_scrollzXView.xview_scroll�s#��	������T�W�W�g�x���>rN)rOrPrQr|r�r�r rrrzrz�����)�;�
?rrzc� �eZdZ	d�Zd�Zd�Zy)�YViewc�|�	|jj|jdg|���}|s|j|�Sy)N�yviewr}r~s   rr�zYView.yview�s=��A��d�g�g�l�l�4�7�7�G�3�d�3����#�#�C�(�(�rc�V�	|jj|jdd|�y)Nr�r�rrr�s  r�yview_movetozYView.yview_moveto�r�rc�X�	|jj|jdd||�y)Nr�r�rrr�s   r�yview_scrollzYView.yview_scroll�s#��	&������T�W�W�g�x���>rN)rOrPrQr�r�r�r rrr�r��r�rr�c�z�eZdZ			d!d�ZeZd�ZeZd"d�ZeZd�Z	e	Z
d"d�ZeZd�Z
e
Zd"d�ZeZd	�ZeZd
�ZeZd"d�ZeZ		d!d�ZeZd"d
�ZeZd#d�ZeZd�ZeZd"d�ZeZ d"d�Z!e!Z"d$d�Z#e#Z$d#d�Z%e%Z&d"d�Z'e'Z(d�Z)e)Z*d#d�Z+e+Z,d#d�Z-e-Z.d"d�Z/e/Z0d"d�Z1e1Z2d#d�Z3e3Z4d#d�Z5e5Z6d"d�Z7e7Z8d"d�Z9e9Z:d"d�Z;e;Z<d"d�Z=e=Z>d �Z?e?Z@y)%�WmNc�x�	|j|jjdd|j||||��S)N�wm�aspectrA)rM�minNumer�minDenom�maxNumer�maxDenoms     r�	wm_aspectzWm.wm_aspect�s>��	9��}�}��G�G�L�L��x�����x��x�
)�*�	*rc�^�	dd|jf|z}|jj|�S)Nr��
attributes)rsr;rrws  r�
wm_attributeszWm.wm_attributes�s1��	�"�l�D�G�G�,�t�3���w�w�|�|�D�!�!rc�T�	|jjdd|j|�S)Nr��clientrrrs  r�	wm_clientzWm.wm_clients$��	��w�w�|�|�D�(�D�G�G�T�:�:rc�2�	t|�dkDr|f}dd|jf|z}|r|jj|�y|jj	|jj|��D�cgc]}|j|���c}Scc}w)Nrr��colormapwindows)rrsr;rr7r�)rM�wlistrkr�s    r�wm_colormapwindowszWm.wm_colormapwindowss���	F��u�:��>��H�E��'����1�E�9����G�G�L�L���"�W�W�.�.�t�w�w�|�|�D�/A�B�D�B���&�&�q�)�B�D�
D��Ds�9Bc�T�	|jjdd|j|�S)Nr�r�rrrs  r�
wm_commandz
Wm.wm_commands&��	%��w�w�|�|�D�)�T�W�W�e�<�<rc�R�	|jjdd|j�S)Nr��	deiconifyrrrLs r�wm_deiconifyzWm.wm_deiconify&s#��	G��w�w�|�|�D�+�t�w�w�7�7rc�T�	|jjdd|j|�S)Nr��
focusmodelrr)rM�models  r�
wm_focusmodelzWm.wm_focusmodel-s'��	C��w�w�|�|�D�,�����?�?rc�@�	|jjdd|�y)Nr��forgetrgrts  r�	wm_forgetzWm.wm_forget5s��	-�
	
�����T�8�V�,rc�R�	|jjdd|j�S)Nr��framerrrLs r�wm_framezWm.wm_frame?s ��O��w�w�|�|�D�'�4�7�7�3�3rc�T�	|jjdd|j|�S)Nr�r!rr)rM�newGeometrys  r�wm_geometryzWm.wm_geometryEs$��	+��w�w�|�|�D�*�d�g�g�{�C�Crc�x�	|j|jjdd|j||||��S)Nr�r+rA)rM�	baseWidth�
baseHeight�widthInc�	heightIncs     r�wm_gridz
Wm.wm_gridLs>��	A��}�}�T�W�W�\�\��&�$�'�'��z�8�Y�8�9�	9rc�T�	|jjdd|j|�S)Nr��grouprr�rM�pathNames  r�wm_groupzWm.wm_groupYs$��	=��w�w�|�|�D�'�4�7�7�H�=�=rc��	|�)|jjdd|jd|�S|jjdd|j|�S)Nr��
iconbitmap�-defaultrr)rM�bitmap�defaults   r�
wm_iconbitmapzWm.wm_iconbitmap`sK��	/����7�7�<�<��l�D�G�G�Z��Q�Q��7�7�<�<��l�D�G�G�V�D�Drc�R�	|jjdd|j�S)Nr��iconifyrrrLs r�
wm_iconifyz
Wm.wm_iconifyps ��%��w�w�|�|�D�)�T�W�W�5�5rc�T�	|jjdd|j|�S)Nr��iconmaskrr)rMr�s  r�wm_iconmaskzWm.wm_iconmaskvs$��	"��w�w�|�|�D�*�d�g�g�v�>�>rc�T�	|jjdd|j|�S)Nr��iconnamerr)rM�newNames  r�wm_iconnamezWm.wm_iconname}s$��	��w�w�|�|�D�*�d�g�g�w�?�?rc��	|r+|jjdd|jdg|���y|jjdd|jg|���y)Nr��	iconphotor�rr)rMr�rks   r�wm_iconphotozWm.wm_iconphoto�sL��	6�&��D�G�G�L�L��{�D�G�G�Z�G�$�G��D�G�G�L�L��{�D�G�G�;�d�;rc	�t�	|j|jjdd|j||��S)Nr��iconpositionrArEs   r�wm_iconpositionzWm.wm_iconposition�s7��	F��}�}�T�W�W�\�\��.�$�'�'�1�a�1�2�	2rc�T�	|jjdd|j|�S)Nr��
iconwindowrrr�s  r�
wm_iconwindowzWm.wm_iconwindow�s$��	#��w�w�|�|�D�,�����B�Brc�@�	|jjdd|�y)Nr��managerg)rMr�s  r�	wm_managezWm.wm_manage�s��	�	
�����T�8�V�,rc	�t�	|j|jjdd|j||��S)Nr��maxsizerA�rMr�r�s   r�
wm_maxsizez
Wm.wm_maxsize��8��	��}�}�T�W�W�\�\��)�T�W�W�e�V�5�6�	6rc	�t�	|j|jjdd|j||��S)Nr��minsizerAr�s   r�
wm_minsizez
Wm.wm_minsize�r�rc�r�	|j|jjdd|j|��S)Nr��overrideredirect)r�r;rrsrcs  r�wm_overrideredirectzWm.wm_overrideredirect�s9��	����������$�d�g�g�w�!8�9�	9rc�T�	|jjdd|j|�S)Nr��positionfromrr�rM�whos  r�wm_positionfromzWm.wm_positionfrom�s&��	��w�w�|�|�D�.�$�'�'�3�?�?rc��	t|�r|j|�}n|}|jjdd|j||�S)Nr��protocol)r�r#r;rrs)rMr�r�r�s    r�wm_protocolzWm.wm_protocol�sG��	:��D�>��n�n�T�*�G��G��w�w�|�|��*�d�g�g�t�W�6�	6rc�V�	|jjdd|j||�S)Nr��	resizablerrr�s   r�wm_resizablezWm.wm_resizable�s&��	?��w�w�|�|�D�+�t�w�w��v�F�Frc�T�	|jjdd|j|�S)Nr��sizefromrrr�s  r�wm_sizefromzWm.wm_sizefrom�s&��	��w�w�|�|�D�*�d�g�g�s�;�;rc�T�	|jjdd|j|�S)Nr�r�rr)rM�newstates  r�wm_statezWm.wm_state�s%��	L��w�w�|�|�D�'�4�7�7�H�=�=rc�T�	|jjdd|j|�S)Nr��titlerrr�s  r�wm_titlezWm.wm_title�s"��+��w�w�|�|�D�'�4�7�7�F�;�;rc�T�	|jjdd|j|�S)Nr��	transientrr)rMr�s  r�wm_transientzWm.wm_transient	s$��	)��w�w�|�|�D�+�t�w�w��?�?rc�R�	|jjdd|j�S)Nr�r�rrrLs r�wm_withdrawzWm.wm_withdraw		s#��	N��w�w�|�|�D�*�d�g�g�6�6rrkr�rlrj)ArOrPrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r�r+r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rr�r rrr�r��s���K�'+�&*�	*��F�"�*�J�;�
�F�D�)�O�=��G�8�
�I�@��J�-��F�4�
�E�D�
�H�%)�"&�	9��D�>�

�E�E��J�6��G�?�
�H�@�
�H�<�2�I�2�#�L�C�
�J�-��F�6��G�6��G�9�+��@�#�L�	6��H�G�
�I�<��H�>�

�E�<�
�E�@�
�I�7�
�Hrr�c�B�eZdZ	dZ		d
d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
y)r�rFNc
��	d|_i|_d|_d|_|�Wddl}|j
j
tjd�}|j
j|�\}}|dvr||z}d}	tj||||	t|||�|_tr|jjt�|r|j!�tj"j$s|j'||�yy)NFr)z.pyz.pyc)r�r�	_tkloadedr;�os�path�basenamer��argv�splitextr6�create�wantobjects�_debug�settrace�_print_command�_loadtk�flags�ignore_environment�readprofile)
rM�
screenName�baseNamer��useTk�sync�user�ext�interactives
          rrzTk.__init__	s���	,�
�����
�����������w�w�'�'������4�H��G�G�,�,�X�6�M�H�c��/�)�#�c�>�����/�/�*�h�	�;�P[�]b�dh�jm�n�����G�G���^�,���L�L�N��y�y�+�+����X�y�1�,rc�r�|js+|jj�|j�yyr�)rr;�loadtkrrLs rrz	Tk.loadtk3	s%���~�~��G�G�N�N���L�L�N�rc���d|_|jjd�}|tjk7r tdtj�d|�d���t
|jjd��}|tjk7r tdtj�d|�d���|j�g|_|jjd	t�|jjd
t�|jjd	�|jjd
�trt�|a|jd|j �y)NT�
tk_versionztk.h version (z!) doesn't match libtk.a version (�)�tcl_versionztcl.h version (z") doesn't match libtcl.a version (�tkerror�exit�WM_DELETE_WINDOW)rr;r|r6�
TK_VERSIONr8r�TCL_VERSIONrrr�r�r�r�r�r�r�)rMrr s   rrz
Tk._loadtk8	s������W�W�^�^�L�1�
���,�,�,��"*�"5�"5�z� C�D�
D��$�'�'�.�.��7�8���(�.�.�.��"*�"6�"6�� E�F�
F�
���$� "�D�������i��2������f�e�,���� � ��+���� � ��(� �]�%:� �M��
�
�(�$�,�,�7rc��	t|jj��D]}|j��|jjd|j�tj|�trt|urda	yyy�Nr�)
rr�valuesr�r;rrsr^r�r��rMr/s  rr�z
Tk.destroyR	sb��	8��d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(����T�� �]�d�%:� �M�&;� rc�P�	ddl}d|jvr|jd}n|j}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}d|i}	td|	�|jj
|�r|jjd|�|jj
|�r#tt|�j�|	�|jj
|�r|jjd|�|jj
|�r$tt|�j�|	�yy)Nr�HOMEz.%s.tclz.%s.pyrMzfrom tkinter import *�source)r�environ�curdirrr�exec�isfiler;r�open�read)
rMrr�r�home�	class_tcl�class_py�base_tcl�base_py�dirs
          rrzTk.readprofile\	s>��	F�	��R�Z�Z���
�
�6�(:���Y�Y�d��G�G�L�L��y�9�'<�=�	��7�7�<�<��h��&:�;���7�7�<�<��i�(�&:�;���'�'�,�,�t�X��%8�9���t�n���
$�c�*�
�7�7�>�>�)�$��G�G�L�L��9�-�
�7�7�>�>�(�#���h��$�$�&��,�
�7�7�>�>�(�#��G�G�L�L��8�,�
�7�7�>�>�'�"���g��#�#�%�s�+�#rc���	ddl}tdtj��|t_|t_|t_|t_|j|||�y)NrzException in Tkinter callback��file)	�	tracebackr+r��stderr�last_exc�	last_type�
last_value�last_traceback�print_exception)rMrr�rr<s     rr�zTk.report_callback_exceptionr	sJ��	+�	�
�-�C�J�J�?������
��������!�!�#�s�B�/rc�0�	t|j|�Sr�)r�r;)rM�attrs  r�__getattr__zTk.__getattr__	s��=��t�w�w��%�%r)NNr�TFN)rOrPrQrsrrrr�rr�rEr rrr�r�	s6��@�	�B�AE�-1�2�:�
8�4!�,�,0�&rr�r:c�4�t|�}t||��y)Nr:)r
r+)r�r;s  rrr�	s����*�C�	�#�D�rc��t||||�Sr�)r�)rrr�rs    r�TclrH�	s��
�j�(�I�u�5�5rc�p�eZdZ	ifd�ZexZxZZd�ZeZd�Z	e	Z
ejxZ
ZejxZZy)�Packc�|�	|jjdd|jf|j||�z�y)Nrr�r;rrsr�rs   r�pack_configurezPack.pack_configure�	s:��	�	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�T�	|jjdd|j�y)Nrr�rrrLs r�pack_forgetzPack.pack_forget�	s��H������V�X�t�w�w�/rc��	t|j|jjdd|j��}d|vr|j	|d�|d<|S)Nrr�in�rAr;rrsr��rM�ds  r�	pack_infozPack.pack_info�	sP��	��t�w�w������V�V�T�W�W� E�F���1�9��'�'��$��0�A�d�G��rN)rOrPrQrMrrrrrOr�rUrr^r rr%r#r rrrJrJ�	sZ��=�"$�(�(!/�.�D�.�9�v�0��F���D�!%�!4�!4�4�I���+�+�+�F�[rrJc�T�eZdZ	ifd�ZexZxZZd�ZeZd�Z	e	Z
ejxZ
Zy)�Placec�|�	|jjdd|jf|j||�z�y)Nr(rrLrs   r�place_configurezPlace.place_configure�	s:��	�*	
�������T�W�W�-��
�
�c�2�&�'�	(rc�T�	|jjdd|j�y)Nr(r�rrrLs r�place_forgetzPlace.place_forget�	s�� ������W�h����0rc��	t|j|jjdd|j��}d|vr|j	|d�|d<|S)Nr(rrQrRrSs  r�
place_infozPlace.place_info�	sP��	��t�w�w������W�f�d�g�g� F�G���1�9��'�'��$��0�A�d�G��rN)rOrPrQrYr(rrrr[r�r]rr^r)r#r rrrWrW�	sJ��>�#%�(�4"1�0�E�0�I��1��F���D� �-�-�-�F�\rrWc��eZdZ	ifd�ZexZxZZejxZ	ZejxZZ
d�ZeZ
d�Zd�ZeZej"xZZej&xZZej*xZZej.xZZej2xZZy)�Gridc�|�	|jjdd|jf|j||�z�y)Nr+rrLrs   r�grid_configurezGrid.grid_configure
s:��
	�	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�T�	|jjdd|j�y)Nr+r�rrrLs r�grid_forgetzGrid.grid_forget
s�� ������V�X�t�w�w�/rc�T�	|jjdd|j�y)Nr+r-rrrLs r�grid_removezGrid.grid_remove"
s��>������V�X�t�w�w�/rc��	t|j|jjdd|j��}d|vr|j	|d�|d<|S)Nr+rrQrRrSs  r�	grid_infozGrid.grid_info&
sP��	2��t�w�w������V�V�T�W�W� E�F���1�9��'�'��$��0�A�d�G��rN)rOrPrQrar+rrrr^r4r/rBr?rcr�rergrrFrDrHrrKrJrNrMrPr#r rrr_r_�	s���=�
"$�(�&!/�.�D�.�9�v��~�~�%�D�9�-1�-F�-F�F�O�*�0��F�0���D�#�1�1�1�H�}�!%�!4�!4�4�I��'+�'=�'=�=�L�$��~�~�%�D�9��+�+�+�F�[rr_c�0�eZdZ	d�Ziidfd�Zd�Zdd�Zy)�
BaseWidgetc��	|�
t�}||_|j|_d}d|vr|d}|d=|s�|jjj�}|dj
�r|dz
}|j�i|_|jj|d�dz}||j|<|dk(rd|��}nd||fz}||_	|jdk(rd|z|_
n|jdz|z|_
i|_|j|jjvr1|jj|jj�||jj|j<y)Nr�r��!rrz!%s%drF)
r�r�r;r>rOr��isdigitrmrrrsrr�)rMr�r.r��counts     r�_setupzBaseWidget._setup9
sV��D��>�&�(�F�����)�)������S�=��v�;�D��F����>�>�*�*�0�0�2�D��B�x���!������%�%�-�)+��&��*�*�.�.�t�Q�7�!�;�E�+0�F�"�"�4�(���z� $����$���.����
��9�9�c�>��D�j�D�G��i�i�#�o��,�D�G���
��:�:����-�-�-��K�K� � ����,�4�4�6�+/������T�Z�Z�(rr c��	|r
t||f�}||_|j||�|j�g|_|j	�D��cgc]\}}t|t�s�||f��}}}|D]\}}||=�
|jj||jf|z|j|�z�|D]\}}|j||��ycc}}wr�)r3�
widgetNamernrr,rr'r;rrsr�r)	rMr�rpr.rl�extrar1r2�classess	         rrzBaseWidget.__init__Y
s���	$�
��S�"�I�&�C�$������F�C� ����$� "�D��&)�i�i�k�I�k�d�a��Z��4�5H�A�q�6�k��I��D�A�q��A��������
����!�E�)�D�M�M�#�,>�>�	@��D�A�q�
�K�K��a� ���Js�C�)Cc�r�	t|jj��D]}|j��|jjd|j�|j|jjvr!|jj|j=tj|�yr')
rrr(r�r;rrsrr�r^r)s  rr�zBaseWidget.destroyj
su��7��d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(��:�:����-�-�-����$�$�T�Z�Z�0����T�rc�V�|jj|j|f|z�Sr�rr)rMr�rks   r�_dozBaseWidget._dor
s"���w�w�|�|�T�W�W�d�O�d�2�3�3rN)r )rOrPrQrnrr�rur rrriri6
s#���0�@02�b��!�"�4rric��eZdZ	y)�WidgetN)rOrPrQr rrrwrww
s���	rrwc��eZdZ	difd�Zy)�ToplevelNc��	|r
t||f�}d}dD],}||vs�||}|ddk(r	d|ddz}nd|z}|||fz}||=�.tj||d|i|�|j�}|j	|j	��|j|j��|j
d|j�y)Nr )rY�class_r
rz�colormapr�r�r6rtr#)r3rirrr�r�r�r�)	rMr�r.rlrq�wmkeyr��optr�s	         rrzToplevel.__init__�
s���	���S�"�I�&�C����E���|��%�j����9��#�3�u�S�b�z�>�S���I�c���c�
�*����J��	���D�&�*�c�2�u�E��z�z�|���
�
�d�m�m�o�&��
�
�4�:�:�<� ��
�
�(�$�,�,�7r�rOrPrQrr rrryry
s��,�"��8rryc�&�eZdZ	difd�Zd�Zd�Zy)r�Nc�8�	tj||d||�y)N�button�rwr�rMr�r.rls    rrzButton.__init__�
s��	�$	����f�h��R�8rc�R�	|jj|jd�y�N�flashrrrLs rr�zButton.flash�
s��	�	
�����T�W�W�g�&rc�P�	|jj|jd�S�N�invokerrrLs rr�z
Button.invoke�
s"��	��w�w�|�|�D�G�G�X�.�.r)rOrPrQrr�r�r rrr�r��
s���"��9�*
'�/rr�c��eZdZ	difd�Zd�Zd�Zd�Zd�Zd;d�Zd�Z	d	�Z
d
�Zd�Zd<d�Z
d=d
�Zd<d�Zd<d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d;d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d<d,�Z-e-Z.d-�Z/e/Z0d.�Z1d>d/�Z2ifd0�Z3d1�Z4e4xZ5Z6d2�Z7d3�Z8d?d4�Z9d5�Z:d6�Z;d7�Z<d8�Z=d9�Z>d:�Z?y)@�CanvasNc�8�	tj||d||�y)N�canvasr�r�s    rrzCanvas.__init__�
s��	-�	����f�h��R�8rc�Z�	|jj|jdf|z�y)N�addtagrrrws  rr�z
Canvas.addtag�
s#�� ������d�g�g�x�(�4�/�0rc�,�	|j|d|�y�N�above�r��rM�newtag�tagOrIds   r�addtag_abovezCanvas.addtag_above�
���8����F�G�W�-rc�*�	|j|d�y�Nr�r�)rMr�s  r�
addtag_allzCanvas.addtag_all�
s��*����F�E�"rc�,�	|j|d|�y�N�belowr�r�s   r�addtag_belowzCanvas.addtag_below�
r�rc�2�	|j|d||||�y�N�closestr�)rMr�r�r��halo�starts      r�addtag_closestzCanvas.addtag_closest�
s ��	M�	
���F�I�q�!�T�5�9rc�2�	|j|d||||�y�N�enclosedr��rMr��x1�y1�x2�y2s      r�addtag_enclosedzCanvas.addtag_enclosed�
s��	����F�J��B��B�7rc�2�	|j|d||||�y�N�overlappingr�r�s      r�addtag_overlappingzCanvas.addtag_overlapping�
s��	#����F�M�2�r�2�r�:rc�,�	|j|d|�y�N�withtagr�r�s   r�addtag_withtagzCanvas.addtag_withtag�
s��7����F�I�w�/rc�~�	|j|jj|jdf|z��xsdS�Nr/rArws  rr/zCanvas.bboxs?��	F��}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�<�7;�	<rc�F�	|j|jd||f|�yr�r�)rMr�r�r�s    r�
tag_unbindzCanvas.tag_unbinds"��	,����d�g�g�v�w��9�6�Brc�F�	|j|jd|f|||�Sr�r�)rMr�r�r�r&s     r�tag_bindzCanvas.tag_binds/��	I�
�z�z�4�7�7�F�G�4��D�#�'�	'rc��	|jj|jj|jd||��S)N�canvasxr)rM�screenx�gridspacings   rr�zCanvas.canvasx�:��	5��w�w� � �������G�G�Y���"6�7�	7rc��	|jj|jj|jd||��S)N�canvasyr)rM�screenyr�s   rr�zCanvas.canvasyr�rc��	t|�}|jj|jj|jdf|z��D�cgc]}|jj|���c}Scc}w�N�coords)r!r;r7rrsrNrs   rr�z
Canvas.coords ss��F���~���7�7�,�,��7�7�<�<����(� 3�d� :�;�=�>�=�*+����!�!�!�$�=�>�	>��>s�"A7c
�
�	t|�}|d}t|ttf�r|dd}ni}|jj|jj|jd|g||j||�z����S)Nr�r)	r!rr&rr;rMrrsr�)rM�itemTyperkrlr.s     r�_createzCanvas._create's~�� ���~���2�h���c�D�%�=�)����9�D��C��w�w�~�~�l�d�g�g�l�l��G�G�X�x�.��T�]�]�3��+�+�.�/�	/rc�*�	|jd||�S)N�arc�r�rjs   r�
create_arczCanvas.create_arc3s��D��|�|�E�4��,�,rc�*�	|jd||�S�Nr�r�rjs   r�
create_bitmapzCanvas.create_bitmap7s��3��|�|�H�d�B�/�/rc�*�	|jd||�S)Nrbr�rjs   r�create_imagezCanvas.create_image;s��7��|�|�G�T�2�.�.rc�*�	|jd||�S)Nr�r�rjs   r�create_linezCanvas.create_line?s��;��|�|�F�D�"�-�-rc�*�	|jd||�S)N�ovalr�rjs   r�create_ovalzCanvas.create_ovalCs��7��|�|�F�D�"�-�-rc�*�	|jd||�S)N�polygonr�rjs   r�create_polygonzCanvas.create_polygonGs��>��|�|�I�t�R�0�0rc�*�	|jd||�S)N�	rectangler�rjs   r�create_rectanglezCanvas.create_rectangleKs��<��|�|�K��r�2�2rc�*�	|jd||�S�N�textr�rjs   r�create_textzCanvas.create_textOs��1��|�|�F�D�"�-�-rc�*�	|jd||�S)Nrqr�rjs   r�
create_windowzCanvas.create_windowSs��9��|�|�H�d�B�/�/rc�Z�	|jj|jdf|z�y)N�dcharsrrrws  rr�z
Canvas.dcharsWs&��	D������d�g�g�x�(�4�/�0rc�Z�	|jj|jdf|z�y�NrXrrrws  rrXz
Canvas.delete\s#��J������d�g�g�x�(�4�/�0rc�Z�	|jj|jdf|z�y)N�dtagrrrws  rr�zCanvas.dtag`s%��	1������d�g�g�v�&��-�.rc�~�	|j|jj|jdf|z��xsdS)N�findr rArws  rr�zCanvas.finde�<�� ��}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�:�79�	:rc�(�	|jd|�Sr��r��rMr�s  r�
find_abovezCanvas.find_abovejs��)��y�y��'�*�*rc�&�	|jd�Sr�r�rLs r�find_allzCanvas.find_allns����y�y���rc�(�	|jd|�Sr�r�r�s  r�
find_belowzCanvas.find_belowrs��-��y�y��'�*�*rc�.�	|jd||||�Sr�r�)rMr�r�r�r�s     r�find_closestzCanvas.find_closestvs!��	M��y�y��A�q�$��6�6rc�.�	|jd||||�Sr�r��rMr�r�r�r�s     r�
find_enclosedzCanvas.find_enclosed}s��	��y�y��R��R��4�4rc�.�	|jd||||�Sr�r�r�s     r�find_overlappingzCanvas.find_overlapping�s��	#��y�y���B��B�7�7rc�(�	|jd|�Sr�r�r�s  r�find_withtagzCanvas.find_withtag�s��,��y�y��G�,�,rc�X�	|jj|jdf|z�Sr�rrrws  rr�zCanvas.focus�s&��<��w�w�|�|�T�W�W�g�.��5�6�6rc��	|jj|jj|jdf|z��S)N�gettagsr�rws  rrzCanvas.gettags�s:��K��w�w� � ��G�G�L�L�$�'�'�9�-��4�5�7�	7rc�Z�	|jj|jdf|z�y�N�icursorrrrws  rrzCanvas.icursor�s%��	*������d�g�g�y�)�D�0�1rc��	|jj|jj|jdf|z��S�Nr;rrws  rr;zCanvas.index�s3��M��w�w�~�~�d�g�g�l�l�D�G�G�W�+=��+D�E�F�Frc�Z�	|jj|jdf|z�y�N�insertrrrws  rr
z
Canvas.insert�s%��	 ������d�g�g�x�(�4�/�0rc�b�	|jj|jdf|d|zfz�S�N�itemcgetr6rr)rMr�r�s   rr
zCanvas.itemcget�s4��G��w�w�|�|�
�W�W�j�!�W�c�&�j�$9�9�;�	;rc�.�	|jd|f||�S�N�
itemconfigurer
�rMr�r.rls    rrzCanvas.itemconfigure�s!��	������9�3��C�Crc�Z�	|jj|jdf|z�yr�rrrws  r�	tag_lowerzCanvas.tag_lower��%��	*������d�g�g�w�'�$�.�/rc�Z�	|jj|jdf|z�y)N�moverrrws  rrzCanvas.move�s#��1������d�g�g�v�&��-�.rc�X�	|jj|jd|||�y)Nr�rr)rMr�r�r�s    rr�z
Canvas.moveto�s&��	H�	
�����T�W�W�h���A�6rc�x�	|jj|jdf|j||�z�S)N�
postscriptrLrs   rrzCanvas.postscript�s<��	 ��w�w�|�|�T�W�W�l�3��M�M�#�r�*�+�,�	,rc�Z�	|jj|jdf|z�yr�rrrws  r�	tag_raisezCanvas.tag_raise�rrc�Z�	|jj|jdf|z�y�N�scalerrrws  rrzCanvas.scale�s#��G������d�g�g�w�'�$�.�/rc�X�	|jj|jdd||�y�N�scan�markrrrEs   r�	scan_markzCanvas.scan_mark��!��4������T�W�W�f�f�a��3rc�Z�	|jj|jdd|||�y�Nr!�dragtorr)rMr�r��gains    r�scan_dragtozCanvas.scan_dragto�s'��	�	
�����T�W�W�f�h��1�d�;rc�X�	|jj|jdd||�y)N�select�adjustrr�rMr�r;s   r�
select_adjustzCanvas.select_adjust�s!��Z������T�W�W�h��'�5�Arc�T�	|jj|jdd�y)Nr+r�rrrLs r�select_clearzCanvas.select_clear�s��:������T�W�W�h��0rc�X�	|jj|jdd||�y)Nr+�fromrrr-s   r�select_fromzCanvas.select_from�s!��H������T�W�W�h����?rc�Z�	|jj|jdd�xsdS)Nr+r$rrrLs r�select_itemzCanvas.select_item�s%��6��w�w�|�|�D�G�G�X�v�6�>�$�>rc�X�	|jj|jdd||�y)Nr+�torrr-s   r�	select_tozCanvas.select_to�s!��K������T�W�W�h��g�u�=rc�Z�	|jj|jd|�xsdS�Nr'rrr�s  rr'zCanvas.type�s%��2��w�w�|�|�D�G�G�V�W�5�=��=rrlr�rA)r�r�)�
)@rOrPrQrr�r�r�r�r�r�r�r�r/r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rXr�r�r�r�r�r�r�r�r�r�rrr;r
r
r�
itemconfigrr�rr�rrror�rr#r)r.r0r3r5r8r'r rrr�r��
sK��I�"��
9�1�.�#�.�:�8�
;�
0�<�C�
'�7�7�>�
/�-�0�/�.�.�1�3�.�0�1�
1�/�
:�
+� �+�7�5�
8�
-�7�7�
2�
G�1�
;�
D��J�0�

�E�/�7� �,�0�
��D�7�0�4�<�B�1�@�?�>�>rr�c�J��eZdZ	difd�Z�fd�Zd�Zd�Zd�Zd�Zd�Z	�xZ
S)	�CheckbuttonNc�8�	tj||d||�y�N�checkbuttonr�r�s    rrzCheckbutton.__init__s��	3�	����f�m�S�"�=rc���|jd�s<|jjj�}tdz
ad|�dt��|d<t
�|�||�y)Nr�rrkr6)rr>rOr��_checkbutton_count�superrn)rMr�r.r�r>s    �rrnzCheckbutton._setups[����w�w�v���>�>�*�*�0�0�2�D��!�#���d�V�1�%7�$8�9�C��K�
���v�s�#rc�R�	|jj|jd�y�N�deselectrrrLs rrGzCheckbutton.deselects��*������T�W�W�j�)rc�R�	|jj|jd�yr�rrrLs rr�zCheckbutton.flash"���������T�W�W�g�&rc�P�	|jj|jd�Sr�rrrLs rr�zCheckbutton.invoke&���J��w�w�|�|�D�G�G�X�.�.rc�R�	|jj|jd�y�Nr+rrrLs rr+zCheckbutton.select*���)������T�W�W�h�'rc�R�	|jj|jd�y)N�togglerrrLs rrPzCheckbutton.toggle.s�� ������T�W�W�h�'r)rOrPrQrrnrGr�r�r+rP�
__classcell__)r>s@rr>r>s.���A�"��
>�$�*�'�/�(�(rr>c��eZdZ	difd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZeZd�Z
e
Zd�ZeZd
�ZeZd�ZeZd�ZeZy)�EntryNc�8�	tj||d||�y)N�entryr�r�s    rrzEntry.__init__6s��		�	����f�g�s�B�7rc�V�	|jj|jd||�yr�rr�rM�first�lasts   rrXzEntry.deleteCs��<������T�W�W�h��t�4rc�P�	|jj|jd�S�NrrrrLs rrz	Entry.getGs����w�w�|�|�D�G�G�U�+�+rc�T�	|jj|jd|�yrrr�rMr;s  rrz
Entry.icursorKs��%������T�W�W�i��/rc��	|jj|jj|jd|��Srrr]s  rr;zEntry.indexOs4��(��w�w�~�~�d�g�g�l�l��G�G�W�e�%�&�	&rc�V�	|jj|jd||�yr	rr)rMr;r�s   rr
zEntry.insertTs��%������T�W�W�h��v�6rc�V�	|jj|jdd|�yr rrr:s  rr#zEntry.scan_markXs��4������T�W�W�f�f�a�0rc�V�	|jj|jdd|�yr&rrr:s  rr)zEntry.scan_dragto\s#��	�	
�����T�W�W�f�h��2rc�V�	|jj|jdd|�y)Nr�r,rrr]s  r�selection_adjustzEntry.selection_adjustbs��G������T�W�W�k�8�U�;rc�T�	|jj|jdd�y�Nr�r�rrrLs rr�zEntry.selection_clearhs��:������T�W�W�k�7�3rc�V�	|jj|jdd|�y)Nr�r2rrr]s  r�selection_fromzEntry.selection_fromns��8������T�W�W�k�6�5�9rc��	|jj|jj|jdd��S�Nr��presentrrLs r�selection_presentzEntry.selection_presentt�6��	��w�w�!�!��G�G�L�L����+�y�9�;�	;rc�X�	|jj|jdd||�y)Nr��rangerr�rMr��ends   r�selection_rangezEntry.selection_range|s!��A������T�W�W�k�7�E�3�?rc�V�	|jj|jdd|�y)Nr�r7rrr]s  r�selection_tozEntry.selection_to�s��;������T�W�W�k�4��7rr�)rOrPrQrrXrrr;r
r#r)rcr.r�r0rgr3rk�select_presentrq�select_rangersr8r rrrSrS3s{��;�"��8�5�,�0�&�
7�1�3�<�%�M�4�#�L�:�!�K�;�'�N�@�#�L�8��IrrSc��eZdZ	difd�Zy)�FrameNc��	t||f�}d}d|vrd|df}|d=nd|vr
d|df}|d=tj||d|i|�y)Nr r{z-classr
r�)r3rwr)rMr�r.rlrqs     rrzFrame.__init__�sk��	Q�
��b�	�"�����s�?��s�8�}�-�E��H�
�
��^��s�7�|�,�E��G������f�g�s�B��>rrr rrrwrw�s��P�"��?rrwc��eZdZ	difd�Zy)�LabelNc�8�	tj||d||�y)N�labelr�r�s    rrzLabel.__init__�s��	�"	����f�g�s�B�7rrr rrrzrz�s��:�"��8rrzc��eZdZ	difd�Zd�Zd�Zd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�ZeZdd�ZeZd�ZeZdd�ZeZd�Zd�Zdd�ZeZy)�ListboxNc�8�	tj||d||�y)N�listboxr�r�s    rrzListbox.__init__�s��	@�	����f�i��b�9rc�T�	|jj|jd|�y�N�activaterrr]s  rr�zListbox.activate�s��0������T�W�W�j�%�0rc�x�	|j|jj|jd|��xsdSr�rAr]s  rr/zListbox.bbox�s1��	B��}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�v�	|j|jj|jd��xsdS)N�curselectionr rArLs rr�zListbox.curselection�s,��<��}�}�T�W�W�\�\�$�'�'�>�B�C�I�r�Irc�V�	|jj|jd||�yr�rrrWs   rrXzListbox.delete�s��9������T�W�W�h��t�4rc���	|�A|jj|jj|jd||��S|jj|jd|�Sr[r�rWs   rrzListbox.get�s[��>����7�7�$�$�T�W�W�\�\������t�&-�.�
.��7�7�<�<������6�6rc��	|jj|jd|�}|dk(ry|jj|�S)Nr;r��r;rrsrM�rMr;r�s   rr;z
Listbox.index�s;��9��G�G�L�L����'�5�1����;�t��w�w�~�~�a� � rc�\�	|jj|jd|f|z�yr	rr)rMr;�elementss   rr
zListbox.insert�s%��'������d�g�g�x��/�(�:�;rc��	|jj|jj|jd|��S)N�nearestr)rMr�s  rr�zListbox.nearest�s4��C��w�w�~�~�d�g�g�l�l��G�G�Y��#�$�	$rc�X�	|jj|jdd||�yr rrrEs   rr#zListbox.scan_mark�r$rc�X�	|jj|jdd||�yr&rrrEs   rr)zListbox.scan_dragto��%��	�	
�����T�W�W�f�h��1�5rc�T�	|jj|jd|�y�N�seerrr]s  rr�zListbox.see�s��0������T�W�W�e�U�+rc�V�	|jj|jdd|�y)Nr�r,rrr]s  r�selection_anchorzListbox.selection_anchor�s��;������T�W�W�k�8�U�;rc�X�	|jj|jdd||�yrerrrWs   rr�zListbox.selection_clear�s$��@������T�W�W��g�u�d�	4rc��	|jj|jj|jdd|��S)Nr��includesrr]s  r�selection_includeszListbox.selection_includes
s8��<��w�w�!�!�$�'�'�,�,��G�G�[�*�e�#5�6�	6rc�X�	|jj|jdd||�y)Nr�rrrrWs   r�
selection_setzListbox.selection_set
s#��	5������T�W�W�k�5�%��>rc��	|jj|jj|jd��S)NrMrrLs rrMzListbox.size
s+��;��w�w�~�~�d�g�g�l�l�4�7�7�F�;�<�<rc�b�	|jj|jdf|d|zfz�Srrr�rMr;r�s   rr
zListbox.itemcget
s4��B��w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�.�	|jd|f||�Srr
rAs    rrzListbox.itemconfigure
s!��	/������7��b�A�Arr�)rOrPrQrr�r/r�rXrr;r
r�r#r)r�r��
select_anchorr�r0r��select_includesr��
select_setrMr
rr<r rrr~r~�s���=�"��:�1�K�
J�5�7�!�<�$�
4�6�,�<�%�M�4�
#�L�6�
)�O�?�
�J�=�9�
B��Jrr~c���eZdZ	difd�Zdd�Zd�Zifd�Zifd�Zifd�Zifd�Z	ifd	�Z
ifd
�Zifd�Zifd�Z
ifd
�Zifd�Zifd�Zifd�Zdd�Zd�Zdd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�MenuNc�8�	tj||d||�y�N�menur�r�s    rrz
Menu.__init__,
s��	I�	����f�f�c�2�6rc�X�	|jjd|j|||�y)N�tk_popuprr)rMr�r�rUs    rr�z
Menu.tk_popup5
s!��=������Z����!�Q��6rc�T�	|jj|jd|�yr�rrr]s  rr�z
Menu.activate9
s��&������T�W�W�j�%�0rc�|�	|jj|jd|f|j||�z�y�Nr&rL)rMr�r.rls    rr&zMenu.add=
s5�� ������d�g�g�u�h�/����s�B�'�(�	)rc�2�	|jd|xs|�y�N�cascade�r&rs   r�add_cascadezMenu.add_cascadeB
s��)�����C�I�2�&rc�2�	|jd|xs|�yr@r�rs   r�add_checkbuttonzMenu.add_checkbuttonF
s��(������	�r�*rc�2�	|jd|xs|�y�Nr�r�rs   r�add_commandzMenu.add_commandJ
s��$�����C�I�2�&rc�2�	|jd|xs|�y�N�radiobuttonr�rs   r�add_radiobuttonzMenu.add_radiobuttonN
s��"������	�r�*rc�2�	|jd|xs|�y�N�	separatorr�rs   r�
add_separatorzMenu.add_separatorR
s�������c�i�R�(rc�~�	|jj|jd||f|j||�z�yr	rL)rMr;r�r.rls     rr
zMenu.insertV
s7�� ������d�g�g�x���9����s�B�'�(�	)rc�4�	|j|d|xs|�yr��r
rAs    r�insert_cascadezMenu.insert_cascade[
s��2����E�9�c�i�R�0rc�4�	|j|d|xs|�yr@r�rAs    r�insert_checkbuttonzMenu.insert_checkbutton_
s��1����E�=�#�)��4rc�4�	|j|d|xs|�yr�r�rAs    r�insert_commandzMenu.insert_commandc
s��-����E�9�c�i�R�0rc�4�	|j|d|xs|�yr�r�rAs    r�insert_radiobuttonzMenu.insert_radiobuttong
s��+����E�=�#�)��4rc�4�	|j|d|xs|�yr�r�rAs    r�insert_separatorzMenu.insert_separatork
s��%����E�;��	�r�2rc�b�	|�|}|j|�|j|�}}|�|�d\}}t||dz�D]E}d|j|�vs�t|j	|d��}|s�5|j|��G|jj|jd||�y)N)rr�rr�rX)	r;rn�entryconfigr�	entrycgetrr;rrs)rM�index1�index2�
num_index1�
num_index2r�r/s       rrXzMenu.deleteo
s���E��>��F�!%���F�!3�T�Z�Z��5G�J�
���J�$6�%*�"�J�
��z�:��>�2�A��D�,�,�Q�/�/�����q�)�4�5����&�&�q�)�	3�
	
�����T�W�W�h���7rc�Z�	|jj|jd|d|z�S)Nr�r6rrr�s   rr�zMenu.entrycget
s&��K��w�w�|�|�D�G�G�[�%��v��F�Frc�.�	|jd|f||�S)N�entryconfigurer
rAs    rr�zMenu.entryconfigure�
s��-���� 0�%�8�#�r�B�Brc��	|jj|jd|�}|dvrdS|jj|�S)Nr;)r�r�r�r�s   rr;z
Menu.index�
s>��B��G�G�L�L����'�5�1���L�(�t�?�d�g�g�n�n�Q�.?�?rc�R�	|jj|jd|�Sr�rrr]s  rr�zMenu.invoke�
s"��	#��w�w�|�|�D�G�G�X�u�5�5rc�V�	|jj|jd||�y)N�postrrrEs   rr�z	Menu.post�
s��-������T�W�W�f�a��+rc�R�	|jj|jd|�Sr:rrr]s  rr'z	Menu.type�
s ��8��w�w�|�|�D�G�G�V�U�3�3rc�R�	|jj|jd�y)N�unpostrrrLs rr�zMenu.unpost�
s��������T�W�W�h�'rc��	|jj|jj|jd|��S)N�	xpositionrr]s  rr�zMenu.xposition�
s/��	��w�w�~�~�d�g�g�l�l�4�7�7�K��G�H�Hrc��	|jj|jj|jd|��S)N�	ypositionrr]s  rr�zMenu.yposition�
s4��S��w�w�~�~�d�g�g�l�l��G�G�[�%�)�*�	*r�r�r�)rOrPrQrr�r�r&r�r�r�r�r�r
r�r�r�r�r�rXr�r�r�r;r�r�r'r�r�r�r rrr�r�)
s���Z�"��7�7�1�!#�)�
!�'�#%�+�!�'�#%�+�!#�)�+-�)�
)+�1�-/�5�)+�1�-/�5�+-�3�8� G�C�!�K�@�
6�
,�4�(�I�
*rr�c��eZdZ	difd�Zy)�
MenubuttonNc�6�tj||d||�y)N�
menubuttonr�r�s    rrzMenubutton.__init__�
s������f�l�C��<rrr rrr�r��
s��2�"��=rr�c��eZdZ	difd�Zy)�MessageNc�6�tj||d||�y)N�messager�r�s    rrzMessage.__init__�
s������f�i��b�9rrr rrr�r��
s��U�"��:rr�c�2�eZdZ	difd�Zd�Zd�Zd�Zd�Zy)�RadiobuttonNc�8�	tj||d||�yr�r�r�s    rrzRadiobutton.__init__�
s��	�	����f�m�S�"�=rc�R�	|jj|jd�yrFrrrLs rrGzRadiobutton.deselect�
s��*������T�W�W�j�)rc�R�	|jj|jd�yr�rrrLs rr�zRadiobutton.flash�
rIrc�P�	|jj|jd�Sr�rrrLs rr�zRadiobutton.invoke�
rKrc�R�	|jj|jd�yrMrrrLs rr+zRadiobutton.select�
rNr)rOrPrQrrGr�r�r+r rrr�r��
s#��Q�"��
>�*�
'�/�(rr�c�4�eZdZ	difd�Zd�Zd�Zdd�Zd�Zy)�ScaleNc�8�	tj||d||�yrr�r�s    rrzScale.__init__�
s��	;�	����f�g�s�B�7rc���	|jj|jd�}	|jj|�S#tt
tf$r|jj|�cYSwxYwr[)r;rrsrMr�r*r�rNrs  rrz	Scale.get�
s`��8������T�W�W�e�,��	,��7�7�>�>�%�(�(���I�x�0�	,��7�7�$�$�U�+�+�	,�s�A�/A6�5A6c�T�	|jj|jd|�y�Nrrrrs  rrz	Scale.set�
s��%������T�W�W�e�U�+rc�p�	|j|jj|jd|��Sr�rArs  rr�zScale.coords�
s-��	��}�}�T�W�W�\�\�$�'�'�8�U�C�D�Drc�T�	|jj|jd||�S�N�identifyrrrEs   rr�zScale.identify�
s$��	$��w�w�|�|�D�G�G�Z��A�6�6rr�)rOrPrQrrrr�r�r rrr�r��
s$��;�"��	8�,�,�E�7rr�c�@�eZdZ	difd�Zd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�	ScrollbarNc�8�	tj||d||�y)N�	scrollbarr�r�s    rrzScrollbar.__init__s��	�	����f�k�3��;rc�Z�	|jj|jd|�xsdSr�rrr]s  rr�zScrollbar.activates)��	,��w�w�|�|�D�G�G�Z��7�?�4�?rc��	|jj|jj|jd||��S)Nr�r)rM�deltax�deltays   rr�zScrollbar.deltas8��	6��w�w� � ��G�G�L�L����'�6�6�:�<�	<rc��	|jj|jj|jd||��S)Nr�rrEs   rr�zScrollbar.fractions3��	��w�w� � ������d�g�g�z�1�a�!H�I�Irc�T�	|jj|jd||�Sr�rrrEs   rr�zScrollbar.identify"s$��	-��w�w�|�|�D�G�G�Z��A�6�6rc�n�	|j|jj|jd��Sr[)r�r;rrsrLs rrz
Scrollbar.get's+��	#���������T�W�W�e� <�=�=rc�V�	|jj|jd||�yr�rrrWs   rrz
Scrollbar.set,s!��	1������T�W�W�e�U�D�1rr�)
rOrPrQrr�r�r�r�rrr rrr�r�s/��I�"��	<�@�<�J�
7�
>�
2rr�c��eZdZ	difd�Zd�Zd�Zd�Zd7d�Zd7d�Zd�Z	d8d	�Z
d
�Zd7d�Zd�Z
d
�Zd�Zd�Zd7d�Zd�Zd7d�Zifd�Zd�Zd�Zd�Zd7d�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Zd�Z d �Z!d!�Z"			d9d"�Z#d#�Z$d$�Z%d7d%�Z&d7d&�Z'd:d'�Z(d(�Z)d7d)�Z*e*Z+d*�Z,d7d+�Z-d7d,�Z.d7d-�Z/d7d.�Z0d7d/�Z1d0�Z2d7d1�Z3d2�Z4d7d3�Z5e5Z6ifd4�Z7d5�Z8d6�Z9y);�TextNc�8�	tj||d||�yr�r�r�s    rrz
Text.__init__5s��	�,	����f�f�c�2�6rc�x�	|j|jj|jd|��xsdSr�rAr]s  rr/z	Text.bboxNs9��	H��}�}������T�W�W�f�e�4�6�>�9=�	>rc	��	|jj|jj|jd|||��S)N�comparer)rMr��opr�s    rr
zText.compareTs=��	K��w�w�!�!�$�'�'�,�,��G�G�Y���F�#4�5�	5rc���	|D�cgc]}d|z��	}}|||gz
}|jj|jdg|���xsd}|�t|�dkr|fS|Scc}w)Nr\rm�)r;rrsr)rMr�r�rk�argr#s      rrmz
Text.countZsu��
	F�(,�,�t�����t��,���� � ���d�g�g�l�l�4�7�7�G�3�d�3�;�t���?�s�4�y�A�~��7�N��J��
-s�Ac���	|�?|jj|jj|jd��S|jj|jd|�y)N�debugrrcs  rrz
Text.debugnsL��	(��?��7�7�%�%�d�g�g�l�l�4�7�7�G�&D�E�E������T�W�W�g�w�/rc�V�	|jj|jd||�yr�rr�rMr�r�s   rrXzText.deleteus��M������T�W�W�h���7rc�p�	|j|jj|jd|��S)N�	dlineinforAr]s  rrzText.dlineinfoys-��	#��}�}�T�W�W�\�\�$�'�'�;��F�G�Grc��	g}d}d}|s	g}|fd�}|}	t|t�s|j|�x}}|d|gz
}|D]}	||	s�	|jd|	z��|j|�|r|j|�|jj
|jdg|���||r|j|�SS#|r|j|�wwxYw)Nc�,�|j|||f�yr�)r�)r@rr;rs    r�
append_triplez Text.dump.<locals>.append_triple�s���
�
�s�E�5�1�2rz-commandr6�dump)rrr#r�r;rrsr)
rMr�r�r�rlrk�	func_namerrr@s
          rrz	Text.dumps���
	M����	����
�F�8>�
3�#�G�
	.��g�s�+�&*�n�n�W�&=�=�	�G��Z��)�)�D����c�7�D�K�K��c�	�2���K�K�������F�#��D�G�G�L�L����&�0�4�0����"�"�9�-���y��"�"�9�-��s�4C�	A#C�Cc�T�	|jj|jdg|���S)N�editrrrws  rrz	Text.edit�s)��	��t�w�w�|�|�D�G�G�V�3�d�3�3rc�(�	|jd|�S)N�modified�r)rMrs  r�
edit_modifiedzText.edit_modified�s��	��y�y��S�)�)rc�&�	|jd�S)N�redor!rLs r�	edit_redozText.edit_redo�s��	��y�y�� � rc�&�	|jd�S)N�resetr!rLs r�
edit_resetzText.edit_reset�s��	��y�y��!�!rc�&�	|jd�Sr�r!rLs r�edit_separatorzText.edit_separator�s��	��y�y��%�%rc�&�	|jd�S)N�undor!rLs r�	edit_undozText.edit_undo�s��	��y�y�� � rc�T�	|jj|jd||�Sr[rrrs   rrzText.get�s"��C��w�w�|�|�D�G�G�U�F�F�;�;rc��	|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)Nrr6r�r�rbrrrr�s   r�
image_cgetzText.image_cget�sT��G��"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�W�f�e�V�D�Drc�0�	|jdd|f||�S)Nrbrr
rAs    r�image_configurezText.image_configure�s��3������e�<�c�2�F�Frc�x�	|jj|jdd|g|j||����S)NrbrrLrAs    r�image_createzText.image_create�s<��0��t�w�w�|�|����'�8�U�*��-�-��R�(�*�	*rc�R�	|jj|jdd�SrarrrLs rrdzText.image_names�s ��A��w�w�|�|�D�G�G�W�g�6�6rc�d�	t|jj|jd|��Sr)rr;rrsr]s  rr;z
Text.index�s%��?��4�7�7�<�<�����%�8�9�9rc�^�	|jj|jd||f|z�yr	rr)rMr;�charsrks    rr
zText.inserts*��	S������d�g�g�x���6��=�>rc�X�	|jj|jdd||f�S)Nr"�gravityrr)rM�markName�	directions   r�mark_gravityzText.mark_gravitys/��	D��w�w�|�|�
�W�W�f�i��9�=�?�	?rc��	|jj|jj|jdd��S)Nr"rcr�rLs r�
mark_nameszText.mark_namess6��$��w�w� � �������G�G�V�W�"&�'�	'rc�X�	|jj|jdd||�y)Nr"rrr)rMr;r;s   r�mark_setz
Text.mark_sets!��>������T�W�W�f�e�X�u�=rc�\�	|jj|jddf|z�y)Nr"�unsetrr)rM�	markNamess  r�
mark_unsetzText.mark_unsets%��,������d�g�g�v�w�/�)�;�<rc�\�	|jj|jdd|�xsdS)Nr"�nextrrr]s  r�	mark_nextzText.mark_nexts'��;��w�w�|�|�D�G�G�V�V�U�;�C�t�Crc�\�	|jj|jdd|�xsdS)Nr"�previousrrr]s  r�
mark_previouszText.mark_previouss'��@��w�w�|�|�D�G�G�V�Z��?�G�4�Grc�z�	|jj|jdd|g|j||����y)N�peerrrL)rM�newPathNamer.rls    r�peer_createzText.peer_create!s;��	L�	������T�W�W�f�h��	%�
�]�]�3��
#�	%rc��	|jj|jj|jdd��S)NrMrcr�rLs r�
peer_nameszText.peer_names)s1��	��w�w� � ������d�g�g�v�w�!G�H�Hrc�\�	|jj|jd|||g|���y)Nrrr)rMr�r�r8rks     rrzText.replace.s,��	<�
	������T�W�W�i����F��Frc�X�	|jj|jdd||�yr rrrEs   rr#zText.scan_mark6r$rc�X�	|jj|jdd||�yr&rrrEs   rr)zText.scan_dragto:r�rc�F�	|jdg}|r|jd�|r|jd�|r|jd�|r|jd�|r|jd�|
r|jd�|	r"|jd�|j|	�|r|d	d
k(r|jd�|j|�|j|�|r|j|�t|jj	t|���S)Nrz	-forwardsz
-backwardsz-exactz-regexpz-nocasez-elidez-countrr6r�)rsr�rr;rr)rMr�r;�	stopindex�forwards�	backwards�exact�regexp�nocaserm�eliderks            rrzText.search@s���	�����"���T�[�[��-��d�k�k�,�/��$�+�+�h�'��4�;�;�y�)��4�;�;�y�)��$�+�+�h�'��$�+�+�h�'����U�);��w�q�z�S�(�$�+�+�d�*;����G�����E���d�k�k�)�,��4�7�7�<�<��d��,�-�-rc�T�	|jj|jd|�yr�rrr]s  rr�zText.seeTs��A������T�W�W�e�U�+rc�`�	|jj|jdd||f|z�y)N�tagr&rr)rM�tagNamer�rks    r�tag_addzText.tag_addXs.��	;������
�W�W�e�U�G�V�4�t�;�	=rc�F�	|j|jdd||f|�S�Nr_r�r�)rMr`r�r�s    rr�zText.tag_unbind^s'��	,��|�|�T�W�W�e�V�W�h�G��P�Prc�H�	|j|jdd|f|||�Srcr��rMr`r�r�r&s     rr�z
Text.tag_bindcs1��	I�
�z�z�4�7�7�E�6�7�;��D�#�'�	'rc�F�|j|jdd|f|||�Srcr�res     r�	_tag_bindzText._tag_bindls)���z�z�4�7�7�E�6�7�;��D�#�'�	'rc��	|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)Nrr6r�r�r_rrr)rMr`r�s   r�tag_cgetz
Text.tag_cgetqsT��9��"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�U�F�G�V�D�Drc�0�	|jdd|f||�S)Nr_rr
)rMr`r.rls    r�
tag_configurezText.tag_configureys��&�����{�G�<�c�2�F�Frc�\�	|jj|jddf|z�y)Nr_rXrr)rM�tagNamess  r�
tag_deletezText.tag_deletes%��*������d�g�g�u�h�/�(�:�;rc�X�	|jj|jdd||�y)Nr_r�rr)rMr`r�s   rrzText.tag_lower�s#��	+������T�W�W�e�W�g�y�Arc��	|jj|jj|jdd|��S)Nr_rcr�r]s  r�	tag_nameszText.tag_names�s6��-��w�w� � ��G�G�L�L����%��%�8�:�	:rc
��	|jj|jj|jdd|||��S)Nr_�	nextranger��rMr`r�r�s    r�
tag_nextrangezText.tag_nextrange�sC��	5��w�w� � �������G�G�U�K��&�&�"B�C�	Crc
��	|jj|jj|jdd|||��S)Nr_�	prevranger�rts    r�
tag_prevrangezText.tag_prevrange�sC��	7��w�w� � �������G�G�U�K��&�&�"B�C�	Crc�X�	|jj|jdd||�y)Nr_r�rr)rMr`r�s   rrzText.tag_raise�s&��	+�������G�G�U�G�W�i�	9rc��	|jj|jj|jdd|��S)Nr_�rangesr�)rMr`s  r�
tag_rangeszText.tag_ranges�s8��E��w�w� � �������G�G�U�H�g�"/�0�	0rc�Z�	|jj|jdd|||�y)Nr_r-rrrts    r�
tag_removezText.tag_remove�s&��O�������G�G�U�H�g�v�v�	?rc��	|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)Nrr6r�r�rqrrrr�s   r�window_cgetzText.window_cget�sT��H��"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�X�v�u�f�E�Erc�0�	|jdd|f||�S)Nrqrr
rAs    r�window_configurezText.window_configure�s��4�����+�u�=�s�B�G�Grc�~�	|jj|jdd|f|j||�z�y)NrqrrLrAs    r�
window_createzText.window_create�s8��'�������w�w��(�E�2��
�
�c�2�&�'�	(rc��	|jj|jj|jdd��S)Nrqrcr�rLs r�window_nameszText.window_names�s4��B��w�w� � ��G�G�L�L����(�G�4�6�	6rc�\�	|jj|jddf|z�y)Nr�z
-pickplacerr)rMr�s  r�yview_pickplacezText.yview_pickplace�s%��)������d�g�g�w��5��<�=rr�rl)NNNNNNNNrA):rOrPrQrr/r
rmrrXrrrr"r%r(r*r-rr0r2r4rdr;r
r=r?rArErHrKrOrQrr#r)rr�rar�r�rgrirk�
tag_configrnrrqrurxrr|r~r�r��
window_configr�r�r�r rrr	r	2sI��>�"��7�2>�5��(0�8�H�%.�P
4�	*�!�"�
&�	!�<�
E�G�')�*�7�:�?�
?�'�
>�=�D�H�,.�%�I�
G�4�6�04�04�7;�.�(,�=�Q�
'�'�
E�G��J�<�B�
:�
C�C�9�0�
?�
F�H�%�M�')�(�6�
>rr	c��eZdZ	dd�Zd�Zy)�_setitNc�.�||_||_||_yr�)�
_setit__value�_setit__var�_setit__callback)rM�varrr s    rrz_setit.__init__�s�������
�"��rc��|jj|j�|j�|j|jg|���yyr�)r�rr�r�rws  rrz_setit.__call__�s<���
�
���t�|�|�$��?�?�&��D�O�O�D�L�L�0�4�0�'rr�rxr rrr�r��s��H�#�
1rr�c� �eZdZ	d�Zd�Zd�Zy)�
OptionMenuc	��	d|dtddd�}tj||d|�d|_t	|dd�	�x}|_|j|_|jd
�}d
|vr|d
=|r tdtt|��z��|j|t|||���|D] }	|j|	t||	|����"||d<y)
Nr5rr/)�borderwidth�textvariable�indicatoron�reliefr,�highlightthicknessr��
tk_optionMenur�r)r��tearoffr�zunknown option -)r|r�)�RAISEDrwrrpr��_OptionMenu__menurs�menunamerr�rGr9r�r�)
rMr�r'rr(�kwargsrlr�r r2s
          rrzOptionMenu.__init__�s���	%����&�C�$%�'��	����f�l�B�7�)���!�$�V�Q�?�?��t�{�����
��:�:�i�(������y�!���-�d�4��<�.@�@�A�A����u���%��:�	�	<��A����1�#�H�a��:�
�
<����V�rc�P�|dk(r|jStj||�Sr�)r�rwrsrs  rrszOptionMenu.__getitem__�s&���6�>��;�;���!�!�$��-�-rc�>�	tj|�d|_yr�)r�r�r�rLs rr�zOptionMenu.destroy�s��:����4� ���rN)rOrPrQrrsr�r rrr�r��s��I��2.�
rr�c�T�eZdZ	dZdidfd�Zd�Zd�Zd�Zd�Zd�Z	e	Z
d	�Zd
�Zd�Z
y)�ImagerNc�r�d|_|�td�}t|d|�|_|s,txj
dz
c_dtj
��}|r|rt
||f�}n|r|}d}|j�D]\}}|d|z|fz}�|jjdd||f|z�||_y)	Nzcreate imager;r�pyimager r6rbr)	r�r�r�r;r��_last_idr3r,r)	rM�imgtyper�r.r�rlr<r1r2s	         rrzImage.__init__s�����	��>�&�~�6�F��&�$��/�����N�N�a��N�"'�.�.�2�D�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���Q���
�*�G� ������g�x��$�8�7�B�C���	rc��|jSr�)r�rLs rrNz
Image.__str__s��d�i�i�'rc��|jr)	|jjdd|j�yy#t$rYywxYw)NrbrX)r�r;rr�rLs rrz
Image.__del__s?���9�9�
������W�h��	�	�:����
��
�s�'7�	A�Ac�Z�|jj|jdd|z|�y�Nrr6�r;rr�rs   rrzImage.__setitem__s �������T�Y�Y��S��W�e�<rc�V�|jj|jdd|z�Sr�r�rs  rrszImage.__getitem__s!���w�w�|�|�D�I�I�{�C��G�<�<rc���	d}t|�j�D]\}}|��	|ddk(r|dd}|d|z|fz}�!|jj|jdf|z�y)Nr r�r�r6rr)r3r,r;rr�)rMrlr#r1r2s     rrzImage.configure"sq��"����b�M�'�'�)�D�A�q��}��R�5�C�<�Q�s��V���S��U�A�J�&��*�	
�����d�i�i��*�S�0�1rc��	|jj|jjdd|j��S)Nrbr��r;rMrr�rLs rr�zImage.height-s2��-��w�w�~�~��G�G�L�L��(�D�I�I�6�8�	8rc�R�	|jjdd|j�S)Nrbr'r�rLs rr'z
Image.type2s ��E��w�w�|�|�G�V�T�Y�Y�7�7rc��	|jj|jjdd|j��S)Nrbr�r�rLs rr�zImage.width6s2��,��w�w�~�~��G�G�L�L��'�4�9�9�5�7�	7r)rOrPrQr�rrNrrrsrrrr�r'r�r rrr�r��sE�� ��H�%)�r�$�� (��=�=�2��F�8�
8�7rr�c�f�eZdZ	didfd�Zd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
dd
�Zdd�Zd�Z
d
�Zy)�
PhotoImageNc�:�	tj|d|||fi|��y)N�photo�r�r�rMr�r.r�rls     rrzPhotoImage.__init__?s"��	�	���t�W�d�C��>�2�>rc�R�	|jj|jd�y)N�blankr�rLs rr�zPhotoImage.blankFs��*������T�Y�Y��(rc�X�	|jj|jdd|z�Srr�)rMr�s  rrzPhotoImage.cgetJs$��)��w�w�|�|�D�I�I�v�s�V�|�<�<rc�V�|jj|jdd|z�Srr�rs  rrszPhotoImage.__getitem__Os!���w�w�|�|�D�I�I�v�s�S�y�9�9rc��	t|j��}|jj|d|j�|S)Nr��copy�r�r;rr�)rM�	destImages  rr�zPhotoImage.copySs1��I��d�g�g�.�	������Y���	�	�2��rc��	t|j��}|dk(r|}|jj|d|jd||�|S)Nr�r�r�z-zoomr��rMr�r�r�s    r�zoomzPhotoImage.zoomYsF��	��d�g�g�.�	��b�5�A�!������Y���	�	�7�1�Q�?��rc��	t|j��}|dk(r|}|jj|d|jd||�|S)Nr�r�r�z
-subsampler�r�s    r�	subsamplezPhotoImage.subsamplecsF��	��d�g�g�.�	��b�5�A�!������Y���	�	�<��!�D��rc�T�	|jj|jd||�Sr[r�rEs   rrzPhotoImage.getms"��F��w�w�|�|�D�I�I�u�a��3�3rc��	|jd|f}|r|ddk(r|dd}|dzt|�z}|jj|�y)N�putr�-tor)r��r�rr;r)rMr�r7rks    rr�zPhotoImage.putqsS��	N��	�	�5�$�'��
��!�u��~����V���(�?�U�2�Y�.�D������T�rc��	|jd|f}|r|d|fz}|r|dzt|�z}|jj|�y)N�writez-format)z-fromr�)rM�filename�format�from_coordsrks     rr�zPhotoImage.write|sP��	!��	�	�7�H�-����9�f�-�-�D���*�$�u�[�'9�9�D������T�rc	��	|jj|jj|jdd||��S)N�transparencyr)r;rrr�rEs   r�transparency_getzPhotoImage.transparency_get�s:��=��w�w�!�!�$�'�'�,�,��I�I�~�u�a��#4�5�	5rc�Z�	|jj|jdd|||�y)Nr�rr�)rMr�r�rds    r�transparency_setzPhotoImage.transparency_set�s#��7������T�Y�Y���q�!�W�Err�r�rl)rOrPrQrr�rrsr�r�r�rr�r�r�r�r rrr�r�<sI��G� �b��?�)�=�
:����4���5�
Frr�c��eZdZ	didfd�Zy)�BitmapImageNc�:�	tj|d|||fi|��yr�r�r�s     rrzBitmapImage.__init__�s#��	Y�	���t�X�t�S�&�?�B�?rrr rrr�r��s��8� �b��@rr�c�n�td�j}|j|jdd��S)Nzuse image_names()rbrc�r�r;r7r�r;s rrdrd��-��	�.�	/�	2�	2�B�
�<�<������1�2�2rc�n�td�j}|j|jdd��S)Nzuse image_types()rbrfr�r�s rrgrg�r�rc��eZdZ	difd�Zd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zy)�SpinboxNc�8�	tj||d||�y)N�spinboxr�r�s    rrzSpinbox.__init__�s��	�4	����f�i��b�9rc�x�	|j|jj|jd|��xsdSr�rAr]s  rr/zSpinbox.bbox�s2��
	��}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�T�	|jj|jd||�Sr�rrrWs   rrXzSpinbox.delete�s&��	��w�w�|�|�D�G�G�X�u�d�;�;rc�P�	|jj|jd�Sr[rrrLs rrzSpinbox.get�s��*��w�w�|�|�D�G�G�U�+�+rc�R�	|jj|jd|�Srrrr]s  rrzSpinbox.icursor�s$��	�
�w�w�|�|�D�G�G�Y��6�6rc�T�	|jj|jd||�Sr�rrrEs   rr�zSpinbox.identify�s&��	��w�w�|�|�D�G�G�Z��A�6�6rc�R�	|jj|jd|�Srrrr]s  rr;z
Spinbox.index�s"��	��w�w�|�|�D�G�G�W�e�4�4rc�T�	|jj|jd||�Sr	rr)rMr;r�s   rr
zSpinbox.insert�s&��	��w�w�|�|�D�G�G�X�u�a�8�8rc�R�	|jj|jd|�Sr�rr�rM�elements  rr�zSpinbox.invoke�s$��	�
�w�w�|�|�D�G�G�X�w�7�7rc�~�	|j|jj|jdf|z��xsdS)Nr!r rArws  rr!zSpinbox.scanr�rc�(�	|jd|�S�Nr"�r!r:s  rr#zSpinbox.scan_mark	s��	��y�y���#�#rc�(�	|jd|�S)Nr'r�r:s  rr)zSpinbox.scan_dragtos��	��y�y��1�%�%rc�~�	|j|jj|jdf|z��xsdS)Nr�r rArws  rr�zSpinbox.selections<�� ��}�}��G�G�L�L�$�'�'�;�/�$�6�7�9�?�<>�	?rc�(�	|jd|�S)Nr,�r�r]s  rrczSpinbox.selection_adjust#s��
	��~�~�h��.�.rc�&�	|jd�S)Nr�r�rLs rr�zSpinbox.selection_clear1s��	�
�~�~�g�&�&rc�T�	|jj|jdd|�S)Nr�r�rrr�s  r�selection_elementzSpinbox.selection_element9s&��	�
�w�w�|�|�D�G�G�[�)�W�E�Erc�*�	|jd|�y)Nr2r�r]s  rrgzSpinbox.selection_fromAs��8����v�u�%rc��	|jj|jj|jdd��SrirrLs rrkzSpinbox.selection_presentErlrc�,�	|jd||�y)Nrnr�ros   rrqzSpinbox.selection_rangeKs��A����w��s�+rc�*�	|jd|�y)Nr7r�r]s  rrszSpinbox.selection_toOs��;����t�U�#rr�)rOrPrQrr/rXrrr�r;r
r�r!r#r)r�rcr�r�rgrkrqrsr rrr�r��sp���"��:�:K�	<�,�7�7�5�
9�8�:�
$�
&�?�
/�'�F�&�;�,�$rr�c��eZdZ	difd�Zy)�
LabelFrameNc�8�	tj||d||�y)N�
labelframer�r�s    rrzLabelFrame.__init__Ys��	�	����f�l�C��<rrr rrr�r�Vs���"��=rr�c�x�eZdZ	difd�Zd�Zd�ZeZd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zdd�ZeZd�Zy)�PanedWindowNc�8�	tj||d||�y)N�panedwindowr�r�s    rrzPanedWindow.__init__qs��	�	����f�m�S�"�=rc�z�	|jj|jd|f|j|�z�yr�rL)rMrrls   rr&zPanedWindow.add�s2��	�	
�����d�g�g�u�e�,�t�}�}�R�/@�@�Arc�T�	|jj|jd|�y�Nr�rr)rMrs  rr-zPanedWindow.remove�s!��	�	
�����T�W�W�h��.rc�T�	|jj|jd||�Sr�rrrEs   rr�zPanedWindow.identify�s&��	��w�w�|�|�D�G�G�Z��A�6�6rc�~�	|j|jj|jdf|z��xsdS)N�proxyr rArws  rrzPanedWindow.proxy�s<�� ��}�}��G�G�L�L�$�'�'�7�+�d�2�3�5�;�8:�	;rc�&�	|jd�S�N�coord�rrLs r�proxy_coordzPanedWindow.proxy_coord�s��	��z�z�'�"�"rc�&�	|jd�SrrrLs r�proxy_forgetzPanedWindow.proxy_forget�s��	��z�z�(�#�#rc�*�	|jd||�S�Nr(rrEs   r�proxy_placezPanedWindow.proxy_place�s��	��z�z�'�1�a�(�(rc�~�	|j|jj|jdf|z��xsdS)N�sashr rArws  rrzPanedWindow.sash�r�rc�(�	|jd|�Sr
�rr]s  r�
sash_coordzPanedWindow.sash_coord�s��
	��y�y��%�(�(rc�(�	|jd|�Sr�rr]s  r�	sash_markzPanedWindow.sash_mark�s��	��y�y���'�'rc�,�	|jd|||�Srr)rMr;r�r�s    r�
sash_placezPanedWindow.sash_place�s��	��y�y��%��A�.�.rc�b�	|jj|jdf|d|zfz�S)N�panecgetr6rr)rMrr�s   rrzPanedWindow.panecget�s8��	��w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�$�	|�|s|j|jd|�St|t�r#|s!|j	|jd|d|z�S|j
j
|jd|f|j||�z�y)N�
paneconfigurer6)rrsrrrr;rr�rs    rrzPanedWindow.paneconfigure�s���B	�F�;�r��%�%�d�g�g���H�H��c�3����&�&�����'�3�s�7�<�
<������d�g�g���8����s�B�'�(�	)rc��	|jj|jj|jd��S)N�panesr�rLs rr!zPanedWindow.panes)s-��9��w�w� � ������d�g�g�w�!?�@�@rr�)rOrPrQrr&r-r�r�rr
rrrrrrrr�
paneconfigr!r rrrrnsg���"��>� B�/��F�
7�;�
#�
$�
)�
:�
)�(�/�
9�J)�X�J�Arrc��t�}d|jd�z}|dz
}t||��}|j�t	|d|fd���}|j�||_t	|d|j��}|j�|j�|j�|j�|j�y)	NzThis is Tcl/Tk %s�
tk_patchLevelu
This should be a cedilla: ç�r�z	Click me!c�Z�|jjd|jdz��S)Nz[%s]r�r%)�testrr�s r�<lambda>z_test.<locals>.<lambda>7s)���	�	�(;�(;���	�	�&� 1�1�)<�)3r)r�r��QUIT)r�rrzrr�r'r�r�r(r�r[)r�r�r|r'r�s     r�_testr*0s���
�4�D���!2�!2�?�!C�C�D��.�.�D��$�T�"�E�	�J�J�L��$�[�"&�3�4�D�	�I�I�K��D�I��$�V�T�\�\�:�D��I�I�K�	�L�L�N��K�K�M��N�N���M�M�Orr�>r�__main__)TNr�ri)NNr�F)f�collections�enumr�rfr6r��tkinter.constantsrWrr
�floatr$�	TkVersionr%�
TclVersion�READABLE�WRITABLE�	EXCEPTION�compiler�ASCIIrr
r	r!r)r3rA�
namedtuplerCr]�_simple_enum�StrEnumr_r�r�r�r�r�r�r�r�r�rr�rCrJrPrTr[rZrMrNrr^rrzr�r�r�r=rrHrJrWr_rirwryr�r�rCr>rSrwrzr~r�r�r�r�r�r�r	r�r�r�r�r�rdrgr�r�rr*�globalsr,r�r�
ModuleType�__all__rO)r��objs00r�<module>r>s@���@��
��������	���	���(�%�%�&�	�
�8�'�'�
(�
������������	�
�B�J�J�{�#�	��B�J�J�y�"�(�(�+�	�,�
�8��!�!�X��$�#�#�Y��.S�-�{�-�-�.@�=�?�S�G�����4�<�<� �'�'�!�'�TO
�O
�d���
��	��"�	�
���q+�q+�h���02�X�2�2E��E�*A��A�<:�


���	�=�A�A�D(,�,�,?�?�*?�?�*m�m�`	p&��r�p&�f!$�
�
��,6�+,�+,�\0.�0.�f4,�4,�n>4��>4�B	�Z��u�d�	�8�z�2�8�<,/�V�,/�^q>�V�U�E�q>�h	��.(�&�.(�bS�F�E�S�l?�F�?�(8�F�8�0q�f�e�U�q�h~*�6�~*�B=��=�:�f�:�(�&�(�B$7�F�$7�N/2��/2�dT>�6�5�%�T>�n1�1�$��$�N;7�;7�|QF��QF�h@�%�@�3�
3�
m$�f�e�m$�d=��=�0}A�&�}A�D�*")����!2�,�!2�I�D�#��/�/�#�&�z�#�u�?O�?O�/P��?�*��!2�,���z��	�G���EO��t���,��t���PN,s*�/M1�>M=�+4N	�1M:�9M:�=N�N__pycache__/__init__.cpython-312.pyc000064400000740113151710635150013230 0ustar00�

T��hp��� �dZddlZddlZddlZddlZddlZejZddl�ddlZdZ	dZ
eej�Z
eej�Zej Zej"Zej$Zej&d�Zej&dej*�Zd�Zd	�Zd
�Zej2Zd�Zej6Zdud
�ZGd�dej:dd��Zd�Zej@ejB�Gd�d��Z"Gd�d�Z#da$da%d�Z&dvd�Z'd�Z(d�Z)d�Z*dwd�Z+da,Gd�d�Z-Gd�de-�Z.Gd �d!e-�Z/Gd"�d#e-�Z0Gd$�d%e-�Z1dwd&�Z2e3Z4eZ5d'�Z6Gd(�d)�Z7Gd*�d+�Z8Gd,�d-�Z9Gd.�d/�Z:Gd0�d1�Z;Gd2�d3e7e;�Z<ejzd4�d5�Z>dxd6�Z?Gd7�d8�Z@Gd9�d:�ZAGd;�d<�ZBGd=�d>e7�ZCGd?�d@eCe@eAeB�ZDGdA�dBeCe;�ZEGdC�dDeD�ZFGdE�dFeDe9e:�ZGdaHGdG�dHeD�ZIGdI�dJeDe9�ZJGdK�dLeD�ZKGdM�dNeD�ZLGdO�dPeDe9e:�ZMGdQ�dReD�ZNGdS�dTeD�ZOGdU�dVeD�ZPGdW�dXeD�ZQGdY�dZeD�ZRGd[�d\eD�ZSGd]�d^eDe9e:�ZTGd_�d`�ZUGda�dbeO�ZVGdc�dd�ZWGde�dfeW�ZXGdg�dheW�ZYdi�ZZdj�Z[Gdk�dleDe9�Z\Gdm�dneD�Z]Gdo�dpeD�Z^dq�Z_e`�j��D��cgc]/\}}|j�dr�sec|ej��s|dsvr|��1c}}Zeefdtk(re_�yy#e$rY���wxYw#e$rY���wxYwcc}}w)ya8Wrapper functions for Tcl/Tk.

Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow.

Properties of the widgets are specified with keyword arguments.
Keyword arguments have the same name as the corresponding resource
under Tk.

Widgets are positioned with one of the geometry managers Place, Pack
or Grid. These managers can be called with methods place, pack, grid
available in every Widget.

Actions are bound to events by resources (e.g. keyword argument
command) or with the method bind.

Example (Hello, World):
import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()
�N)�*�Fz([\\{}])z([\s])c�@�djtt|��S)�Internal function.� )�join�map�
_stringify��values �)/usr/lib64/python3.12/tkinter/__init__.py�_joinr:s���8�8�C�
�E�*�+�+�c�&�t|ttf�rHt|�dk(r*t	|d�}t
j
|�rd|z}|Sdt|�z}|St|t�r
t|d�}nt|�}|sd}|St
j
|�rMt
jd|�}|jdd�}tjd|�}|dd	k(rd
|z}|S|dd	k(stj
|�rd|z}|S)rrrz{%s}�latin1z{}z\\\1�
z\n�"�\)
�
isinstance�list�tuple�lenr
�	_magic_re�searchr�bytes�str�sub�replace�	_space_rers r
r
r
?s���%�$���'��u�:��?��u�Q�x�(�E�����&�����&�L�#�U�5�\�)�E�"�L��e�U�#���x�(�E���J�E���E��L��
�
�e�
$��M�M�'�5�1�E��M�M�$��.�E��M�M�'�5�1�E��Q�x�3���u����L��1�X��_�	� 0� 0�� 7��U�N�E��Lrc�t�d}|D]0}t|ttf�r|t|�z}�(|��+||fz}�2|S)r�)rrr�_flatten)�seq�res�items   r
r"r"[sE��
�C����d�U�D�M�*�����&�C�
�
����-�C�	�
�Jrc�6�t|t�r|St|td�tf�r|Si}t	|�D]}	|j|��|S#ttf$r3}td|�|j�D]
\}}|||<�Yd}~�Vd}~wwxYw)rNz_cnfmerge: fallback due to:)
r�dict�typerr"�update�AttributeError�	TypeError�print�items)�cnfs�cnf�c�msg�k�vs      r
�	_cnfmerger4js����$�����	�D�4��:�s�+�	,������$��A�
��
�
�1�
� ��
��	#�I�.�
��3�S�9��G�G�I�D�A�q��C��F�&��
�s�A�B�%)B�BTc���|j|�}t|�dzrtd��t|�}i}t	||�D].\}}t|�}|r
|ddk(r|dd}|r||�}|||<�0|S)aReturn a properly formatted dict built from Tcl list pairs.

    If cut_minus is True, the supposed '-' prefix will be removed from
    keys. If conv is specified, it is used to convert values.

    Tcl list is expected to contain an even number of elements.
    �zNTcl list representing a dict is expected to contain an even number of elementsr�-rN)�	splitlistr�RuntimeError�iter�zipr)	�tkr3�	cut_minus�conv�t�itr'�keyrs	         r
�
_splitdictrB�s���	���Q��A�
�1�v��z��C�D�	D�	
�a��B�
�D��"�b�k�
��U��#�h����Q��3���a�b�'�C����K�E���S�	�
"��Krc��eZdZd�Zy)�_VersionInfoTypec���|jdk(r(|j�d|j�d|j��S|j�d|j�|jd�|j��S)N�final�.r)�releaselevel�major�minor�micro�serial��selfs r
�__str__z_VersionInfoType.__str__�sd������'��j�j�\��4�:�:�,�a��
�
�|�<�<��j�j�\��4�:�:�,�t�/@�/@��/C�.D�T�[�[�M�R�RrN)�__name__�
__module__�__qualname__rOr!rr
rDrD�s��SrrD)rIrJrKrHrLc���ddl}|jd|�}|j�\}}}}t|�t|�t|�}}}|dk(r|}d}d}n
d}ddd�|}t	|||||�S)Nrz(\d+)\.(\d+)([ab.])(\d+)rGrF�alpha�beta)�a�b)�re�	fullmatch�groups�intrD)�versionrX�mrIrJrHrLrKs        r
�_parse_versionr^�s���
�����0�'�:�A�)*����&�E�5�,���u�:�s�5�z�3�v�;�&�5�E��s����������$�6�2�<�@���E�5�%��v�F�Frc��eZdZdZeZdZdZeZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)y&)'�	EventType�2�3�4�5�6�7�8�9�10�11�12�13�14�15�16�17�18�19�20�21�22�23�24�25�26�27�28�29�30�31�32�33�34�35�36�37�38N)*rPrQrR�KeyPress�Key�
KeyRelease�ButtonPress�Button�
ButtonRelease�Motion�Enter�Leave�FocusIn�FocusOut�Keymap�Expose�GraphicsExpose�NoExpose�
Visibility�Create�Destroy�Unmap�Map�
MapRequest�Reparent�	Configure�ConfigureRequest�Gravity�
ResizeRequest�	Circulate�CirculateRequest�Property�SelectionClear�SelectionRequest�	Selection�Colormap�
ClientMessage�Mapping�VirtualEvent�Activate�
Deactivate�
MouseWheelr!rr
r`r`�s����H�
�C��J��K�
�F��M�
�F��E��E��G��H�
�F�
�F��N��H��J�
�F��G��E�
�C��J��H��I����G��M��I����H��N����I��H��M��G��L��H��J��Jrr`c��eZdZdZd�Zy)�Eventa�Container for the properties of an event.

    Instances of this type are generated if one of the following events occurs:

    KeyPress, KeyRelease - for keyboard events
    ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events
    Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate,
    Colormap, Gravity, Reparent, Property, Destroy, Activate,
    Deactivate - for window events.

    If a callback function for one of these events is registered
    using bind, bind_all, bind_class, or tag_bind, the callback is
    called with an Event as first argument. It will have the
    following attributes (in braces are the event types for which
    the attribute is valid):

        serial - serial number of event
    num - mouse button pressed (ButtonPress, ButtonRelease)
    focus - whether the window has the focus (Enter, Leave)
    height - height of the exposed window (Configure, Expose)
    width - width of the exposed window (Configure, Expose)
    keycode - keycode of the pressed key (KeyPress, KeyRelease)
    state - state of the event as a number (ButtonPress, ButtonRelease,
                            Enter, KeyPress, KeyRelease,
                            Leave, Motion)
    state - state as a string (Visibility)
    time - when the event occurred
    x - x-position of the mouse
    y - y-position of the mouse
    x_root - x-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    y_root - y-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    char - pressed character (KeyPress, KeyRelease)
    send_event - see X/Windows documentation
    keysym - keysym of the event as a string (KeyPress, KeyRelease)
    keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
    type - type of the event as a number
    widget - widget in which the event occurred
    delta - delta of wheel movement (MouseWheel)
    c��	�|jj�D��cic]\}}|dk7s�||��c}}�	|js�	d=n'|jdk7rt|j��	d<t	|dd�s�	d=|j
dk(r�	d=n�t
|j
t�r�|j
}d}g}t|�D]\}}|d|zzs�|j|��!|dt|�zdz
z}|s|s|jt|��d	j|��	d<|jdk(r�	d
=d}dt	|jd
|j��ddj�	fd�|D���d�Scc}}w)Nz??�char�
send_eventTr�state)
�Shift�Lock�Control�Mod1�Mod2�Mod3�Mod4�Mod5�Button1�Button2�Button3�Button4�Button5r�|�delta)r�r��keysym�keycoder��numr��focus�x�y�width�height�<�namez event�c3�>�K�|]}|�vs�d|�d�|�����y�w)r�=Nr!)�.0r2�attrss  �r
�	<genexpr>z!Event.__repr__.<locals>.<genexpr>'s!�����I�d��a�5�j��5��8�,�d�s�	��>)�__dict__r-r��repr�getattrr�rr[�	enumerate�appendr�hexrr�r()
rNr2r3r��mods�s�i�n�keysr�s
         @r
�__repr__zEvent.__repr__sh���"&�-�-�"5�"5�"7�E�"7�$�!�Q�1��9��A��"7�E���y�y��f�
�
�Y�Y�$�
� ����O�E�&�M��t�\�4�0��l�#��:�:��?��g��
��
�
�C�
(��J�J�E�K�D��A�!�$����1��A��F�#��H�H�Q�K�(��q�3�t�9�}��1�2�2�E��A�����U��$� �X�X�a�[�E�'�N��:�:��?��g��
-��

�D�I�I�v�t�y�y�1��G�G�I�d�I�I�
�	
��AFs
�
F�FN)rPrQrR�__doc__r�r!rr
r�r��s
��(�T$
rr�c��dadaby)z�Inhibit setting of default root window.

    Call this function to inhibit that the first instance of
    Tk is used for windows without an explicit parent window.
    FN)�_support_default_root�
_default_rootr!rr
�
NoDefaultRootr�/s��"���M�rc��tstd��t�%|rtd|�d���t�}t|usJ�tS)N�INo master specified and tkinter is configured to not support default rootz
Too early to z: no default root window)r�r9r��Tk)�what�roots  r
�_get_default_rootr�=sS�� ��D�E�	E������t�f�4L�M�N�N��t����$�$�$��rc��tstd��t}|�5tsJ�dat�}dat�J�|j	�d|_|S)Nr�FT)r�r9r�r��withdraw�
_temporary�r�s r
�_get_temp_rootr�Isa�� ��D�E�	E��D��|�$�$�$� %���t�� $���$�$�$��
�
������Krc�`�t|dd�r	|j�yy#t$rYywxYw)Nr�F)r��destroy�TclError��masters r
�_destroy_temp_rootr�Zs6���v�|�U�+�	��N�N��,���	��	�s�!�	-�-c��y�rNr!)�errs r
�_tkerrorr�bs��rc�b�	t|�}t|��#t$r
Yt|��wxYw)zBInternal function. Calling it will raise the exception SystemExit.)r[�
ValueError�
SystemExit)�codes r
�_exitr�gs<��
��4�y���T�
����
��
�T�
��
�s��	.�.c�t�eZdZdZdZdZdZdd�Zd�Zd�Z	d�Z
e
Zd�Zd	�Z
d
�Zd�Zd�Zd
�ZeZd�Zd�Zd�Zy)�Variablez�Class to define value holders for e.g. buttons.

    Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations
    that constrain the type of the value returned from get().r�Nc���|�t|t�std��|�td�}|j	�|_|j
|_|r||_n dtt�z|_tdz
a	|�|j|�y|jj|jjdd|j��s|j|j�yy)a.Construct a variable

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        Nzname must be a stringzcreate variable�PY_VARr�info�exists)rrr+r��_rootr<�_tk�_namer��_varnum�
initialize�
getboolean�call�_default�rNr�rr�s    r
�__init__zVariable.__init__|s�����J�t�S�$9��3�4�4��>�&�'8�9�F��\�\�^��
��9�9�����D�J�!�D��M�1�D�J��q�L�G����O�O�E�"����$�$�T�X�X�]�]�6�8�T�Z�Z�%P�Q��O�O�D�M�M�*�Rrc�h�|j�y|jj|jjdd|j��r%|jj	|j�|j
�4|j
D]}|jj
|��d|_yy)zUnset the variable in Tcl.Nrr)rr	r
r�globalunsetvar�_tclCommands�
deletecommand�rNr�s  r
�__del__zVariable.__del__�s����8�8����8�8���t�x�x�}�}�V�X�t�z�z�J�K��H�H�#�#�D�J�J�/����(��)�)�����&�&�t�,�*� $�D��)rc��|jS)z'Return the name of the variable in Tcl.)rrMs r
rOzVariable.__str__�s���z�z�rc�N�|jj|j|�S�zSet the variable to VALUE.)r�globalsetvarr�rNrs  r
�setzVariable.set�s���x�x�$�$�T�Z�Z��7�7rc�L�|jj|j�S)zReturn value of variable.)r�globalgetvarrrMs r
�getzVariable.get�s���x�x�$�$�T�Z�Z�0�0rc�z�t|d|j�j}tt	|��}	|j
}	||jz}|jj||�|j�g|_
|jj|�|S#t$rY�gwxYw#t$rY�fwxYw�N)�CallWrapperr�__call__r��id�__func__r*rPr�
createcommandrr�)rN�callback�f�cbnames    r
�	_registerzVariable._register�s�����$��
�
�3�<�<���b��e���	��(�(�H�	��h�/�/�/�F�	
�����v�q�)����$� "�D����� � ��(��
���	��	���	��	�s#�B�B.�	B+�*B+�.	B:�9B:c�~�|j|�}|jjddd|j||f�|S)a#Define a trace callback for the variable.

        Mode is one of "read", "write", "unset", or a list or tuple of
        such strings.
        Callback must be a function which is called when the variable is
        read, written or unset.

        Return the name of the callback.
        �trace�add�variable�r'rr
r�rN�moder$r&s    r
�	trace_addzVariable.trace_add�s:������)�����
�
�g�u�j��j�j�$��	�	3��
rc�Z�|jjddd|j||�|j�D](\}}|jj	|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)aDelete the trace callback for a variable.

        Mode is one of "read", "write", "unset" or a list or tuple of
        such strings.  Must be same as were specified in trace_add().
        cbname is the name of the callback returned from trace_add().
        r)�remover+rN)	rr
r�
trace_infor8rrr1r��rNr.r&r]�cas     r
�trace_removezVariable.trace_remove�s���	
���
�
�g�x���j�j�$��	0��_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s�B�	B*�)B*c���|jj}t|||jjddd|j���D��cgc]\}}||�|f��c}}Scc}}w)z&Return all trace callback information.r)rr+)rr8r	r
r)rNr8r2r3s    r
r2zVariable.trace_info�sq���H�H�&�&�	�.1�)��d�h�h�m�m�G�V�Z����L�M�/O�P�/O�d�a���1��q�!�/O�P�	P��Ps�A*c�z�|j|�}|jjdd|j||�|S)a�Define a trace callback for the variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CALLBACK must be a function which is called when
        the variable is read, written or undefined.

        Return the name of the callback.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_add() instead.
        r)r+r,r-s    r
�trace_variablezVariable.trace_variable�s3������)�����
�
�g�z�4�:�:�t�V�D��
rc��|jjdd|j||�|jj|�d}|j	�D](\}}|jj|�d|k(s�(y|jj|�	|jj|�y#t$rYywxYw)aSDelete the trace callback for a variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CBNAME is the name of the callback returned from trace_variable or trace.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_remove() instead.
        r)�vdeleterN)	rr
rr8r2rrr1r�r3s     r
�
trace_vdeletezVariable.trace_vdelete�s���	
���
�
�g�y�$�*�*�d�F�C����#�#�F�+�A�.���_�_�&�E�A�r��x�x�!�!�"�%�a�(�F�2��'�
�H�H�"�"�6�*�
��!�!�(�(��0���
��
�s�B;�;	C�Cc���|jj|jjdd|j��D�cgc]}|jj|���c}Scc}w)z�Return all trace callback information.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_info() instead.
        r)�vinfo)rr8r
r�rNr�s  r
�trace_vinfozVariable.trace_vinfos`��04�x�x�/A�/A��H�H�M�M�'�7�D�J�J�7�09�:�09�!����"�"�1�%�09�:�	:��:s�"A(c���t|t�stS|j|jk(xrH|jj
|jj
k(xr|j|jk(Sr)rr��NotImplementedr�	__class__rPr)rN�others  r
�__eq__zVariable.__eq__s]���%��*�!�!��
�
�e�k�k�)�*��N�N�+�+�u���/G�/G�G�*��H�H��	�	�)�	+r�NNN)rPrQrRr�rrrr
rrOrrrr'r/r5r2r8r)r;r?rDr!rr
r�r�ssi��A��H�
�C��L�+�<	%��8��J�1��"
��&P��"
�E��,:�+rr�c�"�eZdZdZdZdd�Zd�Zy)�	StringVarz#Value holder for strings variables.r�Nc�4�tj||||�y)a6Construct a string variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        N�r�r
rs    r
r
zStringVar.__init__+���	���$���t�4rc��|jj|j�}t|t�r|St	|�S)z#Return value of variable as string.)rrrrrrs  r
rz
StringVar.get7s3�����%�%�d�j�j�1���e�S�!��L��5�z�rrE�rPrQrRr�rr
rr!rr
rGrG's��-��H�
5�rrGc�"�eZdZdZdZdd�Zd�Zy)�IntVarz#Value holder for integer variables.rNc�4�tj||||�y)a7Construct an integer variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zIntVar.__init__CrJrc��|jj|j�}	|jj|�S#tt
f$r't
|jj|��cYSwxYw)z/Return the value of the variable as an integer.)rrr�getintr+r�r[�	getdoublers  r
rz
IntVar.getOs`�����%�%�d�j�j�1��	2��8�8�?�?�5�)�)���8�$�	2��t�x�x�)�)�%�0�1�1�	2�s�A�3A8�7A8rErLr!rr
rNrN?s��-��H�
5�2rrNc�"�eZdZdZdZdd�Zd�Zy)�	DoubleVarz!Value holder for float variables.gNc�4�tj||||�y)a6Construct a float variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0.0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zDoubleVar.__init__\rJrc�~�|jj|jj|j��S)z,Return the value of the variable as a float.)rrRrrrMs r
rz
DoubleVar.geths*���x�x�!�!�$�(�(�"7�"7��
�
�"C�D�DrrErLr!rr
rTrTXs��+��H�
5�ErrTc�,�eZdZdZdZdd�Zd�ZeZd�Zy)�
BooleanVarz#Value holder for boolean variables.FNc�4�tj||||�y)a:Construct a boolean variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to False)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        NrIrs    r
r
zBooleanVar.__init__qrJrc��|jj|j|jj|��Sr)rrrr	rs  r
rzBooleanVar.set}s,���x�x�$�$�T�Z�Z����1D�1D�U�1K�L�Lrc��	|jj|jj|j��S#t$rtd��wxYw)z+Return the value of the variable as a bool.� invalid literal for getboolean())rr	rrr�r�rMs r
rzBooleanVar.get�sM��	A��8�8�&�&�t�x�x�'<�'<�T�Z�Z�'H�I�I���	A��?�@�@�	A�s�=A�ArE)	rPrQrRr�rr
rrrr!rr
rXrXms"��-��H�
5�M��J�ArrXc�L�td�jj|�y)zRun the main loop of Tcl.zrun the main loopN)r�r<�mainloop)r�s r
r^r^�s���)�*�-�-�6�6�q�9rc�|�	td�jj|�S#t$rt	d��wxYw)z$Convert Tcl object to True or False.zuse getboolean()r\)r�r<r	r�r�)r�s r
r	r	�s?��=� �!3�4�7�7�B�B�1�E�E���=��;�<�<�=�s�#&�;c�X�eZdZdZdZdZd�Zd�Zd�d�Zd�Z	d�Z
d�d�ZeZd�d	�Z
d�d
�Zd�d�Zd�d�Zd
�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�d�Zd�Zd�Zd�d�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d�d$�Z)d%�Z*d&�Z+d�d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d-�Z2d�d.�Z3d�d/�Z4e4Z5d0�Z6d�d1�Z7d�d2�Z8d3�Z9d4�Z:d5�Z;d6�Z<d�d7�Z=d8�Z>d9�Z?d:�Z@d;�ZAd<�ZBd=�ZCd�d>�ZDd?�ZEd@�ZFdA�ZGdB�ZHd�dC�ZIdD�ZJdE�ZKdF�ZLdG�ZMdH�ZNdI�ZOdJ�ZPdK�ZQdL�ZRdM�ZSdN�ZTdO�ZUdP�ZVdQ�ZWdR�ZXdS�ZYdT�ZZdU�Z[dV�Z\dW�Z]dX�Z^dY�Z_d�dZ�Z`d[�Zad\�Zbd]�Zcd^�Zdd_�Zed`�Zfda�Zgdb�Zhdc�Zidd�Zjde�Zkd�df�Zld�dg�Zmd�dh�Znd�di�Zod�dj�Zpd�dk�Zqdl�Zrd�dm�Zsdn�Ztd�do�Zudp�Zvdq�Zwdr�Zxds�Zydt�Zze{du��Z|d�dv�Z}dw�Z~e~Zd�dx�Z�e�Z�dy�Z�dzZ�d{�j	e��Z�d|�Z�d}�Z�d~�Z�d�Z�d��Z�d�d��Z�e�Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d�gZ�e�fd��Z�e�Z�d��Z�e�Z�d��Z�d�d��Z�e�Z�d�d��Z�e�Z�d��Z�d��Z�ifd��Z�e�Z�d��Z�e�fd��Z�ifd��Z�e�Z�d��Z�e�Z�d�d��Z�d��Z�d��Z�d��Z�d�d��Z�d��Z�d��Z�y)��MisczRInternal class.

    Base class which defines methods common for interior widgets.Nc��|j�4|jD]}|jj|��d|_yy)zkInternal function.

        Delete all Tcl commands created for
        this widget in the Tcl interpreter.N)rr<rrs  r
r�zMisc.destroy�s?��
���(��)�)�����%�%�d�+�*� $�D��)rc��|jj|�	|jj|�y#t$rYywxYw)zDInternal function.

        Delete the Tcl command provided in NAME.N)r<rrr1r�rs  r
rzMisc.deletecommand�sA��	
�����d�#�	����$�$�T�*���	��	�s�9�	A�Ac�n�|jj|jjdd|��S)z�Set Tcl internal variable, whether the look and feel
        should adhere to Motif.

        A parameter of 1 means adhere to Motif (e.g. no color
        change if mouse passes over slider).
        Returns the set value.r�tk_strictMotif)r<r	r
�rN�booleans  r
rezMisc.tk_strictMotif�s2���w�w�!�!�$�'�'�,�,��#�W�#.�/�	/rc�:�|jjd�y)zDChange the color scheme to light brown as used in Tk 3.6 and before.�	tk_bisqueN�r<r
rMs r
rizMisc.tk_bisque�s�������[�!rc	��|jjdt|�ztt|j	���z�y)aSet a new color scheme for all widget elements.

        A single color as argument will cause that all colors of Tk
        widget elements are derived from this.
        Alternatively several keyword parameters and its associated
        colors can be given. The following keywords are valid:
        activeBackground, foreground, selectColor,
        activeForeground, highlightBackground, selectBackground,
        background, highlightColor, selectForeground,
        disabledForeground, insertBackground, troughColor.)�
tk_setPaletteN)r<r
r"rr-�rN�args�kws   r
rlzMisc.tk_setPalette�s;��	
�����'�����!)�$�r�x�x�z�*:�!;�<�	=rc�>�|jjdd|�y)z�Wait until the variable is modified.

        A parameter of type IntVar, StringVar, DoubleVar or
        BooleanVar must be given.�tkwaitr+Nrjrs  r
�
wait_variablezMisc.wait_variable�s��
	
�����X�z�4�0rc�Z�|�|}|jjdd|j�y)zQWait until a WIDGET is destroyed.

        If no parameter is given self is used.Nrq�window�r<r
�_w�rNrts  r
�wait_windowzMisc.wait_window�s&���>��F������X�x����3rc�Z�|�|}|jjdd|j�y)zxWait until the visibility of a WIDGET changes
        (e.g. it appears).

        If no parameter is given self is used.Nrq�
visibilityrurws  r
�wait_visibilityzMisc.wait_visibility�s&��
�>��F������X�|�V�Y�Y�7rc�<�|jj||�y)zSet Tcl variable NAME to VALUE.N)r<�setvar)rNr�rs   r
r}zMisc.setvar�s�������t�U�#rc�8�|jj|�S)z"Return value of Tcl variable NAME.)r<�getvarrs  r
rzMisc.getvar�s���w�w�~�~�d�#�#rc��	|jj|�S#t$r}tt	|���d}~wwxYwr)r<rQr�r�r�rNr��excs   r
rQzMisc.getint�s9��	'��7�7�>�>�!�$�$���	'��S��X�&�&��	'����	?�:�?c��	|jj|�S#t$r}tt	|���d}~wwxYwr)r<rRr�r�rr�s   r
rRzMisc.getdoubles;��	'��7�7�$�$�Q�'�'���	'��S��X�&�&��	'�r�c�j�	|jj|�S#t$rtd��wxYw)zPReturn a boolean value for Tcl boolean values true and false given as parameter.r\)r<r	r�r�)rNr�s  r
r	zMisc.getbooleans:��	A��7�7�%�%�a�(�(���	A��?�@�@�	A�s��2c�P�|jjd|j�y)z�Direct input focus to this widget.

        If the application currently does not have the focus
        this widget will get the focus if the application gets
        the focus through the window manager.r�NrurMs r
�	focus_setzMisc.focus_sets��	
�����W�d�g�g�&rc�R�|jjdd|j�y)ztDirect input focus to this widget even if the
        application does not have the focus. Use with
        caution!r�z-forceNrurMs r
�focus_forcezMisc.focus_forces��	
�����W�h����0rc�j�|jjd�}|dk(s|sy|j|�S)z�Return the widget which has currently the focus in the
        application.

        Use focus_displayof to allow working with several
        displays. Return None if application does not have
        the focus.r��noneN)r<r
�
_nametowidgetrs  r
�	focus_getzMisc.focus_gets2���w�w�|�|�G�$���6�>��d��!�!�$�'�'rc��|jjdd|j�}|dk(s|sy|j|�S)z�Return the widget which has currently the focus on the
        display where this widget is located.

        Return None if the application does not have the focus.r��
-displayofr�N�r<r
rvr�rs  r
�focus_displayofzMisc.focus_displayof(s:��
�w�w�|�|�G�\�4�7�7�;���6�>��d��!�!�$�'�'rc��|jjdd|j�}|dk(s|sy|j|�S)zyReturn the widget which would have the focus if top level
        for this widget gets the focus from the window manager.r�z-lastforr�Nr�rs  r
�
focus_lastforzMisc.focus_lastfor1s:���w�w�|�|�G�Z����9���6�>��d��!�!�$�'�'rc�:�|jjd�y)zXThe widget under mouse will get automatically focus. Can not
        be disabled easily.�tk_focusFollowsMouseNrjrMs r
r�zMisc.tk_focusFollowsMouse8s��	
�����+�,rc�v�|jjd|j�}|sy|j|�S)anReturn the next widget in the focus order which follows
        widget which has currently the focus.

        The focus order first goes to the next child, then to
        the children of the child recursively and then to the
        next sibling which is higher in the stacking order.  A
        widget is omitted if it has the takefocus resource set
        to 0.�tk_focusNextNr�rs  r
r�zMisc.tk_focusNext=s2���w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�v�|jjd|j�}|sy|j|�S)zHReturn previous widget in the focus order. See tk_focusNext for details.�tk_focusPrevNr�rs  r
r�zMisc.tk_focusPrevJs0���w�w�|�|�N�D�G�G�4���D��!�!�$�'�'rc�*��������jjd|�y����fd�}	�j|_�j|���jjd|��S#t$rt	��j|_Y�SwxYw)aCall function once after given time.

        MS specifies the time in milliseconds. FUNC gives the
        function which shall be called. Additional parameters
        are given as parameters to the function call.  Return
        identifier to cancel scheduling with after_cancel.N�afterc���	���	�j��y#t$rYywxYw#	�j��w#t$rYwwxYwxYwr)rr�)rn�funcr�rNs����r
�callitzMisc.after.<locals>.callit\sY�����$�K���*�*�4�0��#�������*�*�4�0��#����s5�*��	'�'�A
�>�A
�	A
�A
�	A
�
A
)r<r
rPr*r(r')rN�msr�rnr�r�s` `` @r
r�z
Misc.afterPs}����<��G�G�L�L��"�%��
�
6�"&�-�-����>�>�&�)�D��7�7�<�<���T�2�2��	"�
6�"&�t�*�"5�"5���
6�s�A,�,#B�Bc�*�|jd|g|���S)z�Call FUNC once if the Tcl main loop has no event to
        process.

        Return an identifier to cancel the scheduling with
        after_cancel.�idle)r�)rNr�rns   r
�
after_idlezMisc.after_idlels���t�z�z�&�$�.��.�.rc��|std��	|jjdd|�}|jj|�d}|j	|�|jjdd|�y#t
$rY�)wxYw)z�Cancel scheduling of function identified with ID.

        Identifier returned by after or after_idle must be
        given as first parameter.
        z?id must be a valid identifier returned from after or after_idler�rr�cancelN)r�r<r
r8rr�)rNr!�data�scripts    r
�after_cancelzMisc.after_cancelts�����3�4�
4�	��7�7�<�<����4�D��W�W�&�&�t�,�Q�/�F����v�&�	
�����W�h��+���	��	�s�AA9�9	B�Bc�^�|jjd|j|�z�y)zRing a display's bell.)�bellN)r<r
�
_displayof�rN�	displayofs  r
r�z	Misc.bell�s �������Y�����!;�;�<rc��d|vrB|jdk(r3	d|d<|jjd|j|�z�S|jjd|j|�z�S#t$r|d=Y�;wxYw)a�Retrieve data from the clipboard on window's display.

        The window keyword defaults to the root window of the Tkinter
        application.

        The type keyword specifies the form in which the data is
        to be returned and should be an atom name such as STRING
        or FILE_NAME.  Type defaults to STRING, except on X11, where the default
        is to try UTF8_STRING and fall back to STRING.

        This command is equivalent to:

        selection_get(CLIPBOARD)
        r(�x11�UTF8_STRING)�	clipboardr)�_windowingsystemr<r
�_optionsr��rNros  r
�
clipboard_getzMisc.clipboard_get�s������� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1A4�4B�Bc��d|vr|j|d<|jjd|j|�z�y)z�Clear the data in the Tk clipboard.

        A widget specified for the optional displayof keyword
        argument specifies the target display.r�)r��clearN�rvr<r
r�r�s  r
�clipboard_clearzMisc.clipboard_clear�s7��
�b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc��d|vr|j|d<|jjd|j|�zd|fz�y)z�Append STRING to the Tk clipboard.

        A widget specified at the optional displayof keyword
        argument specifies the target display. The clipboard
        can be retrieved with selection_get.r�)r�r��--Nr�)rN�stringros   r
�clipboard_appendzMisc.clipboard_append�sE���b� �D�G�G�"�[�/������,�t�}�}�R�/@�@��v���	 rc�x�|jjdd|j�}|sy|j|�S)zOReturn widget which has currently the grab in this application
        or None.�grab�currentNr�rs  r
�grab_currentzMisc.grab_current�s4���w�w�|�|�F�I�t�w�w�7���D��!�!�$�'�'rc�R�|jjdd|j�y)z.Release grab for this widget if currently set.r��releaseNrurMs r
�grab_releasezMisc.grab_release�s�������V�Y����0rc�R�|jjdd|j�y)zwSet grab for this widget.

        A grab directs all events to this and descendant
        widgets in the application.r�rNrurMs r
�grab_setz
Misc.grab_set�s��
	
�����V�U�D�G�G�,rc�T�|jjddd|j�y)z�Set global grab for this widget.

        A global grab directs all events to this and
        descendant widgets on the display. Use with caution -
        other applications do not get events anymore.r�rz-globalNrurMs r
�grab_set_globalzMisc.grab_set_global�s��	
�����V�U�I�t�w�w�7rc�b�|jjdd|j�}|dk(rd}|S)zYReturn None, "local" or "global" if this widget has
        no, a local or a global grab.r��statusr�Nru)rNr�s  r
�grab_statuszMisc.grab_status�s/�������f�h����8���V��d�V��
rc�B�|jjdd|||�y)z�Set a VALUE (second parameter) for an option
        PATTERN (first parameter).

        An optional third parameter gives the numeric priority
        (defaults to 80).�optionr*Nrj)rN�patternr�prioritys    r
�
option_addzMisc.option_add�s��	
�����X�u�g�u�h�?rc�<�|jjdd�y)zPClear the option database.

        It will be reloaded if option_add is called.r�r�NrjrMs r
�option_clearzMisc.option_clear�s��	
�����X�w�'rc�T�|jjdd|j||�S)z�Return the value for an option NAME for this widget
        with CLASSNAME.

        Values with higher priority override lower values.r�rru)rNr��	classNames   r
�
option_getzMisc.option_get�s#��
�w�w�|�|�H�e�T�W�W�d�I�F�Frc�@�|jjdd||�y)zvRead file FILENAME into the option database.

        An optional second parameter gives the numeric
        priority.r��readfileNrj)rN�fileNamer�s   r
�option_readfilezMisc.option_readfile�s��
	
�����X�z�8�X�>rc��d|vr|j|d<|jjd|j|�z�y)zClear the current X selection.r�)�	selectionr�Nr�r�s  r
�selection_clearzMisc.selection_clear�s5���b� �D�G�G�"�[�/������+�d�m�m�B�.?�?�@rc�2�d|vr|j|d<d|vrB|jdk(r3	d|d<|jjd|j	|�z�S|jjd|j	|�z�S#t
$r|d=Y�;wxYw)a�Return the contents of the current X selection.

        A keyword parameter selection specifies the name of
        the selection and defaults to PRIMARY.  A keyword
        parameter displayof specifies a widget on the display
        to use. A keyword parameter type specifies the form of data to be
        fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
        before STRING.r�r(r�r�)r�r)rvr�r<r
r�r�r�s  r
�
selection_getzMisc.selection_get�s����b� �D�G�G�"�[�/����� 5� 5�� >�
�*��6�
��w�w�|�|�$8�4�=�=��;L�$L�M�M��w�w�|�|�0�4�=�=��3D�D�E�E���
��v�J�
�s�1B�B�Bc��|j|�}|jjd|j|�z|j|fz�y)aSpecify a function COMMAND to call if the X
        selection owned by this widget is queried by another
        application.

        This function must return the contents of the
        selection. The function will be called with the
        arguments OFFSET and LENGTH which allows the chunking
        of very long selections. The following keyword
        parameters can be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME).)r��handleN)r'r<r
r�rv)rN�commandror�s    r
�selection_handlezMisc.selection_handlesC���~�~�g�&�������,�t�}�}�R�/@�@����$�� �	!rc�z�|jjd|j|�z|jfz�y)z�Become owner of X selection.

        A keyword parameter selection specifies the name of
        the selection (default PRIMARY).�r��ownN)r<r
r�rvr�s  r
�
selection_ownzMisc.selection_owns6��
	
�����)����r�"�#�&*�g�g�Z�0�	1rc��d|vr|j|d<|jjd|j|�z�}|sy|j	|�S)z�Return owner of X selection.

        The following keyword parameter can
        be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME).r�r�N)rvr<r
r�r�)rNror�s   r
�selection_own_getzMisc.selection_own_get sO���b� �D�G�G�"�[�/��w�w�|�|�0�4�=�=��3D�D�E���D��!�!�$�'�'rc�D�|jjd||f|z�S)zDSend Tcl command CMD to different interpreter INTERP to be executed.�sendrj)rN�interp�cmdrns    r
r�z	Misc.send,s!���w�w�|�|�V�V�S�1�D�8�9�9rc�R�|jjd|j|�y)z(Lower this widget in the stacking order.�lowerNru)rN�	belowThiss  r
r�z
Misc.lower0��������W�d�g�g�y�1rc�R�|jjd|j|�y)z(Raise this widget in the stacking order.�raiseNru)rN�	aboveThiss  r
�tkraisezMisc.tkraise4r�rc�P�|jjdd�}t|�S)z-Returns the exact version of the Tcl library.r�
patchlevel)r<r
r^)rNr�s  r
�info_patchlevelzMisc.info_patchlevel:s!���W�W�\�\�&�,�7�
��j�)�)rc��d|j|�z|fz}|jj|jj|��S)z*Return integer which represents atom NAME.)�winfo�atom)r�r<rQr
)rNr�r�rns    r
�
winfo_atomzMisc.winfo_atom?s<�� �4�?�?�9�#=�=���G���w�w�~�~�d�g�g�l�l�4�0�1�1rc�h�d|j|�z|fz}|jj|�S)z'Return name of atom with identifier ID.)r��atomname)r�r<r
�rNr!r�rns    r
�winfo_atomnamezMisc.winfo_atomnameDs5��$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��|jj|jjdd|j��S)z7Return number of cells in the colormap for this widget.r��cells�r<rQr
rvrMs r
�winfo_cellszMisc.winfo_cellsJ�/���w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc���g}|jj|jjdd|j��D]#}	|j	|j|���%|S#t$rY�3wxYw)z?Return a list of all widgets which are children of this widget.r��children)r<r8r
rvr�r��KeyError)rN�result�childs   r
�winfo_childrenzMisc.winfo_childrenOsq�����W�W�&�&��G�G�L�L��*�d�g�g�6�8�E�
��
�
�d�0�0��7�8�8��
���
��
�s� A+�+	A7�6A7c�P�|jjdd|j�S)z(Return window class name of this widget.r��classrurMs r
�winfo_classzMisc.winfo_class\s���w�w�|�|�G�W�d�g�g�6�6rc��|jj|jjdd|j��S)z?Return True if at the last color request the colormap was full.r��colormapfull�r<r	r
rvrMs r
�winfo_colormapfullzMisc.winfo_colormapfull`s1���w�w�!�!��G�G�L�L��.�$�'�'�:�<�	<rc��d|j|�z||fz}|jj|�}|sy|j|�S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.)r��
containingN)r�r<r
r�)rN�rootX�rootYr�rnr�s      r
�winfo_containingzMisc.winfo_containingesL��&�����+�,�/4�e�n�=���w�w�|�|�D�!���D��!�!�$�'�'rc��|jj|jjdd|j��S)z$Return the number of bits per pixel.r��depthrrMs r
�winfo_depthzMisc.winfo_depthms*���w�w�~�~�d�g�g�l�l�7�G�T�W�W�E�F�Frc��|jj|jjdd|j��S)z"Return true if this widget exists.r�rrrMs r
�winfo_existszMisc.winfo_existsq�/���w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��|jj|jjdd|j|��S)zWReturn the number of pixels for the given distance NUMBER
        (e.g. "3c") as float.r��fpixels�r<rRr
rv�rN�numbers  r
�
winfo_fpixelszMisc.winfo_fpixelsvs7���w�w� � �������Y�����"1�2�	2rc�P�|jjdd|j�S)zFReturn geometry string for this widget in the form "widthxheight+X+Y".r��geometryrurMs r
�winfo_geometryzMisc.winfo_geometry|����w�w�|�|�G�Z����9�9rc��|jj|jjdd|j��S)zReturn height of this widget.r�r�rrMs r
�winfo_heightzMisc.winfo_height�rrc�d�t|jjdd|j�d�S)z%Return identifier ID for this widget.r�r!r)r[r<r
rvrMs r
�winfo_idz
Misc.winfo_id�s$���4�7�7�<�<���t�w�w�7��;�;rc��d|j|�z}|jj|jj|��S)z9Return the name of all Tcl interpreters for this display.)r��interps)r�r<r8r
)rNr�rns   r
�
winfo_interpszMisc.winfo_interps�s7��#�d�o�o�i�&@�@���w�w� � ������d�!3�4�4rc��|jj|jjdd|j��S)z%Return true if this widget is mapped.r��ismappedrrMs r
�winfo_ismappedzMisc.winfo_ismapped��/���w�w�~�~��G�G�L�L��*�d�g�g�6�8�	8rc�P�|jjdd|j�S)z/Return the window manager name for this widget.r��managerrurMs r
�
winfo_managerzMisc.winfo_manager�s���w�w�|�|�G�Y����8�8rc�P�|jjdd|j�S)zReturn the name of this widget.r�r�rurMs r
�
winfo_namezMisc.winfo_name�s���w�w�|�|�G�V�T�W�W�5�5rc�P�|jjdd|j�S)z-Return the name of the parent of this widget.r��parentrurMs r
�winfo_parentzMisc.winfo_parent�����w�w�|�|�G�X�t�w�w�7�7rc��t|t�rt|�}d|j|�z|fz}|jj|�S)z.Return the pathname of the widget given by ID.)r��pathname)rr[r�r�r<r
r�s    r
�winfo_pathnamezMisc.winfo_pathname�sH���b�#���R��B�$�����+�,�/1�e�4���w�w�|�|�D�!�!rc��|jj|jjdd|j|��S)z'Rounded integer value of winfo_fpixels.r��pixelsrrs  r
�winfo_pixelszMisc.winfo_pixels�s1���w�w�~�~��G�G�L�L��(�D�G�G�V�<�>�	>rc��|jj|jjdd|j��S)z:Return the x coordinate of the pointer on the root window.r��pointerxrrMs r
�winfo_pointerxzMisc.winfo_pointerx�r0rc�n�|j|jjdd|j��S)zHReturn a tuple of x and y coordinates of the pointer on the root window.r��	pointerxy��_getintsr<r
rvrMs r
�winfo_pointerxyzMisc.winfo_pointerxy�s+���}�}��G�G�L�L��+�t�w�w�7�9�	9rc��|jj|jjdd|j��S)z:Return the y coordinate of the pointer on the root window.r��pointeryrrMs r
�winfo_pointeryzMisc.winfo_pointery�r0rc��|jj|jjdd|j��S)z'Return requested height of this widget.r��	reqheightrrMs r
�winfo_reqheightzMisc.winfo_reqheight�s/���w�w�~�~��G�G�L�L��+�t�w�w�7�9�	9rc��|jj|jjdd|j��S)z&Return requested width of this widget.r��reqwidthrrMs r
�winfo_reqwidthzMisc.winfo_reqwidth�r0rc�p�|j|jjdd|j|��S)zNReturn a tuple of integer RGB values in range(65536) for color in this widget.r��rgbrE)rN�colors  r
�	winfo_rgbzMisc.winfo_rgb�s-���}�}��G�G�L�L��%����%�8�:�	:rc��|jj|jjdd|j��S)zSReturn x coordinate of upper left corner of this widget on the
        root window.r��rootxrrMs r
�winfo_rootxzMisc.winfo_rootx��1���w�w�~�~��G�G�L�L��'�4�7�7�3�5�	5rc��|jj|jjdd|j��S)zSReturn y coordinate of upper left corner of this widget on the
        root window.r��rootyrrMs r
�winfo_rootyzMisc.winfo_rooty�rXrc�P�|jjdd|j�S)z&Return the screen name of this widget.r��screenrurMs r
�winfo_screenzMisc.winfo_screen�r9rc��|jj|jjdd|j��S)zTReturn the number of the cells in the colormap of the screen
        of this widget.r��screencellsrrMs r
�winfo_screencellszMisc.winfo_screencells��1���w�w�~�~��G�G�L�L��-����9�;�	;rc��|jj|jjdd|j��S)z\Return the number of bits per pixel of the root window of the
        screen of this widget.r��screendepthrrMs r
�winfo_screendepthzMisc.winfo_screendepth�rbrc��|jj|jjdd|j��S)zXReturn the number of pixels of the height of the screen of this widget
        in pixel.r��screenheightrrMs r
�winfo_screenheightzMisc.winfo_screenheight�s1���w�w�~�~��G�G�L�L��.�$�'�'�:�<�	<rc��|jj|jjdd|j��S)zUReturn the number of pixels of the height of the screen of
        this widget in mm.r��screenmmheightrrMs r
�winfo_screenmmheightzMisc.winfo_screenmmheight�s2���w�w�~�~��G�G�L�L��"2�D�G�G�<�>�	>rc��|jj|jjdd|j��S)zTReturn the number of pixels of the width of the screen of
        this widget in mm.r��
screenmmwidthrrMs r
�winfo_screenmmwidthzMisc.winfo_screenmmwidth�s1���w�w�~�~��G�G�L�L��/�4�7�7�;�=�	=rc�P�|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the default
        colormodel of this screen.r��screenvisualrurMs r
�winfo_screenvisualzMisc.winfo_screenvisual�s���w�w�|�|�G�^�T�W�W�=�=rc��|jj|jjdd|j��S)zWReturn the number of pixels of the width of the screen of
        this widget in pixel.r��screenwidthrrMs r
�winfo_screenwidthzMisc.winfo_screenwidth�rbrc�P�|jjdd|j�S)zxReturn information of the X-Server of the screen of this widget in
        the form "XmajorRminor vendor vendorVersion".r��serverrurMs r
�winfo_serverzMisc.winfo_servers���w�w�|�|�G�X�t�w�w�7�7rc�n�|j|jjdd|j��S)z*Return the toplevel widget of this widget.r��toplevel)r�r<r
rvrMs r
�winfo_toplevelzMisc.winfo_toplevel	s/���!�!�$�'�'�,�,��Z����#*�+�	+rc��|jj|jjdd|j��S)zBReturn true if the widget and all its higher ancestors are mapped.r��viewablerrMs r
�winfo_viewablezMisc.winfo_viewabler0rc�P�|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the
        colormodel of this widget.r��visualrurMs r
�winfo_visualzMisc.winfo_visuals���w�w�|�|�G�X�t�w�w�7�7rc�P�|jjdd|j�S)z7Return the X identifier for the visual for this widget.r��visualidrurMs r
�winfo_visualidzMisc.winfo_visualidr%rc�.�|jjdd|j|rdnd�}|jj|�D�cgc]}|jj|���}}|D�cgc]}|j	|���c}Scc}wcc}w)z�Return a list of all visuals available for the screen
        of this widget.

        Each item in the list consists of a visual name (see winfo_visual), a
        depth and if includeids is true is given also the X identifier.r��visualsavailable�
includeidsN)r<r
rvr8�_Misc__winfo_parseitem)rNr�r�r�s    r
�winfo_visualsavailablezMisc.winfo_visualsavailables����w�w�|�|�G�%7����,6�L�D�B��.2�g�g�.?�.?��.E�F�.E�����!�!�!�$�.E��F�37�8�4�a��&�&�q�)�4�8�8��G��8s�
"B
�2Bc	�R�|ddtt|j|dd��zS)rNr)rr	�_Misc__winfo_getint)rNr?s  r
�__winfo_parseitemzMisc.__winfo_parseitem(s+����!�u�u�S��!4�!4�a���e�<�=�=�=rc��t|d�S)rr)r[r>s  r
�__winfo_getintzMisc.__winfo_getint,s���1�a�y�rc��|jj|jjdd|j��S)z�Return the height of the virtual root window associated with this
        widget in pixels. If there is no virtual root window return the
        height of the screen.r��vrootheightrrMs r
�winfo_vrootheightzMisc.winfo_vrootheight0s1���w�w�~�~��G�G�L�L��-����9�;�	;rc��|jj|jjdd|j��S)z�Return the width of the virtual root window associated with this
        widget in pixel. If there is no virtual root window return the
        width of the screen.r��
vrootwidthrrMs r
�winfo_vrootwidthzMisc.winfo_vrootwidth7s1���w�w�~�~��G�G�L�L��,����8�:�	:rc��|jj|jjdd|j��S)ziReturn the x offset of the virtual root relative to the root
        window of the screen of this widget.r��vrootxrrMs r
�winfo_vrootxzMisc.winfo_vrootx>�1���w�w�~�~��G�G�L�L��(�D�G�G�4�6�	6rc��|jj|jjdd|j��S)ziReturn the y offset of the virtual root relative to the root
        window of the screen of this widget.r��vrootyrrMs r
�winfo_vrootyzMisc.winfo_vrootyDr�rc��|jj|jjdd|j��S)z Return the width of this widget.r�r�rrMs r
�winfo_widthzMisc.winfo_widthJrrc��|jj|jjdd|j��S)zVReturn the x coordinate of the upper left corner of this widget
        in the parent.r�r�rrMs r
�winfo_xzMisc.winfo_xO�1���w�w�~�~��G�G�L�L��#�t�w�w�/�1�	1rc��|jj|jjdd|j��S)zVReturn the y coordinate of the upper left corner of this widget
        in the parent.r�r�rrMs r
�winfo_yzMisc.winfo_yUr�rc�:�|jjd�y)zEEnter event loop until all pending events have been processed by Tcl.r)NrjrMs r
r)zMisc.update[s�������X�rc�<�|jjdd�y)z�Enter event loop until all idle callbacks have been called. This
        will update the display of windows but not process events caused by
        the user.r)�	idletasksNrjrMs r
�update_idletaskszMisc.update_idletasks_s��	
�����X�{�+rc���|�?|jj|jjd|j��S|jjd|j|�y)a,Set or get the list of bindtags for this widget.

        With no argument return the list of all bindtags associated with
        this widget. With a list of strings as argument the bindtags are
        set to this list. The bindtags determine in which order events are
        processed (see bind).N�bindtags�r<r8r
rv)rN�tagLists  r
r�z
Misc.bindtagsesP���?��7�7�$�$������Z����1�3�
3�
�G�G�L�L��T�W�W�g�6rc���t|t�r!|jj|||fz�y|r\|j	||j
|�}|xrdxsd�d|�d|j�d�}|jj|||fz�|S|r|jj||fz�S|jj|jj|��S)r�+r��if {"[rz]" == "break"} break
N)rrr<r
r'�_substitute�_subst_format_strr8)rNr��sequencer�r*�needcleanup�funcidr�s        r
�_bindz
Misc._bindrs����d�C� ��G�G�L�L���4� 0�0�1�
��^�^�D�$�*:�*:�#�%�F��K�C�%�2�%���.�.�0�C�
�G�G�L�L���3��/�0��M�
��7�7�<�<���{� 2�3�3��7�7�$�$�T�W�W�\�\�$�%7�8�8rc�B�|jd|jf|||�S)aOBind to this widget at event SEQUENCE a call to function FUNC.

        SEQUENCE is a string of concatenated event
        patterns. An event pattern is of the form
        <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
        of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
        Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
        B3, Alt, Button4, B4, Double, Button5, B5 Triple,
        Mod1, M1. TYPE is one of Activate, Enter, Map,
        ButtonPress, Button, Expose, Motion, ButtonRelease
        FocusIn, MouseWheel, Circulate, FocusOut, Property,
        Colormap, Gravity Reparent, Configure, KeyPress, Key,
        Unmap, Deactivate, KeyRelease Visibility, Destroy,
        Leave and DETAIL is the button number for ButtonPress,
        ButtonRelease and DETAIL is the Keysym for KeyPress and
        KeyRelease. Examples are
        <Control-Button-1> for pressing Control and mouse button 1 or
        <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
        An event pattern can also be a virtual event of the form
        <<AString>> where AString can be arbitrary. This
        event can be generated by event_generate.
        If events are concatenated they must appear shortly
        after each other.

        FUNC will be called if the event sequence occurs with an
        instance of Event as argument. If the return value of FUNC is
        "break" no further bound function is invoked.

        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function.

        Bind will return an identifier to allow deletion of the bound function with
        unbind without memory leak.

        If FUNC or SEQUENCE is omitted the bound function or list
        of bound events are returned.�bind�r�rv�rNr�r�r*s    r
r�z	Misc.bind�s#��N�z�z�6�4�7�7�+�X�t�S�A�Arc�B�|jd|j|f|�y)aUnbind for this widget the event SEQUENCE.

        If FUNCID is given, only unbind the function identified with FUNCID
        and also delete the corresponding Tcl command.

        Otherwise destroy the current binding for SEQUENCE, leaving SEQUENCE
        unbound.
        r�N��_unbindrv)rNr�r�s   r
�unbindzMisc.unbind�s��	
���f�d�g�g�x�0�&�9rc�^��|�|jjg|�d���y|jj|�jd�}d|�d��dj�fd�|D��}|j	�sd}|jjg|�|���|j|�y)Nr�rr�rc3�D�K�|]}|j��s|���y�wr)�
startswith)r��line�prefixs  �r
r�zMisc._unbind.<locals>.<genexpr>�s#�����=�e�d�$(�O�O�F�$;�"�e�s� )r<r
�splitr�stripr)rNr�r��lines�keepr�s     @r
r�zMisc._unbind�s�����>��D�G�G�L�L�#�$�#��#��G�G�L�L��&�,�,�T�2�E��v�h�a�(�F��9�9�=�e�=�=�D��:�:�<����D�G�G�L�L�%�$�%��%����v�&rc�H�|j�jd|||d�S)aBind to all widgets at an event SEQUENCE a call to function FUNC.
        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function. See bind for the return value.)r��allT�rr�r�s    r
�bind_allz
Misc.bind_all�s#��
�z�z�|�!�!�/�8�T�3��M�Mrc�H�|j�jdd|f�y)z8Unbind for all widgets for event SEQUENCE all functions.r�r�N�rr�)rNr�s  r
�
unbind_allzMisc.unbind_all�s���
�
����f�e�X�6�7rc�L�|j�jd|f|||d�S)a=Bind to widgets with bindtag CLASSNAME at event
        SEQUENCE a call of function FUNC. An additional
        boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or
        whether it will replace the previous function. See bind for
        the return value.r�Tr�)rNr�r�r�r*s     r
�
bind_classzMisc.bind_class�s(���z�z�|�!�!�6�9�"5�x��s�D�Q�Qrc�H�|j�jd||f�y)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE
        all functions.r�Nr�)rNr�r�s   r
�unbind_classzMisc.unbind_class�s��	
�
�
����f�i��:�;rc�:�|jj|�y)zCall the mainloop of Tk.N)r<r^)rNr�s  r
r^z
Misc.mainloop�s��������rc�8�|jj�y)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r<�quitrMs r
r�z	Misc.quit�s�������rc��|rBtt|jj|jj	|���Syr�)rr	r<rQr8�rNr�s  r
rFz
Misc._getints�s3�����T�W�W�^�^�T�W�W�->�->�v�-F�G�H�H�rc��|rBtt|jj|jj	|���Syr�)rr	r<rRr8r�s  r
�_getdoubleszMisc._getdoubles�s5�����T�W�W�.�.����0A�0A�&�0I�J�K�K�rc�>�|r|jj|�Syr�)r<r	r�s  r
�_getbooleanzMisc._getboolean�s����7�7�%�%�f�-�-�rc�0�|rd|fS|�d|jfSy)rr�r!�rvr�s  r
r�zMisc._displayof�s(��� �)�,�,��� �$�'�'�*�*�rc��	|j�jS#t$r6|jj	dd�x}|j�_|cYSwxYw)rr<�windowingsystem)r�_windowingsystem_cachedr*r<r
)rN�wss  r
r�zMisc._windowingsystem�sR��	��:�:�<�7�7�7���	������T�+<�=�
>�B�����5��I�	�s��<A�Ac���|rt||f�}nt|�}d}|j�D]�\}}|��	|ddk(r|dd}t|�r|j|�}n�t	|t
tf�rqg}|D]Y}t	|t�r|jt|���.t	|t�r|jt|���Yndj|�}|d|z|fz}��|S)rr!N����_rr7)r4r-�callabler'rrrr[r�rr
r)rNr/ror$r2r3�nvr%s        r
r�z
Misc._optionss���
��S�"�I�&�C��C�.�C����I�I�K�D�A�q��}��R�5�C�<�Q�s��V���A�;����q�)�A���E�4�=�1��B� !��%�d�C�0��I�I�c�$�i�0�'��c�2��I�I�j��&6�7�!�
!"� �H�H�R�L���S��U�A�J�&��! �"�
rc��t|�jd�}|}|ds|j�}|dd}|D]}|s|S|j|}�|S)zPReturn the Tkinter instance of a widget identified by
        its Tcl name NAME.rGrrN)rr�rr)rNr��wr�s    r
�nametowidgetzMisc.nametowidget"se���4�y���s�#�����A�w����	�A����8�D��A������
�
�1�
�A��
�rc�j�t|||�j}tt|��}	|j}	||jz}|jj||�|r.|j�g|_	|jj|�|S#t
$rY�iwxYw#t
$rY�hwxYw)z�Return a newly created Tcl function. If this
        function is called, the Python function FUNC will
        be executed. An optional function SUBST can
        be given which will be executed before FUNC.)rr r�r!r"r*rPr<r#rr�)rNr��substr�r%r�s      r
r'zMisc._register5s���

��e�T�*�3�3���B�q�E�{��	��=�=�D�	��$�-�-�'�D�	
�����d�A�&��� � �(�$&��!����$�$�T�*�����	��	���	��	�s"�B�B&�	B#�"B#�&	B2�1B2c�T�|}|j�|j}|j��|S)rr�)rNr�s  r
rz
Misc._rootMs'�����h�h�"����A�a�h�h�"��r)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%Drc���t|�t|j�k7r|S|jj}|jj��fd�}|\}}}}}}	}
}}}
}}}}}}}}}t�}�|�|_||�|_||�|_||�|_
||�|_||	�|_||
�|_
||�|_||�|_||
�|_||_||�|_||_||�|_	t+|�|_	|j1|�|_||�|_||�|_	�|�|_|fS#t$rY��wxYw#t$rY��wxYw#t.$r
||_Y�rwxYw#t4$r
||_Y�qwxYw#t.tf$rd|_Y|fSwxYw)rc�D��	�|�S#ttf$r|cYSwxYw)z?Tk changed behavior in 8.4.2, returning "??" rather more often.)r�r�)r�rQs �r
�getint_eventz&Misc._substitute.<locals>.getint_event]s+���
��a�y� ����)�
���
�s���r)r�
_subst_formatr<r	rQr�rLr�r�r�r�r�r��timer�r�r�r�r�r��
keysym_numr`r(r�r��widgetr�x_root�y_rootr�)rNrnr	r��nsignrWr%�hr2r�r?r�r�r��A�E�K�N�W�T�X�Y�D�erQs                        @r
r�zMisc._substituteWs�����t�9��D�.�.�/�/����W�W�'�'�
�������	�GK�C��q�!�Q��1�a��A�q�!�Q��1�a��A�q�!��G���%�=����Q����!�!�}�Q�W���?��� ��O��	��q�/����a�����q�/����1�o����1�o������&�q�M�Q�\����#�A����	��q�\�A�F�	��)�)�!�,�A�H� ��?�����?���	��Q�i�A�G��t���7����������
�	��A�F�	���	��A�H�	���H�%�	��A�G��t��	�sZ�
E3�?
F�!F�2F'�#
F=�3	E?�>E?�	F�
F�F$�#F$�'F:�9F:�=G�Gc�z�tj�\}}}|j�}|j|||�yr�)�sys�exc_infor�report_callback_exception)rNr��val�tbr�s     r
�_report_exceptionzMisc._report_exception�s0���|�|�~���S�"��z�z�|���&�&�s�C��4rc���i}|jj|jj|��D]5}|jj|�}|dddf|ddz||ddd<�7|S)z;Call Tcl configure command and return the result as a dict.rrN�r<r8r
)rNrnr/r�s    r
�
_getconfigurezMisc._getconfigure�st�������"�"�<�4�7�7�<�<��#6�7�A����!�!�!�$�A��q�T�!�"�X�K�!�A�B�%�/�C��!��Q�R��M�8��
rc��|jj|jj|��}|dddf|ddzS)Nrrr�rNrnr�s   r
�_getconfigure1zMisc._getconfigure1�sB���G�G���l�d�g�g�l�l�D�1�2���!��Q�R��{�Q�q�r�U�"�"rc��|rt||f�}n
|rt|�}|�&|jt|j|f��St	|t
�r*|j
t|j|d|zf��S|jjt|j|f�|j|�z�y)rNr7)
r4rr"rvrrr
r<r
r�)rNr�r/ros    r
�
_configurezMisc._configure�s���
��S�"�I�&�C�
��C�.�C��;��%�%�h�����~�&>�?�?��c�3���&�&�x����#�s�3�w�0G�'H�I�I������X�t�w�w��n�-��
�
�c�0B�B�Crc�(�|jd||�S)z�Configure resources of a widget.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method keys.
        �	configure�r�rNr/ros   r
rzMisc.configure�s�����{�C��4�4rc�V�|jj|jdd|z�S)z4Return the resource value for a KEY given as string.�cgetr7ru�rNrAs  r
rz	Misc.cget�s!���w�w�|�|�D�G�G�V�S�3�Y�7�7rc�*�|j||i�yr)r�rNrArs   r
�__setitem__zMisc.__setitem__�s������U�|�$rc���|jj}||jj|jd��D�cgc]}||�ddd��c}Scc}w)z3Return a list of all resource names of this widget.rrrNr�)rNr8r�s   r
r�z	Misc.keys�s]���G�G�%�%�	��$�'�'�,�,�t�w�w��<�=�?�=�)*�	�!��Q����#�=�?�	?��?s�Ac��|jS)z+Return the window path name of this widget.r�rMs r
rOzMisc.__str__�s���w�w�rc�~�d|jj�d|jj�d|j�d�S)Nr�rGz object r�)rBrQrRrvrMs r
r�z
Misc.__repr__�s-���N�N�%�%�t�~�~�'B�'B�D�G�G�M�	Mr�_noarg_c���|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)aSet or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given the current setting will be returned.
        �pack�	propagateN�rarr�r<r
rv�rN�flags  r
�pack_propagatezMisc.pack_propagate��Y���4�<�<���#�#�D�G�G�L�L���T�W�W�%.�/�
/�
�G�G�L�L���d�g�g�t�<rc���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)�HReturn a list of all slaves of this widget
        in its packing order.r�slaves�r<r8r
rvr�r>s  r
�pack_slaveszMisc.pack_slaves�s_�����!�!��7�7�<�<���$�'�'�:�<�=�<�+,��"�"�1�%�<�=�	=��=��Ac���|jj|jjdd|j��D�cgc]}|j	|���c}Scc}w)r$�placer%r&r>s  r
�place_slaveszMisc.place_slaves�sb�����!�!��7�7�<�<���$�'�'�3�4�5�4�+,��"�"�1�%�4�5�	5��5r(c�T�|jjdd|j|�y)z�The anchor value controls how to place the grid within the
        master when no row/column has any weight.

        The default anchor is nw.�grid�anchorNru)rNr.s  r
�grid_anchorzMisc.grid_anchor�s��
	
�����V�X�t�w�w��7rc��dd|jf}|�	|�|||fz}|�	|�|||fz}|j|jj|��xsdS)a�Return a tuple of integer coordinates for the bounding
        box of this widget controlled by the geometry manager grid.

        If COLUMN, ROW is given the bounding box applies from
        the cell with row and column 0 to the specified
        cell. If COL2 and ROW2 are given the bounding box
        starts at that cell.

        The returned integers specify the offset of the upper left
        corner in the master widget and the width and height.
        r-�bboxN)rvrFr<r
)rN�column�row�col2�row2rns      r
�	grid_bboxzMisc.grid_bboxsh�������(����#�/��6�3�-�'�D���� 0��4��,�&�D��}�}�\�T�W�W�\�\�4�0�1�9�T�9rc��t|ttjf�rI	t|�}|syd|vr|jj|�S|jj
|�S|S#ttf$rY|SwxYw)NrG)	rr�_tkinter�Tcl_Objr<rRrQr�r�)rNr�svalues   r
�_gridconvvaluezMisc._gridconvvalues���e�c�8�#3�#3�4�5�	
��U������F�]��7�7�,�,�V�4�4��7�7�>�>�&�1�1������)�
����
�s�
A,�A,�A,�,A?�>A?c	��t|t�r |s|dddk(r|dd}|dddk7rd|z}|f}n|j||�}|sHt|j|jjd||j|�|j��S|jjd||j|f|z�}t|�dk(r|j|�Sy)rr�Nr�rr7r-)r>)	rrr�rBr<r
rvr;r)rNr��indexr/ro�optionsr$s       r
�_grid_configurezMisc._grid_configure's����c�3����2�3�x�3���#�2�h���2�A�w�#�~��#�g���f�G��m�m�C��,�G�����������V�W�d�g�g�u�=��(�(�*�
*��g�g�l�l��7�D�G�G�U�3������w�<�1���&�&�s�+�+�rc�*�|jd|||�S)z�Configure column INDEX of a grid.

        Valid resources are minsize (minimum size of the column),
        weight (how much does additional space propagate to this column)
        and pad (how much space to let additionally).�columnconfigure�r?�rNr=r/ros    r
�grid_columnconfigurezMisc.grid_columnconfigure<s���#�#�$5�u�c�2�F�Frc	�z�|j|jjdd|j||��xsdS)z�Return a tuple of column and row which identify the cell
        at which the pixel at position X and Y inside the master
        widget is located.r-�locationNrE�rNr�r�s   r
�
grid_locationzMisc.grid_locationFs<���}�}��G�G�L�L��
�D�G�G�Q��
3�4�<�7;�	<rc���|tjur6|j|jj	dd|j
��S|jj	dd|j
|�y)aSet or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given, the current setting will be returned.
        r-rNrrs  r
�grid_propagatezMisc.grid_propagateNr"rc�*�|jd|||�S)z�Configure row INDEX of a grid.

        Valid resources are minsize (minimum size of the row),
        weight (how much does additional space propagate to this row)
        and pad (how much space to let additionally).�rowconfigurerBrCs    r
�grid_rowconfigurezMisc.grid_rowconfigure[s���#�#�N�E�3��C�Crc�v�|j|jjdd|j��xsdS)z<Return a tuple of the number of column and rows in the grid.r-�sizeNrErMs r
�	grid_sizezMisc.grid_sizees3���}�}��G�G�L�L������1�3�;�6:�	;rc��d}|�|d|fz}|�|d|fz}|jj|jjdd|jf|z��D�cgc]}|j	|���c}Scc}w)r$r!z-rowz-columnr-r%r&)rNr3r2rnr�s     r
�grid_slaveszMisc.grid_slavesls������?��6�3�-�'�D����9�f�-�-�D����!�!�$�'�'�,�,��H�d�g�g�.��5�#7�8�9�8�+,��"�"�1�%�8�9�	9��9s�A6c�J�dd|f|z}|jj|�y)z�Bind a virtual event VIRTUAL (of the form <<Name>>)
        to an event SEQUENCE such that the virtual event is triggered
        whenever SEQUENCE occurs.�eventr*Nrj�rN�virtual�	sequencesrns    r
�	event_addzMisc.event_add{s%�����(�9�4�������T�rc�J�dd|f|z}|jj|�y)z-Unbind a virtual event VIRTUAL from SEQUENCE.rT�deleteNrjrUs    r
�event_deletezMisc.event_delete�s#����7�+�i�7�������T�rc��dd|j|f}|j�D]\}}|d|zt|�fz}�|jj	|�y)z�Generate an event SEQUENCE. Additional
        keyword arguments specify parameter of the event
        (e.g. x, y, rootx, rooty).rT�generate�-%sN)rvr-rr<r
)rNr�rornr2r3s      r
�event_generatezMisc.event_generate�sQ����T�W�W�h�7���H�H�J�D�A�q��5�1�9�c�!�f�-�-�D�������T�rc�n�|jj|jjdd|��S)zuReturn a list of all virtual events or the information
        about the SEQUENCE bound to the virtual event VIRTUAL.rTrr)rNrVs  r
�
event_infozMisc.event_info�s/���w�w� � ��G�G�L�L��&�'�2�4�	4rc�l�|jj|jjdd��S)z*Return a list of all existing image names.�image�namesrrMs r
�image_nameszMisc.image_names��&���w�w� � ������g�w�!?�@�@rc�l�|jj|jjdd��S)z?Return a list of all available image types (e.g. photo bitmap).rc�typesrrMs r
�image_typeszMisc.image_types�rfrr)r)r�1�r�F)rrE)Nr�NNNN�NN)�rPrQrRr��_last_child_idsrr�rrerirlrr�waitvarrxr{r}rrQrRr	r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��liftr�r�r�rr	rrrrrr!r$r'r)r,r/r3r5r8r<r?rBrGrJrMrPrTrWr[r^rarerhrkrnrqrtrwrzr}r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�r�r�r�r�r�r�r�r�r^r�rFr�r�r��propertyr�r�r�r�r'�registerrr�rr�r�rrr
rr�configr�__getitem__rr�rOr�rr!rr'r%r+r/r.r6r1r;r?rDrArHrJrMrLrPrOrRrXr[r_rarerir!rr
rara�s���E�
�O��L�%��/�"�=�1��G�4�8�$�$�'�'�A�'�
�E�1�	(�(�(�-�
(�(�3�8/�,�"=�
F�.A� �(�1�-�8��@�(�G�?�A�
F�$!� 1�
(�:�2�2��D�*�
2�
"�5�
�7�<�
(�G�6�
2�:�6�
<�5�
8�
9�6�8�"�>�
8�
9�
8�
9�
8�
:�
5�5�8�;�;�<�>�=�>�;�8�
+�
8�
8�:�	9�>��;�:�6�6�5�
1�1��,�7�9�$'B�R	:�'�N�8�R�<�
��I�
L�
.�
������4�"!�M��,�H��
C�M�����/��;�z5��#�
D�5��F�8��K�%�?��M�
�k�G�")�=��I�=��F�5�8��F�:�&�D��,�*/1�G�+�O�<�#*�=�,.�D�%�L�;�
�D�
9���
�4�A�Arrac��eZdZdZd�Zd�Zy)rzwInternal class. Stores function to call when some user
    defined Tcl function is called e.g. after an event occurred.c�.�||_||_||_y)z(Store FUNC, SUBST and WIDGET as members.N)r�r�r�)rNr�r�r�s    r
r
zCallWrapper.__init__�s����	���
���rc��	|jr|j|�}|j|�S#t$r�|jj	�YyxYw)z3Apply first function SUBST to arguments, than FUNC.N)r�r�r�r�r�rNrns  r
r zCallWrapper.__call__�sQ��	,��z�z�!�t�z�z�4�(���4�9�9�d�#�#���	��	,��K�K�)�)�+�s	�),�%AN�rPrQrRr�r
r r!rr
rr�s��D��	,rrc�"�eZdZdZd�Zd�Zd�Zy)�XViewzXMix-in class for querying and changing the horizontal position
    of a widget's window.c�z�|jj|jdg|���}|s|j|�Sy)z5Query and change the horizontal position of the view.�xviewN�r<r
rvr��rNrnr$s   r
r~zXView.xview��:���d�g�g�l�l�4�7�7�G�3�d�3����#�#�C�(�(�rc�T�|jj|jdd|�y)zsAdjusts the view in the window so that FRACTION of the
        total width of the canvas is off-screen to the left.r~�movetoNru�rN�fractions  r
�xview_movetozXView.xview_moveto����	
�����T�W�W�g�x��:rc�V�|jj|jdd||�y)z\Shift the x-view according to NUMBER which is measured in "units"
        or "pages" (WHAT).r~�scrollNru�rNr r�s   r
�xview_scrollzXView.xview_scroll�� ��	
�����T�W�W�g�x���>rN)rPrQrRr�r~r�r�r!rr
r|r|�����)�;�
?rr|c�"�eZdZdZd�Zd�Zd�Zy)�YViewzVMix-in class for querying and changing the vertical position
    of a widget's window.c�z�|jj|jdg|���}|s|j|�Sy)z3Query and change the vertical position of the view.�yviewNrr�s   r
r�zYView.yview�r�rc�T�|jj|jdd|�y)zsAdjusts the view in the window so that FRACTION of the
        total height of the canvas is off-screen to the top.r�r�Nrur�s  r
�yview_movetozYView.yview_moveto�r�rc�V�|jj|jdd||�y)z\Shift the y-view according to NUMBER which is measured in
        "units" or "pages" (WHAT).r�r�Nrur�s   r
�yview_scrollzYView.yview_scroll�r�rN)rPrQrRr�r�r�r�r!rr
r�r��r�rr�c�|�eZdZdZ		d"d�ZeZd�ZeZd#d�ZeZ	d�Z
e
Zd#d�ZeZ
d�ZeZd#d	�ZeZd
�ZeZd�ZeZd#d�ZeZ		d"d
�ZeZd#d�ZeZd$d�ZeZd�ZeZd#d�Z e Z!d#d�Z"e"Z#d%d�Z$e$Z%d$d�Z&e&Z'd#d�Z(e(Z)d�Z*e*Z+d$d�Z,e,Z-d$d�Z.e.Z/d#d�Z0e0Z1d#d�Z2e2Z3d$d�Z4e4Z5d$d�Z6e6Z7d#d�Z8e8Z9d#d�Z:e:Z;d#d�Z<e<Z=d#d �Z>e>Z?d!�Z@e@ZAy)&�WmzAProvides functions for the communication with the window manager.Nc�v�|j|jjdd|j||||��S)z�Instruct the window manager to set the aspect ratio (width/height)
        of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
        of the actual values if no argument is given.�wm�aspectrE)rN�minNumer�minDenom�maxNumer�maxDenoms     r
�	wm_aspectzWm.wm_aspect�s9���}�}��G�G�L�L��x�����x��x�
)�*�	*rc�\�dd|jf|z}|jj|�S)a�This subcommand returns or sets platform specific attributes

        The first form returns a list of the platform specific flags and
        their values. The second form returns the value for the specific
        option. The third form sets one or more of the values. The values
        are as follows:

        On Windows, -disabled gets or sets whether the window is in a
        disabled state. -toolwindow gets or sets the style of the window
        to toolwindow (as defined in the MSDN). -topmost gets or sets
        whether this is a topmost window (displays above all other
        windows).

        On Macintosh, XXXXX

        On Unix, there are currently no special attribute values.
        r��
attributes)rvr<r
rys  r
�
wm_attributeszWm.wm_attributes�s,��$�l�D�G�G�,�t�3���w�w�|�|�D�!�!rc�R�|jjdd|j|�S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return
        current value.r��clientrurs  r
�	wm_clientzWm.wm_clients!���w�w�|�|�D�(�D�G�G�T�:�:rc�0�t|�dkDr|f}dd|jf|z}|r|jj|�y|jj	|jj|��D�cgc]}|j|���c}Scc}w)z�Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
        of this widget. This list contains windows whose colormaps differ from their
        parents. Return current list of widgets if WLIST is empty.rr��colormapwindowsN)rrvr<r
r8r�)rN�wlistrnr�s    r
�wm_colormapwindowszWm.wm_colormapwindowss����u�:��>��H�E��'����1�E�9����G�G�L�L���"�W�W�.�.�t�w�w�|�|�D�/A�B�D�B���&�&�q�)�B�D�
D��Ds�8Bc�R�|jjdd|j|�S)z�Store VALUE in WM_COMMAND property. It is the command
        which shall be used to invoke the application. Return current
        command if VALUE is None.r�r�rurs  r
�
wm_commandz
Wm.wm_commands!���w�w�|�|�D�)�T�W�W�e�<�<rc�P�|jjdd|j�S)z�Deiconify this widget. If it was never mapped it will not be mapped.
        On Windows it will raise this widget and give it the focus.r��	deiconifyrurMs r
�wm_deiconifyzWm.wm_deiconify&s���w�w�|�|�D�+�t�w�w�7�7rc�R�|jjdd|j|�S)z�Set focus model to MODEL. "active" means that this widget will claim
        the focus itself, "passive" means that the window manager shall give
        the focus. Return current focus model if MODEL is None.r��
focusmodelru)rN�models  r
�
wm_focusmodelzWm.wm_focusmodel-s!���w�w�|�|�D�,�����?�?rc�>�|jjdd|�y)aAThe window will be unmapped from the screen and will no longer
        be managed by wm. toplevel windows will be treated like frame
        windows once they are no longer managed by wm, however, the menu
        option configuration will be remembered and the menus will return
        once the widget is managed again.r��forgetNrjrws  r
�	wm_forgetzWm.wm_forget5s��	
�����T�8�V�,rc�P�|jjdd|j�S)zAReturn identifier for decorative frame of this widget if present.r��framerurMs r
�wm_framezWm.wm_frame?s���w�w�|�|�D�'�4�7�7�3�3rc�R�|jjdd|j|�S)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
        current value if None is given.r�r#ru)rN�newGeometrys  r
�wm_geometryzWm.wm_geometryEs!���w�w�|�|�D�*�d�g�g�{�C�Crc�v�|j|jjdd|j||||��S)aInstruct the window manager that this widget shall only be
        resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
        height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
        number of grid units requested in Tk_GeometryRequest.r�r-rE)rN�	baseWidth�
baseHeight�widthInc�	heightIncs     r
�wm_gridz
Wm.wm_gridLs8���}�}�T�W�W�\�\��&�$�'�'��z�8�Y�8�9�	9rc�R�|jjdd|j|�S)z~Set the group leader widgets for related widgets to PATHNAME. Return
        the group leader of this widget if None is given.r��groupru�rN�pathNames  r
�wm_groupzWm.wm_groupY�!���w�w�|�|�D�'�4�7�7�H�=�=rc��|�)|jjdd|jd|�S|jjdd|j|�S)a�Set bitmap for the iconified widget to BITMAP. Return
        the bitmap if None is given.

        Under Windows, the DEFAULT parameter can be used to set the icon
        for the widget and any descendants that don't have an icon set
        explicitly.  DEFAULT can be the relative path to a .ico file
        (example: root.iconbitmap(default='myicon.ico') ).  See Tk
        documentation for more information.r��
iconbitmap�-defaultru)rN�bitmap�defaults   r
�
wm_iconbitmapzWm.wm_iconbitmap`sF�����7�7�<�<��l�D�G�G�Z��Q�Q��7�7�<�<��l�D�G�G�V�D�Drc�P�|jjdd|j�S)zDisplay widget as icon.r��iconifyrurMs r
�
wm_iconifyz
Wm.wm_iconifyps���w�w�|�|�D�)�T�W�W�5�5rc�R�|jjdd|j|�S)zVSet mask for the icon bitmap of this widget. Return the
        mask if None is given.r��iconmaskru)rNr�s  r
�wm_iconmaskzWm.wm_iconmaskvs!���w�w�|�|�D�*�d�g�g�v�>�>rc�R�|jjdd|j|�S)zSSet the name of the icon for this widget. Return the name if
        None is given.r��iconnameru)rN�newNames  r
�wm_iconnamezWm.wm_iconname}s!���w�w�|�|�D�*�d�g�g�w�?�?rc��|r+|jjdd|jdg|���y|jjdd|jg|���y)a�Sets the titlebar icon for this window based on the named photo
        images passed through args. If default is True, this is applied to
        all future created toplevels as well.

        The data in the images is taken as a snapshot at the time of
        invocation. If the images are later changed, this is not reflected
        to the titlebar icons. Multiple images are accepted to allow
        different images sizes to be provided. The window manager may scale
        provided icons to an appropriate size.

        On Windows, the images are packed into a Windows icon structure.
        This will override an icon specified to wm_iconbitmap, and vice
        versa.

        On X, the images are arranged into the _NET_WM_ICON X property,
        which most modern window managers support. An icon specified by
        wm_iconbitmap may exist simultaneously.

        On Macintosh, this currently does nothing.r��	iconphotor�Nru)rNr�rns   r
�wm_iconphotozWm.wm_iconphoto�sG��(��D�G�G�L�L��{�D�G�G�Z�G�$�G��D�G�G�L�L��{�D�G�G�;�d�;rc	�r�|j|jjdd|j||��S)z�Set the position of the icon of this widget to X and Y. Return
        a tuple of the current values of X and X if None is given.r��iconpositionrErGs   r
�wm_iconpositionzWm.wm_iconposition�s3���}�}�T�W�W�\�\��.�$�'�'�1�a�1�2�	2rc�R�|jjdd|j|�S)zgSet widget PATHNAME to be displayed instead of icon. Return the current
        value if None is given.r��
iconwindowrur�s  r
�
wm_iconwindowzWm.wm_iconwindow�s!���w�w�|�|�D�,�����B�Brc�>�|jjdd|�y)z�The widget specified will become a stand alone top-level window.
        The window will be decorated with the window managers title bar,
        etc.r��manageNrj)rNr�s  r
�	wm_managezWm.wm_manage�s��	
�����T�8�V�,rc	�r�|j|jjdd|j||��S)z�Set max WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given.r��maxsizerE�rNr�r�s   r
�
wm_maxsizez
Wm.wm_maxsize��3���}�}�T�W�W�\�\��)�T�W�W�e�V�5�6�	6rc	�r�|j|jjdd|j||��S)z�Set min WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given.r��minsizerEr�s   r
�
wm_minsizez
Wm.wm_minsize�r�rc�p�|j|jjdd|j|��S)z�Instruct the window manager to ignore this widget
        if BOOLEAN is given with 1. Return the current value if None
        is given.r��overrideredirect)r�r<r
rvrfs  r
�wm_overrideredirectzWm.wm_overrideredirect�s4�����������$�d�g�g�w�!8�9�	9rc�R�|jjdd|j|�S)z�Instruct the window manager that the position of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program".r��positionfromru�rN�whos  r
�wm_positionfromzWm.wm_positionfrom�s!���w�w�|�|�D�.�$�'�'�3�?�?rc��t|�r|j|�}n|}|jjdd|j||�S)z�Bind function FUNC to command NAME for this widget.
        Return the function bound to NAME if None is given. NAME could be
        e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".r��protocol)r�r'r<r
rv)rNr�r�r�s    r
�wm_protocolzWm.wm_protocol�sB���D�>��n�n�T�*�G��G��w�w�|�|��*�d�g�g�t�W�6�	6rc�T�|jjdd|j||�S)zyInstruct the window manager whether this width can be resized
        in WIDTH or HEIGHT. Both values are boolean values.r��	resizablerur�s   r
�wm_resizablezWm.wm_resizable�s#���w�w�|�|�D�+�t�w�w��v�F�Frc�R�|jjdd|j|�S)z�Instruct the window manager that the size of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program".r��sizefromrur�s  r
�wm_sizefromzWm.wm_sizefrom�s!���w�w�|�|�D�*�d�g�g�s�;�;rc�R�|jjdd|j|�S)z�Query or set the state of this widget as one of normal, icon,
        iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).r�r�ru)rN�newstates  r
�wm_statezWm.wm_state�r�rc�R�|jjdd|j|�S)zSet the title of this widget.r��titlerur�s  r
�wm_titlezWm.wm_title�s���w�w�|�|�D�'�4�7�7�F�;�;rc�R�|jjdd|j|�S)z_Instruct the window manager that this widget is transient
        with regard to widget MASTER.r��	transientru)rNr�s  r
�wm_transientzWm.wm_transient	s!���w�w�|�|�D�+�t�w�w��?�?rc�P�|jjdd|j�S)z�Withdraw this widget from the screen such that it is unmapped
        and forgotten by the window manager. Re-draw it with wm_deiconify.r�r�rurMs r
�wm_withdrawzWm.wm_withdraw		s���w�w�|�|�D�*�d�g�g�6�6rrmrrnrl)BrPrQrRr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#r�r-r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr�r!rr
r�r��s���K�'+�&*�	*��F�"�*�J�;�
�F�D�)�O�=��G�8�
�I�@��J�-��F�4�
�E�D�
�H�%)�"&�	9��D�>�

�E�E��J�6��G�?�
�H�@�
�H�<�2�I�2�#�L�C�
�J�-��F�6��G�6��G�9�+��@�#�L�	6��H�G�
�I�<��H�>�

�E�<�
�E�@�
�I�7�
�Hrr�c�D�eZdZdZdZ		dd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)r�zzToplevel widget of Tk which represents mostly the main window
    of an application. It has an associated Tcl interpreter.rGNc
��d|_i|_d|_d|_|�Wddl}|j
j
tjd�}|j
j|�\}}|dvr||z}d}	tj||||	t|||�|_tr|jjt�|r|j!�tj"j$s|j'||�yy)aAReturn a new top level widget on screen SCREENNAME. A new Tcl interpreter will
        be created. BASENAME will be used for the identification of the profile file (see
        readprofile).
        It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
        is the name of the widget class.NFr)z.pyz.pyc)r�r�	_tkloadedr<�os�path�basenamer��argv�splitextr8�create�wantobjects�_debug�settrace�_print_command�_loadtk�flags�ignore_environment�readprofile)
rN�
screenName�baseNamer��useTk�sync�user�ext�interactives
          r
r
zTk.__init__	s��������
�����������w�w�'�'������4�H��G�G�,�,�X�6�M�H�c��/�)�#�c�>�����/�/�*�h�	�;�P[�]b�dh�jm�n�����G�G���^�,���L�L�N��y�y�+�+����X�y�1�,rc�r�|js+|jj�|j�yyr)r
r<�loadtkrrMs r
r!z	Tk.loadtk3	s%���~�~��G�G�N�N���L�L�N�rc���d|_|jjd�}|tjk7r tdtj�d|�d���t
|jjd��}|tjk7r tdtj�d|�d���|j�g|_|jjd	t�|jjd
t�|jjd	�|jjd
�trt�|a|jd|j �y)NT�
tk_versionztk.h version (z!) doesn't match libtk.a version (�)�tcl_versionztcl.h version (z") doesn't match libtcl.a version (�tkerror�exit�WM_DELETE_WINDOW)r
r<rr8�
TK_VERSIONr9r�TCL_VERSIONrr#r�r�r�r�r�r�r�)rNr#r%s   r
rz
Tk._loadtk8	s������W�W�^�^�L�1�
���,�,�,��"*�"5�"5�z� C�D�
D��$�'�'�.�.��7�8���(�.�.�.��"*�"6�"6�� E�F�
F�
���$� "�D�������i��2������f�e�,���� � ��+���� � ��(� �]�%:� �M��
�
�(�$�,�,�7rc��t|jj��D]}|j��|jjd|j�tj|�trt|urda	yyy)zhDestroy this and all descendants widgets. This will
        end the application of this Tcl interpreter.r�N)
rr�valuesr�r<r
rvrar�r��rNr0s  r
r�z
Tk.destroyR	s_���d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(����T�� �]�d�%:� �M�&;� rc�N�ddl}d|jvr|jd}n|j}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}|jj	|d|z�}d|i}	td|	�|jj
|�r|jjd|�|jj
|�r#tt|�j�|	�|jj
|�r|jjd|�|jj
|�r$tt|�j�|	�yy)	z�Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into
        the Tcl Interpreter and calls exec on the contents of .BASENAME.py and
        .CLASSNAME.py if such a file exists in the home directory.rN�HOMEz.%s.tclz.%s.pyrNzfrom tkinter import *�source)r�environ�curdirrr�exec�isfiler<r
�open�read)
rNrr�r�home�	class_tcl�class_py�base_tcl�base_py�dirs
          r
rzTk.readprofile\	s8��	��R�Z�Z���
�
�6�(:���Y�Y�d��G�G�L�L��y�9�'<�=�	��7�7�<�<��h��&:�;���7�7�<�<��i�(�&:�;���'�'�,�,�t�X��%8�9���t�n���
$�c�*�
�7�7�>�>�)�$��G�G�L�L��9�-�
�7�7�>�>�(�#���h��$�$�&��,�
�7�7�>�>�(�#��G�G�L�L��8�,�
�7�7�>�>�'�"���g��#�#�%�s�+�#rc��ddl}tdtj��|t_|t_|t_|t_|j|||�y)z�Report callback exception on sys.stderr.

        Applications may want to override this internal function, and
        should when sys.stderr is None.rNzException in Tkinter callback��file)	�	tracebackr,r��stderr�last_exc�	last_type�
last_value�last_traceback�print_exception)rNr�rrr@s     r
rzTk.report_callback_exceptionr	sE��
	�
�-�C�J�J�?������
��������!�!�#�s�B�/rc�.�t|j|�S)z3Delegate attribute access to the interpreter object)r�r<)rN�attrs  r
�__getattr__zTk.__getattr__	s���t�w�w��%�%r)NNr�TFN)rPrQrRr�rvr
r!rr�rrrIr!rr
r�r�	s6��@�	�B�AE�-1�2�:�
8�4!�,�,0�&rr�r>c�X�t|t�sJ�t|�}t||��y)Nr>)rrrr,)r�r?s  r
rr�	s%���c�5�!�!�!�
��*�C�	�#�D�rc��t||||�Sr)r�)rrr�rs    r
�TclrL�	s��
�j�(�I�u�5�5rc�r�eZdZdZifd�ZexZxZZd�ZeZ	d�Z
e
ZejxZZ
ejxZZy)�PackzQGeometry manager Pack.

    Base class to use the methods pack_* in every widget.c�z�|jjdd|jf|j||�z�y)a(Pack a widget in the parent widget. Use as options:
        after=widget - pack it after you have packed widget
        anchor=NSEW (or subset) - position widget according to
                                  given direction
        before=widget - pack it before you will pack widget
        expand=bool - expand widget if parent size grows
        fill=NONE or X or Y or BOTH - fill widget if widget grows
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.
        rrN�r<r
rvr�rs   r
�pack_configurezPack.pack_configure�	s5�� 	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)z:Unmap this widget and do not use it for the packing order.rr�NrurMs r
�pack_forgetzPack.pack_forget�	��������V�X�t�w�w�/rc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zEReturn information about the packing options
        for this widget.rr�in�rBr<r
rvr��rN�ds  r
�	pack_infozPack.pack_info�	�M��
�t�w�w������V�V�T�W�W� E�F���1�9��'�'��$��0�A�d�G��rN)rPrQrRr�rQrrrtrSr�rZrrar!rr'r%r!rr
rNrN�	sZ��=�"$�(�(!/�.�D�.�9�v�0��F���D�!%�!4�!4�4�I���+�+�+�F�[rrNc�V�eZdZdZifd�ZexZxZZd�ZeZ	d�Z
e
ZejxZZ
y)�PlacezSGeometry manager Place.

    Base class to use the methods place_* in every widget.c�z�|jjdd|jf|j||�z�y)a Place a widget in the parent widget. Use as options:
        in=master - master relative to which the widget is placed
        in_=master - see 'in' option description
        x=amount - locate anchor of this widget at position x of master
        y=amount - locate anchor of this widget at position y of master
        relx=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to width of master (1.0 is right edge)
        rely=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to height of master (1.0 is bottom edge)
        anchor=NSEW (or subset) - position anchor according to given direction
        width=amount - width of this widget in pixel
        height=amount - height of this widget in pixel
        relwidth=amount - width of this widget between 0.0 and 1.0
                          relative to width of master (1.0 is the same width
                          as the master)
        relheight=amount - height of this widget between 0.0 and 1.0
                           relative to height of master (1.0 is the same
                           height as the master)
        bordermode="inside" or "outside" - whether to take border width of
                                           master widget into account
        r*rNrPrs   r
�place_configurezPlace.place_configure�	s5��,	
�������T�W�W�-��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)�Unmap this widget.r*r�NrurMs r
�place_forgetzPlace.place_forget�	s�������W�h����0rc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zEReturn information about the placing options
        for this widget.r*rrVrWrXs  r
�
place_infozPlace.place_info�	sM��
�t�w�w������W�f�d�g�g� F�G���1�9��'�'��$��0�A�d�G��rN)rPrQrRr�r_r*rrtrbr�rdrrar+r%r!rr
r]r]�	sJ��>�#%�(�4"1�0�E�0�I��1��F���D� �-�-�-�F�\rr]c��eZdZdZifd�ZexZxZZejxZ
Z	ejxZZd�Z
e
Zd�Zd�ZeZej$xZZej(xZZej,xZZej0xZZej4xZZy)�GridzQGeometry manager Grid.

    Base class to use the methods grid_* in every widget.c�z�|jjdd|jf|j||�z�y)aPosition a widget in the parent widget in a grid. Use as options:
        column=number - use cell identified with given column (starting with 0)
        columnspan=number - this widget will span several columns
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        row=number - use cell identified with given row (starting with 0)
        rowspan=number - this widget will span several rows
        sticky=NSEW - if cell is larger on which sides will this
                      widget stick to the cell boundary
        r-rNrPrs   r
�grid_configurezGrid.grid_configure
s5��	
������{�D�G�G�,��
�
�c�2�&�'�	(rc�R�|jjdd|j�y)rar-r�NrurMs r
�grid_forgetzGrid.grid_forget
rTrc�R�|jjdd|j�y)z0Unmap this widget but remember the grid options.r-r1NrurMs r
�grid_removezGrid.grid_remove"
rTrc��t|j|jjdd|j��}d|vr|j	|d�|d<|S)zSReturn information about the options
        for positioning this widget in a grid.r-rrVrWrXs  r
�	grid_infozGrid.grid_info&
r[rN)rPrQrRr�rhr-rrtrar6r1rDrArjr�rlrnrrHrFrJrrMrLrPrOrRr%r!rr
rfrf�	s���=�
"$�(�&!/�.�D�.�9�v��~�~�%�D�9�-1�-F�-F�F�O�*�0��F�0���D�#�1�1�1�H�}�!%�!4�!4�4�I��'+�'=�'=�=�L�$��~�~�%�D�9��+�+�+�F�[rrfc�2�eZdZdZd�Ziidfd�Zd�Zdd�Zy)	�
BaseWidgetzInternal class.c���|�
t�}||_|j|_d}d|vr|d}|d=|s�|jjj�}|dj
�r|dz
}|j�i|_|jj|d�dz}||j|<|dk(rd|��}nd||fz}||_	|jdk(rd|z|_
n|jdz|z|_
i|_|j|jjvr1|jj|jj�||jj|j<y)	z6Internal function. Sets up information about children.Nr�r��!rrz!%s%drG)
r�r�r<rBrPr��isdigitrorrrvrr�)rNr�r/r��counts     r
�_setupzBaseWidget._setup9
sS���>�&�(�F�����)�)������S�=��v�;�D��F����>�>�*�*�0�0�2�D��B�x���!������%�%�-�)+��&��*�*�.�.�t�Q�7�!�;�E�+0�F�"�"�4�(���z� $����$���.����
��9�9�c�>��D�j�D�G��i�i�#�o��,�D�G���
��:�:����-�-�-��K�K� � ����,�4�4�6�+/������T�Z�Z�(rr!c��|r
t||f�}||_|j||�|j�g|_|j	�D��cgc]\}}t|t�s�||f��}}}|D]\}}||=�
|jj||jf|z|j|�z�|D]\}}|j||��ycc}}w)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME
        and appropriate options.N)r4�
widgetNamerurr-rr(r<r
rvr�r)	rNr�rwr/ro�extrar2r3�classess	         r
r
zBaseWidget.__init__Y
s�����S�"�I�&�C�$������F�C� ����$� "�D��&)�i�i�k�I�k�d�a��Z��4�5H�A�q�6�k��I��D�A�q��A��������
����!�E�)�D�M�M�#�,>�>�	@��D�A�q�
�K�K��a� ���Js�C�(Cc�p�t|jj��D]}|j��|jjd|j�|j|jjvr!|jj|j=tj|�y)z)Destroy this and all descendants widgets.r�N)
rrr,r�r<r
rvrr�rar-s  r
r�zBaseWidget.destroyj
sr���d�m�m�*�*�,�-�A�q�y�y�{�-������Y����(��:�:����-�-�-����$�$�T�Z�Z�0����T�rc�V�|jj|j|f|z�Srru)rNr�rns   r
�_dozBaseWidget._dor
s"���w�w�|�|�T�W�W�d�O�d�2�3�3rN)r!)rPrQrRr�rur
r�r|r!rr
rprp6
s#���0�@02�b��!�"�4rrpc��eZdZdZy)�WidgetzxInternal class.

    Base class for a widget which can be positioned with the geometry managers
    Pack, Place or Grid.N)rPrQrRr�r!rr
r~r~w
s���	rr~c��eZdZdZdifd�Zy)�Toplevelz"Toplevel widget, e.g. for dialogs.Nc��|r
t||f�}d}dD],}||vs�||}|ddk(r	d|ddz}nd|z}|||fz}||=�.tj||d|i|�|j�}|j	|j	��|j|j��|j
d|j�y)	a%Construct a toplevel widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, menu, relief, screen, takefocus,
        use, visual, width.r!)r]�class_rr�colormapr�r�r7Nryr()r4rpr
rr�rr�r�)	rNr�r/rorx�wmkeyr�optr�s	         r
r
zToplevel.__init__�
s�����S�"�I�&�C����E���|��%�j����9��#�3�u�S�b�z�>�S���I�c���c�
�*����J��	���D�&�*�c�2�u�E��z�z�|���
�
�d�m�m�o�&��
�
�4�:�:�<� ��
�
�(�$�,�,�7r�rPrQrRr�r
r!rr
r�r�
s��,�"��8rr�c�(�eZdZdZdifd�Zd�Zd�Zy)r�zButton widget.Nc�6�tj||d||�y)aUConstruct a button widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, repeatdelay,
            repeatinterval, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            command, compound, default, height,
            overrelief, state, width
        �buttonN�r~r
�rNr�r/ros    r
r
zButton.__init__�
s��&	����f�h��R�8rc�P�|jj|jd�y)a_Flash the button.

        This is accomplished by redisplaying
        the button several times, alternating between active and
        normal colors. At the end of the flash the button is left
        in the same normal/active state as when the command was
        invoked. This command is ignored if the button's state is
        disabled.
        �flashNrurMs r
r�zButton.flash�
s��	
�����T�W�W�g�&rc�N�|jj|jd�S)aInvoke the command associated with the button.

        The return value is the return value from the command,
        or an empty string if there is no command associated with
        the button. This command is ignored if the button's state
        is disabled.
        �invokerurMs r
r�z
Button.invoke�
s���w�w�|�|�D�G�G�X�.�.r)rPrQrRr�r
r�r�r!rr
r�r��
s���"��9�*
'�/rr�c��eZdZdZdifd�Zd�Zd�Zd�Zd�Zd<d�Z	d	�Z
d
�Zd�Zd�Z
d=d
�Zd>d�Zd=d�Zd=d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d<d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d=d-�Z.e.Z/d.�Z0e0Z1d/�Z2d?d0�Z3ifd1�Z4d2�Z5e5xZ6Z7d3�Z8d4�Z9d@d5�Z:d6�Z;d7�Z<d8�Z=d9�Z>d:�Z?d;�Z@y)A�Canvasz?Canvas widget to display graphical elements like lines or text.Nc�6�tj||d||�y)aConstruct a canvas widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, closeenough,
        confine, cursor, height, highlightbackground, highlightcolor,
        highlightthickness, insertbackground, insertborderwidth,
        insertofftime, insertontime, insertwidth, offset, relief,
        scrollregion, selectbackground, selectborderwidth, selectforeground,
        state, takefocus, width, xscrollcommand, xscrollincrement,
        yscrollcommand, yscrollincrement.�canvasNr�r�s    r
r
zCanvas.__init__�
s��	����f�h��R�8rc�X�|jj|jdf|z�y)r�addtagNrurys  r
r�z
Canvas.addtag�
� �������d�g�g�x�(�4�/�0rc�*�|j|d|�y)z*Add tag NEWTAG to all items above TAGORID.�aboveN�r��rN�newtag�tagOrIds   r
�addtag_abovezCanvas.addtag_above�
������F�G�W�-rc�(�|j|d�y)zAdd tag NEWTAG to all items.r�Nr�)rNr�s  r
�
addtag_allzCanvas.addtag_all�
s�����F�E�"rc�*�|j|d|�y)z*Add tag NEWTAG to all items below TAGORID.�belowNr�r�s   r
�addtag_belowzCanvas.addtag_below�
r�rc�0�|j|d||||�y)z�Add tag NEWTAG to item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken.�closestNr�)rNr�r�r��halo�starts      r
�addtag_closestzCanvas.addtag_closest�
s��
	
���F�I�q�!�T�5�9rc�0�|j|d||||�y)zLAdd tag NEWTAG to all items in the rectangle defined
        by X1,Y1,X2,Y2.�enclosedNr��rNr��x1�y1�x2�y2s      r
�addtag_enclosedzCanvas.addtag_enclosed�
s��	
���F�J��B��B�7rc�0�|j|d||||�y)zWAdd tag NEWTAG to all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.�overlappingNr�r�s      r
�addtag_overlappingzCanvas.addtag_overlapping�
s��	
���F�M�2�r�2�r�:rc�*�|j|d|�y)z)Add tag NEWTAG to all items with TAGORID.�withtagNr�r�s   r
�addtag_withtagzCanvas.addtag_withtag�
s�����F�I�w�/rc�|�|j|jj|jdf|z��xsdS)z|Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses all items with tags specified as arguments.r1NrErys  r
r1zCanvas.bboxs;���}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�<�7;�	<rc�D�|j|jd||f|�y)zbUnbind for all items with TAGORID for event SEQUENCE  the
        function identified with FUNCID.r�Nr�)rNr�r�r�s    r
�
tag_unbindzCanvas.tag_unbinds��	
���d�g�g�v�w��9�6�Brc�D�|j|jd|f|||�S)a&Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value.r�r�)rNr�r�r�r*s     r
�tag_bindzCanvas.tag_binds)���z�z�4�7�7�F�G�4��D�#�'�	'rc��|jj|jj|jd||��S)zrReturn the canvas x coordinate of pixel position SCREENX rounded
        to nearest multiple of GRIDSPACING units.�canvasxr)rN�screenx�gridspacings   r
r�zCanvas.canvasx�7���w�w� � �������G�G�Y���"6�7�	7rc��|jj|jj|jd||��S)zrReturn the canvas y coordinate of pixel position SCREENY rounded
        to nearest multiple of GRIDSPACING units.�canvasyr)rN�screenyr�s   r
r�zCanvas.canvasyr�rc��t|�}|jj|jj|jdf|z��D�cgc]}|jj|���c}Scc}w)z8Return a list of coordinates for the item given in ARGS.�coords)r"r<r8r
rvrRr	s   r
r�z
Canvas.coords sp����~���7�7�,�,��7�7�<�<����(� 3�d� :�;�=�>�=�*+����!�!�!�$�=�>�	>��>s�"A6c
��t|�}|d}t|ttf�r|dd}ni}|jj|jj|jd|g||j||�z����S)rr�Nr)	r"rr'rr<rQr
rvr�)rN�itemTypernror/s     r
�_createzCanvas._create's{����~���2�h���c�D�%�=�)����9�D��C��w�w�~�~�l�d�g�g�l�l��G�G�X�x�.��T�]�]�3��+�+�.�/�	/rc�(�|jd||�S)z6Create arc shaped region with coordinates x1,y1,x2,y2.�arc�r�rms   r
�
create_arczCanvas.create_arc3s���|�|�E�4��,�,rc�(�|jd||�S)z%Create bitmap with coordinates x1,y1.r�r�rms   r
�
create_bitmapzCanvas.create_bitmap7����|�|�H�d�B�/�/rc�(�|jd||�S)z)Create image item with coordinates x1,y1.rcr�rms   r
�create_imagezCanvas.create_image;s���|�|�G�T�2�.�.rc�(�|jd||�S)z-Create line with coordinates x1,y1,...,xn,yn.r�r�rms   r
�create_linezCanvas.create_line?����|�|�F�D�"�-�-rc�(�|jd||�S)z)Create oval with coordinates x1,y1,x2,y2.�ovalr�rms   r
�create_ovalzCanvas.create_ovalCr�rc�(�|jd||�S)z0Create polygon with coordinates x1,y1,...,xn,yn.�polygonr�rms   r
�create_polygonzCanvas.create_polygonGs���|�|�I�t�R�0�0rc�(�|jd||�S)z.Create rectangle with coordinates x1,y1,x2,y2.�	rectangler�rms   r
�create_rectanglezCanvas.create_rectangleKs���|�|�K��r�2�2rc�(�|jd||�S)z#Create text with coordinates x1,y1.�textr�rms   r
�create_textzCanvas.create_textOr�rc�(�|jd||�S)z+Create window with coordinates x1,y1,x2,y2.rtr�rms   r
�
create_windowzCanvas.create_windowSr�rc�X�|jj|jdf|z�y)z�Delete characters of text items identified by tag or id in ARGS (possibly
        several times) from FIRST to LAST character (including).�dcharsNrurys  r
r�z
Canvas.dcharsW�"��	
�����d�g�g�x�(�4�/�0rc�X�|jj|jdf|z�y)z<Delete items identified by all tag or ids contained in ARGS.rZNrurys  r
rZz
Canvas.delete\r�rc�X�|jj|jdf|z�y)ziDelete tag or id given as last arguments in ARGS from items
        identified by first argument in ARGS.�dtagNrurys  r
r�zCanvas.dtag`s"��	
�����d�g�g�v�&��-�.rc�|�|j|jj|jdf|z��xsdS)r�findr!rErys  r
r�zCanvas.finde�9���}�}��G�G�L�L�$�'�'�6�*�T�1�2�4�:�79�	:rc�&�|jd|�S)zReturn items above TAGORID.r��r��rNr�s  r
�
find_abovezCanvas.find_abovej����y�y��'�*�*rc�$�|jd�S)zReturn all items.r�r�rMs r
�find_allzCanvas.find_allns���y�y���rc�&�|jd|�S)zReturn all items below TAGORID.r�r�r�s  r
�
find_belowzCanvas.find_belowrr�rc�,�|jd||||�S)z�Return item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken.r�r�)rNr�r�r�r�s     r
�find_closestzCanvas.find_closestvs��
�y�y��A�q�$��6�6rc�,�|jd||||�S)z=Return all items in rectangle defined
        by X1,Y1,X2,Y2.r�r��rNr�r�r�r�s     r
�
find_enclosedzCanvas.find_enclosed}s���y�y��R��R��4�4rc�,�|jd||||�S)zLReturn all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.r�r�r�s     r
�find_overlappingzCanvas.find_overlapping�s���y�y���B��B�7�7rc�&�|jd|�S)zReturn all items with TAGORID.r�r�r�s  r
�find_withtagzCanvas.find_withtag�s���y�y��G�,�,rc�V�|jj|jdf|z�S)z.Set focus to the first item specified in ARGS.r�rurys  r
r�zCanvas.focus�s#���w�w�|�|�T�W�W�g�.��5�6�6rc��|jj|jj|jdf|z��S)z=Return tags associated with the first item specified in ARGS.�gettagsr�rys  r
rzCanvas.gettags�s7���w�w� � ��G�G�L�L�$�'�'�9�-��4�5�7�	7rc�X�|jj|jdf|z�y)zdSet cursor at position POS in the item identified by TAGORID.
        In ARGS TAGORID must be first.�icursorNrurys  r
rzCanvas.icursor�s"��	
�����d�g�g�y�)�D�0�1rc��|jj|jj|jdf|z��S)z?Return position of cursor as integer in item specified in ARGS.r=rrys  r
r=zCanvas.index�s0���w�w�~�~�d�g�g�l�l�D�G�G�W�+=��+D�E�F�Frc�X�|jj|jdf|z�y)zSInsert TEXT in item TAGORID at position POS. ARGS must
        be TAGORID POS TEXT.�insertNrurys  r
rz
Canvas.insert�r�rc�`�|jj|jdf|d|zfz�S)z9Return the resource value for an OPTION for item TAGORID.�itemcgetr7ru)rNr�r�s   r
rzCanvas.itemcget�s1���w�w�|�|�
�W�W�j�!�W�c�&�j�$9�9�;�	;rc�,�|jd|f||�S)z�Configure resources of an item TAGORID.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method without arguments.
        �
itemconfigurer�rNr�r/ros    r
r	zCanvas.itemconfigure�s�������9�3��C�Crc�X�|jj|jdf|z�y)zJLower an item TAGORID given in ARGS
        (optional below another item).r�Nrurys  r
�	tag_lowerzCanvas.tag_lower��"��	
�����d�g�g�w�'�$�.�/rc�X�|jj|jdf|z�y)z#Move an item TAGORID given in ARGS.�moveNrurys  r
rzCanvas.move�s �������d�g�g�v�&��-�.rc�V�|jj|jd|||�y)a}Move the items given by TAGORID in the canvas coordinate
        space so that the first coordinate pair of the bottommost
        item with tag TAGORID is located at position (X,Y).
        X and Y may be the empty string, in which case the
        corresponding coordinate will be unchanged. All items matching
        TAGORID remain in the same positions relative to each other.r�Nru)rNr�r�r�s    r
r�z
Canvas.moveto�s ��	
�����T�W�W�h���A�6rc�v�|jj|jdf|j||�z�S)z�Print the contents of the canvas to a postscript
        file. Valid options: colormap, colormode, file, fontmap,
        height, pageanchor, pageheight, pagewidth, pagex, pagey,
        rotate, width, x, y.�
postscriptrPrs   r
rzCanvas.postscript�s7��
�w�w�|�|�T�W�W�l�3��M�M�#�r�*�+�,�	,rc�X�|jj|jdf|z�y)zJRaise an item TAGORID given in ARGS
        (optional above another item).r�Nrurys  r
�	tag_raisezCanvas.tag_raise�r
rc�X�|jj|jdf|z�y)z9Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.�scaleNrurys  r
rzCanvas.scale�s �������d�g�g�w�'�$�.�/rc�V�|jj|jdd||�y�z&Remember the current X, Y coordinates.�scan�markNrurGs   r
�	scan_markzCanvas.scan_mark���������T�W�W�f�f�a��3rc�X�|jj|jdd|||�y)z�Adjust the view of the canvas to GAIN times the
        difference between X and Y and the coordinates given in
        scan_mark.r�dragtoNru)rNr�r��gains    r
�scan_dragtozCanvas.scan_dragto�s"��	
�����T�W�W�f�h��1�d�;rc�V�|jj|jdd||�y)zLAdjust the end of the selection near the cursor of an item TAGORID to index.�select�adjustNru�rNr�r=s   r
�
select_adjustzCanvas.select_adjust�s�������T�W�W�h��'�5�Arc�R�|jj|jdd�y)�,Clear the selection if it is in this widget.r"r�NrurMs r
�select_clearzCanvas.select_clear�s�������T�W�W�h��0rc�V�|jj|jdd||�y)z:Set the fixed end of a selection in item TAGORID to INDEX.r"�fromNrur$s   r
�select_fromzCanvas.select_from�s�������T�W�W�h����?rc�X�|jj|jdd�xsdS)z(Return the item which has the selection.r"r%NrurMs r
�select_itemzCanvas.select_item�s"���w�w�|�|�D�G�G�X�v�6�>�$�>rc�V�|jj|jdd||�y)z=Set the variable end of a selection in item TAGORID to INDEX.r"�toNrur$s   r
�	select_tozCanvas.select_to�s�������T�W�W�h��g�u�=rc�X�|jj|jd|�xsdS)z$Return the type of the item TAGORID.r(Nrur�s  r
r(zCanvas.type�s"���w�w�|�|�D�G�G�V�W�5�=��=rrnrrE)r�r�)�
)ArPrQrRr�r
r�r�r�r�r�r�r�r�r1r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rZr�r�r�r�r�r�r�r�r�r�rrr=rrr	�
itemconfigrr�rr�rrrqr�rrr r%r(r+r-r0r(r!rr
r�r��
sK��I�"��
9�1�.�#�.�:�8�
;�
0�<�C�
'�7�7�>�
/�-�0�/�.�.�1�3�.�0�1�
1�/�
:�
+� �+�7�5�
8�
-�7�7�
2�
G�1�
;�
D��J�0�

�E�/�7� �,�0�
��D�7�0�4�<�B�1�@�?�>�>rr�c�L��eZdZdZdifd�Z�fd�Zd�Zd�Zd�Zd�Z	d	�Z
�xZS)
�Checkbuttonz7Checkbutton widget which is either in on- or off-state.Nc�6�tj||d||�y)aConstruct a checkbutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, offvalue, onvalue, padx, pady, relief,
        selectcolor, selectimage, state, takefocus, text, textvariable,
        underline, variable, width, wraplength.�checkbuttonNr�r�s    r
r
zCheckbutton.__init__���	����f�m�S�"�=rc���|jd�s<|jjj�}tdz
ad|�dt��|d<t
�|�||�y)Nr�rrrr7)rrBrPr��_checkbutton_count�superru)rNr�r/r�rBs    �r
ruzCheckbutton._setups[����w�w�v���>�>�*�*�0�0�2�D��!�#���d�V�1�%7�$8�9�C��K�
���v�s�#rc�P�|jj|jd�y�zPut the button in off-state.�deselectNrurMs r
r>zCheckbutton.deselects�������T�W�W�j�)rc�P�|jj|jd�y�zFlash the button.r�NrurMs r
r�zCheckbutton.flash"��������T�W�W�g�&rc�N�|jj|jd�S�z<Toggle the button and invoke a command if given as resource.r�rurMs r
r�zCheckbutton.invoke&����w�w�|�|�D�G�G�X�.�.rc�P�|jj|jd�y�zPut the button in on-state.r"NrurMs r
r"zCheckbutton.select*��������T�W�W�h�'rc�P�|jj|jd�y)zToggle the button.�toggleNrurMs r
rIzCheckbutton.toggle.rGr)rPrQrRr�r
rur>r�r�r"rI�
__classcell__)rBs@r
r5r5s.���A�"��
>�$�*�'�/�(�(rr5c��eZdZdZdifd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�ZeZ
d�ZeZd
�ZeZd�ZeZd�ZeZd�ZeZy)�Entryz1Entry widget which allows displaying simple text.Nc�6�tj||d||�y)aConstruct an entry widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, highlightbackground,
        highlightcolor, highlightthickness, insertbackground,
        insertborderwidth, insertofftime, insertontime, insertwidth,
        invalidcommand, invcmd, justify, relief, selectbackground,
        selectborderwidth, selectforeground, show, state, takefocus,
        textvariable, validate, validatecommand, vcmd, width,
        xscrollcommand.�entryNr�r�s    r
r
zEntry.__init__6s��	����f�g�s�B�7rc�T�|jj|jd||�y)z.Delete text from FIRST to LAST (not included).rZNru�rN�first�lasts   r
rZzEntry.deleteC��������T�W�W�h��t�4rc�N�|jj|jd�S)zReturn the text.rrurMs r
rz	Entry.getG����w�w�|�|�D�G�G�U�+�+rc�R�|jj|jd|�y)zInsert cursor at INDEX.rNru�rNr=s  r
rz
Entry.icursorKs�������T�W�W�i��/rc��|jj|jj|jd|��S)zReturn position of cursor.r=rrWs  r
r=zEntry.indexOs1���w�w�~�~�d�g�g�l�l��G�G�W�e�%�&�	&rc�T�|jj|jd||�y)zInsert STRING at INDEX.rNru)rNr=r�s   r
rzEntry.insertTs�������T�W�W�h��v�6rc�T�|jj|jdd|�yrrur>s  r
rzEntry.scan_markXs�������T�W�W�f�f�a�0rc�T�|jj|jdd|�y)z�Adjust the view of the canvas to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrur>s  r
r zEntry.scan_dragto\s��	
�����T�W�W�f�h��2rc�T�|jj|jdd|�y)z9Adjust the end of the selection near the cursor to INDEX.r�r#NrurWs  r
�selection_adjustzEntry.selection_adjustb��������T�W�W�k�8�U�;rc�R�|jj|jdd�y)r'r�r�NrurMs r
r�zEntry.selection_clearhs�������T�W�W�k�7�3rc�T�|jj|jdd|�y)�*Set the fixed end of a selection to INDEX.r�r*NrurWs  r
�selection_fromzEntry.selection_fromns�������T�W�W�k�6�5�9rc��|jj|jj|jdd��S)zSReturn True if there are characters selected in the entry, False
        otherwise.r��presentrrMs r
�selection_presentzEntry.selection_presentt�3���w�w�!�!��G�G�L�L����+�y�9�;�	;rc�V�|jj|jdd||�y)�3Set the selection from START to END (not included).r��rangeNru�rNr��ends   r
�selection_rangezEntry.selection_range|s�������T�W�W�k�7�E�3�?rc�T�|jj|jdd|�y)�-Set the variable end of a selection to INDEX.r�r/NrurWs  r
�selection_tozEntry.selection_to�s�������T�W�W�k�4��7rr)rPrQrRr�r
rZrrr=rrr r]r%r�r(rbr+re�select_presentrl�select_rangeror0r!rr
rLrL3s{��;�"��8�5�,�0�&�
7�1�3�<�%�M�4�#�L�:�!�K�;�'�N�@�#�L�8��IrrLc��eZdZdZdifd�Zy)�FramezFFrame widget which may contain other widgets and can have a 3D border.Nc��t||f�}d}d|vrd|df}|d=nd|vr
d|df}|d=tj||d|i|�y)aConstruct a frame widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, relief, takefocus, visual, width.r!r�z-classrr�N)r4r~r
)rNr�r/rorxs     r
r
zFrame.__init__�se����b�	�"�����s�?��s�8�}�-�E��H�
�
��^��s�7�|�,�E��G������f�g�s�B��>rr�r!rr
rsrs�s��P�"��?rrsc��eZdZdZdifd�Zy)�Labelz0Label widget which can display text and bitmaps.Nc�6�tj||d||�y)a�Construct a label widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            height, state, width

        �labelNr�r�s    r
r
zLabel.__init__�s��$	����f�g�s�B�7rr�r!rr
rvrv�s��:�"��8rrvc��eZdZdZdifd�Zd�Zd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZeZdd�ZeZd�ZeZdd�ZeZd�Zd�Zdd�ZeZy)�Listboxz3Listbox widget which can display a list of strings.Nc�6�tj||d||�y)a�Construct a listbox widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, height, highlightbackground,
        highlightcolor, highlightthickness, relief, selectbackground,
        selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
        width, xscrollcommand, yscrollcommand, listvariable.�listboxNr�r�s    r
r
zListbox.__init__�s��	����f�i��b�9rc�R�|jj|jd|�y)z"Activate item identified by INDEX.�activateNrurWs  r
r~zListbox.activate���������T�W�W�j�%�0rc�v�|j|jj|jd|��xsdS)zxReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses the item identified by the given index.r1NrErWs  r
r1zListbox.bbox�s-���}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�t�|j|jj|jd��xsdS)z.Return the indices of currently selected item.�curselectionr!rErMs r
r�zListbox.curselection�s)���}�}�T�W�W�\�\�$�'�'�>�B�C�I�r�Irc�T�|jj|jd||�y)z+Delete items from FIRST to LAST (included).rZNrurPs   r
rZzListbox.delete�rSrc���|�A|jj|jj|jd||��S|jj|jd|�S)z0Get list of items from FIRST to LAST (included).rr�rPs   r
rzListbox.get�sX�����7�7�$�$�T�W�W�\�\������t�&-�.�
.��7�7�<�<������6�6rc��|jj|jd|�}|dk(ry|jj|�S)z+Return index of item identified with INDEX.r=r�N�r<r
rvrQ�rNr=r�s   r
r=z
Listbox.index�s8���G�G�L�L����'�5�1����;�t��w�w�~�~�a� � rc�Z�|jj|jd|f|z�y)zInsert ELEMENTS at INDEX.rNru)rNr=�elementss   r
rzListbox.insert�s"�������d�g�g�x��/�(�:�;rc��|jj|jj|jd|��S)z5Get index of item which is nearest to y coordinate Y.�nearestr)rNr�s  r
r�zListbox.nearest�s1���w�w�~�~�d�g�g�l�l��G�G�Y��#�$�	$rc�V�|jj|jdd||�yrrurGs   r
rzListbox.scan_mark�rrc�V�|jj|jdd||�y)z�Adjust the view of the listbox to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrurGs   r
r zListbox.scan_dragto�� ��	
�����T�W�W�f�h��1�5rc�R�|jj|jd|�y)z"Scroll such that INDEX is visible.�seeNrurWs  r
r�zListbox.see���������T�W�W�e�U�+rc�T�|jj|jdd|�y)z-Set the fixed end oft the selection to INDEX.r�r.NrurWs  r
�selection_anchorzListbox.selection_anchor�r^rc�V�|jj|jdd||�y)z2Clear the selection from FIRST to LAST (included).r�r�NrurPs   r
r�zListbox.selection_clear�s!�������T�W�W��g�u�d�	4rc��|jj|jj|jdd|��S)z.Return True if INDEX is part of the selection.r��includesrrWs  r
�selection_includeszListbox.selection_includes
s5���w�w�!�!�$�'�'�,�,��G�G�[�*�e�#5�6�	6rc�V�|jj|jdd||�y)ziSet the selection from FIRST to LAST (included) without
        changing the currently selected elements.r�rNrurPs   r
�
selection_setzListbox.selection_set
s ��	
�����T�W�W�k�5�%��>rc��|jj|jj|jd��S)z-Return the number of elements in the listbox.rOrrMs r
rOzListbox.size
s(���w�w�~�~�d�g�g�l�l�4�7�7�F�;�<�<rc�`�|jj|jdf|d|zfz�S)z4Return the resource value for an ITEM and an OPTION.rr7ru�rNr=r�s   r
rzListbox.itemcget
s1���w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�,�|jd|f||�S)a9Configure resources of an ITEM.

        The values for resources are specified as keyword arguments.
        To get an overview about the allowed keyword arguments
        call the method without arguments.
        Valid resource names: background, bg, foreground, fg,
        selectbackground, selectforeground.r	rrCs    r
r	zListbox.itemconfigure
s�������7��b�A�Arr)rPrQrRr�r
r~r1r�rZrr=rr�rr r�r��
select_anchorr�r(r��select_includesr��
select_setrOrr	r3r!rr
rzrz�s���=�"��:�1�K�
J�5�7�!�<�$�
4�6�,�<�%�M�4�
#�L�6�
)�O�?�
�J�=�9�
B��Jrrzc���eZdZdZdifd�Zdd�Zd�Zifd�Zifd�Zifd�Z	ifd	�Z
ifd
�Zifd�Zifd�Z
ifd
�Zifd�Zifd�Zifd�Zifd�Zdd�Zd�Zdd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�MenuzPMenu widget which allows displaying menu bars, pull-down menus and pop-up menus.Nc�6�tj||d||�y)aAConstruct menu widget with the parent MASTER.

        Valid resource names: activebackground, activeborderwidth,
        activeforeground, background, bd, bg, borderwidth, cursor,
        disabledforeground, fg, font, foreground, postcommand, relief,
        selectcolor, takefocus, tearoff, tearoffcommand, title, type.�menuNr�r�s    r
r
z
Menu.__init__,
s��	����f�f�c�2�6rc�V�|jjd|j|||�y)z/Post the menu at position X,Y with entry ENTRY.�tk_popupNru)rNr�r�rNs    r
r�z
Menu.tk_popup5
s�������Z����!�Q��6rc�R�|jj|jd|�y)zActivate entry at INDEX.r~NrurWs  r
r~z
Menu.activate9
rrc�z�|jj|jd|f|j||�z�y)rr*NrP)rNr�r/ros    r
r*zMenu.add=
s2�������d�g�g�u�h�/����s�B�'�(�	)rc�0�|jd|xs|�y)zAdd hierarchical menu item.�cascadeN�r*rs   r
�add_cascadezMenu.add_cascadeB
�������C�I�2�&rc�0�|jd|xs|�y)zAdd checkbutton menu item.r7Nr�rs   r
�add_checkbuttonzMenu.add_checkbuttonF
��������	�r�*rc�0�|jd|xs|�y)zAdd command menu item.r�Nr�rs   r
�add_commandzMenu.add_commandJ
r�rc�0�|jd|xs|�y)zAdd radio menu item.�radiobuttonNr�rs   r
�add_radiobuttonzMenu.add_radiobuttonN
r�rc�0�|jd|xs|�y)zAdd separator.�	separatorNr�rs   r
�
add_separatorzMenu.add_separatorR
s������c�i�R�(rc�|�|jj|jd||f|j||�z�y)rrNrP)rNr=r�r/ros     r
rzMenu.insertV
s4�������d�g�g�x���9����s�B�'�(�	)rc�2�|j|d|xs|�y)z$Add hierarchical menu item at INDEX.r�N�rrCs    r
�insert_cascadezMenu.insert_cascade[
������E�9�c�i�R�0rc�2�|j|d|xs|�y)z#Add checkbutton menu item at INDEX.r7Nr�rCs    r
�insert_checkbuttonzMenu.insert_checkbutton_
������E�=�#�)��4rc�2�|j|d|xs|�y)zAdd command menu item at INDEX.r�Nr�rCs    r
�insert_commandzMenu.insert_commandc
r�rc�2�|j|d|xs|�y)zAdd radio menu item at INDEX.r�Nr�rCs    r
�insert_radiobuttonzMenu.insert_radiobuttong
r�rc�2�|j|d|xs|�y)zAdd separator at INDEX.r�Nr�rCs    r
�insert_separatorzMenu.insert_separatork
s�����E�;��	�r�2rc�`�|�|}|j|�|j|�}}|�|�d\}}t||dz�D]E}d|j|�vs�t|j	|d��}|s�5|j|��G|jj|jd||�y)z7Delete menu items between INDEX1 and INDEX2 (included).N)rr�rr�rZ)	r=ri�entryconfigr�	entrycgetrr<r
rv)rN�index1�index2�
num_index1�
num_index2r�r0s       r
rZzMenu.deleteo
s����>��F�!%���F�!3�T�Z�Z��5G�J�
���J�$6�%*�"�J�
��z�:��>�2�A��D�,�,�Q�/�/�����q�)�4�5����&�&�q�)�	3�
	
�����T�W�W�h���7rc�X�|jj|jd|d|z�S)z=Return the resource value of a menu item for OPTION at INDEX.r�r7rur�s   r
r�zMenu.entrycget
s#���w�w�|�|�D�G�G�[�%��v��F�Frc�,�|jd|f||�S)zConfigure a menu item at INDEX.�entryconfigurerrCs    r
r�zMenu.entryconfigure�
s����� 0�%�8�#�r�B�Brc��|jj|jd|�}|dvrdS|jj|�S)z4Return the index of a menu item identified by INDEX.r=)r�r�Nr�r�s   r
r=z
Menu.index�
s;���G�G�L�L����'�5�1���L�(�t�?�d�g�g�n�n�Q�.?�?rc�P�|jj|jd|�S)zRInvoke a menu item identified by INDEX and execute
        the associated command.r�rurWs  r
r�zMenu.invoke�
s���w�w�|�|�D�G�G�X�u�5�5rc�T�|jj|jd||�y)zDisplay a menu at position X,Y.�postNrurGs   r
r�z	Menu.post�
s�������T�W�W�f�a��+rc�P�|jj|jd|�S)z*Return the type of the menu item at INDEX.r(rurWs  r
r(z	Menu.type�
s���w�w�|�|�D�G�G�V�U�3�3rc�P�|jj|jd�y)z
Unmap a menu.�unpostNrurMs r
r�zMenu.unpost�
rGrc��|jj|jj|jd|��S)zNReturn the x-position of the leftmost pixel of the menu item
        at INDEX.�	xpositionrrWs  r
r�zMenu.xposition�
s,���w�w�~�~�d�g�g�l�l�4�7�7�K��G�H�Hrc��|jj|jj|jd|��S)zEReturn the y-position of the topmost pixel of the menu item at INDEX.�	ypositionrrWs  r
r�zMenu.yposition�
s1���w�w�~�~�d�g�g�l�l��G�G�[�%�)�*�	*r�r�r)rPrQrRr�r
r�r~r*r�r�r�r�r�rr�r�r�r�r�rZr�r�r�r=r�r�r(r�r�r�r!rr
r�r�)
s���Z�"��7�7�1�!#�)�
!�'�#%�+�!�'�#%�+�!#�)�+-�)�
)+�1�-/�5�)+�1�-/�5�+-�3�8� G�C�!�K�@�
6�
,�4�(�I�
*rr�c��eZdZdZdifd�Zy)�
Menubuttonz(Menubutton widget, obsolete since Tk8.0.Nc�6�tj||d||�y)N�
menubuttonr�r�s    r
r
zMenubutton.__init__�
s������f�l�C��<rr�r!rr
r�r��
s��2�"��=rr�c��eZdZdZdifd�Zy)�MessagezKMessage widget to display multiline text. Obsolete since Label does it too.Nc�6�tj||d||�y)N�messager�r�s    r
r
zMessage.__init__�
s������f�i��b�9rr�r!rr
r�r��
s��U�"��:rr�c�4�eZdZdZdifd�Zd�Zd�Zd�Zd�Zy)�RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.Nc�6�tj||d||�y)a�Construct a radiobutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, padx, pady, relief, selectcolor, selectimage,
        state, takefocus, text, textvariable, underline, value, variable,
        width, wraplength.r�Nr�r�s    r
r
zRadiobutton.__init__�
r8rc�P�|jj|jd�yr=rurMs r
r>zRadiobutton.deselect�
s��	
�����T�W�W�j�)rc�P�|jj|jd�yr@rurMs r
r�zRadiobutton.flash�
rArc�N�|jj|jd�SrCrurMs r
r�zRadiobutton.invoke�
rDrc�P�|jj|jd�yrFrurMs r
r"zRadiobutton.select�
rGr)	rPrQrRr�r
r>r�r�r"r!rr
r�r��
s#��Q�"��
>�*�
'�/�(rr�c�6�eZdZdZdifd�Zd�Zd�Zdd�Zd�Zy)	�Scalez1Scale widget which can display a numerical scale.Nc�6�tj||d||�y)a�Construct a scale widget with the parent MASTER.

        Valid resource names: activebackground, background, bigincrement, bd,
        bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
        highlightbackground, highlightcolor, highlightthickness, label,
        length, orient, relief, repeatdelay, repeatinterval, resolution,
        showvalue, sliderlength, sliderrelief, state, takefocus,
        tickinterval, to, troughcolor, variable, width.rNr�r�s    r
r
zScale.__init__�
s��	����f�g�s�B�7rc���|jj|jd�}	|jj|�S#tt
tf$r|jj|�cYSwxYw)z*Get the current value as integer or float.r)r<r
rvrQr�r+r�rRrs  r
rz	Scale.get�
s]�������T�W�W�e�,��	,��7�7�>�>�%�(�(���I�x�0�	,��7�7�$�$�U�+�+�	,�s�A�/A5�4A5c�R�|jj|jd|�y)zSet the value to VALUE.rNrurs  r
rz	Scale.set�
r�rc�n�|j|jj|jd|��S)z�Return a tuple (X,Y) of the point along the centerline of the
        trough that corresponds to VALUE or the current value if None is
        given.r�rErs  r
r�zScale.coords�
s(��
�}�}�T�W�W�\�\�$�'�'�8�U�C�D�Drc�R�|jj|jd||�S)zcReturn where the point X,Y lies. Valid return values are "slider",
        "though1" and "though2".�identifyrurGs   r
r�zScale.identify�
�!���w�w�|�|�D�G�G�Z��A�6�6rr)	rPrQrRr�r
rrr�r�r!rr
r�r��
s$��;�"��	8�,�,�E�7rr�c�B�eZdZdZdifd�Zd
d�Zd�Zd�Zd�Zd�Z	d	�Z
y)�	Scrollbarz?Scrollbar widget which displays a slider at a certain position.Nc�6�tj||d||�y)alConstruct a scrollbar widget with the parent MASTER.

        Valid resource names: activebackground, activerelief,
        background, bd, bg, borderwidth, command, cursor,
        elementborderwidth, highlightbackground,
        highlightcolor, highlightthickness, jump, orient,
        relief, repeatdelay, repeatinterval, takefocus,
        troughcolor, width.�	scrollbarNr�r�s    r
r
zScrollbar.__init__s��	����f�k�3��;rc�X�|jj|jd|�xsdS)a�Marks the element indicated by index as active.
        The only index values understood by this method are "arrow1",
        "slider", or "arrow2".  If any other value is specified then no
        element of the scrollbar will be active.  If index is not specified,
        the method returns the name of the element that is currently active,
        or None if no element is active.r~NrurWs  r
r~zScrollbar.activates$���w�w�|�|�D�G�G�Z��7�?�4�?rc��|jj|jj|jd||��S)znReturn the fractional change of the scrollbar setting if it
        would be moved by DELTAX or DELTAY pixels.r�r)rN�deltax�deltays   r
r�zScrollbar.deltas5���w�w� � ��G�G�L�L����'�6�6�:�<�	<rc��|jj|jj|jd||��S)zRReturn the fractional value which corresponds to a slider
        position of X,Y.r�rrGs   r
r�zScrollbar.fractions0���w�w� � ������d�g�g�z�1�a�!H�I�Irc�R�|jj|jd||�S)zYReturn the element under position X,Y as one of
        "arrow1","slider","arrow2" or "".r�rurGs   r
r�zScrollbar.identify"r�rc�l�|j|jj|jd��S)zZReturn the current fractional values (upper and lower end)
        of the slider position.r)r�r<r
rvrMs r
rz
Scrollbar.get's(����������T�W�W�e� <�=�=rc�T�|jj|jd||�y)ziSet the fractional values of the slider position (upper and
        lower ends as value between 0 and 1).rNrurPs   r
rz
Scrollbar.set,s��	
�����T�W�W�e�U�D�1rr)rPrQrRr�r
r~r�r�r�rrr!rr
r�r�s/��I�"��	<�@�<�J�
7�
>�
2rr�c��eZdZdZdifd�Zd�Zd�Zd�Zd8d�Zd8d�Z	d	�Z
d9d
�Zd�Zd8d�Z
d
�Zd�Zd�Zd�Zd8d�Zd�Zd8d�Zifd�Zd�Zd�Zd�Zd8d�Zd�Zd�Zd�Zd�Zd�Zifd�Zd�Z d �Z!d!�Z"d"�Z#			d:d#�Z$d$�Z%d%�Z&d8d&�Z'd8d'�Z(d;d(�Z)d)�Z*d8d*�Z+e+Z,d+�Z-d8d,�Z.d8d-�Z/d8d.�Z0d8d/�Z1d8d0�Z2d1�Z3d8d2�Z4d3�Z5d8d4�Z6e6Z7ifd5�Z8d6�Z9d7�Z:y)<�Textz4Text widget which can display text in various forms.Nc�6�tj||d||�y)a�Construct a text widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor,
            exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, padx, pady,
            relief, selectbackground,
            selectborderwidth, selectforeground,
            setgrid, takefocus,
            xscrollcommand, yscrollcommand,

        WIDGET-SPECIFIC OPTIONS

            autoseparators, height, maxundo,
            spacing1, spacing2, spacing3,
            state, tabs, undo, width, wrap,

        r�Nr�r�s    r
r
z
Text.__init__5s��.	����f�f�c�2�6rc�v�|j|jj|jd|��xsdS)z�Return a tuple of (x,y,width,height) which gives the bounding
        box of the visible part of the character at the given index.r1NrErWs  r
r1z	Text.bboxNs5���}�}������T�W�W�f�e�4�6�>�9=�	>rc	��|jj|jj|jd|||��S)z�Return whether between index INDEX1 and index INDEX2 the
        relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.�comparer)rNr��opr�s    r
rzText.compareTs9���w�w�!�!�$�'�'�,�,��G�G�Y���F�#4�5�	5rc��|D�cgc]}d|z��	}}|||gz
}|jj|jdg|���xsd}|�t|�dkr|fS|Scc}w)a�Counts the number of relevant things between the two indices.
        If index1 is after index2, the result will be a negative number
        (and this holds for each of the possible options).

        The actual items which are counted depends on the options given by
        args. The result is a list of integers, one for the result of each
        counting option given. Valid counting options are "chars",
        "displaychars", "displayindices", "displaylines", "indices",
        "lines", "xpixels" and "ypixels". There is an additional possible
        option "update", which if given then all subsequent options ensure
        that any possible out of date information is recalculated.r^rtN�)r<r
rvr)rNr�r�rn�argr$s      r
rtz
Text.countZso��(,�,�t�����t��,���� � ���d�g�g�l�l�4�7�7�G�3�d�3�;�t���?�s�4�y�A�~��7�N��J��
-s�Ac���|�?|jj|jj|jd��S|jj|jd|�y)zjTurn on the internal consistency checks of the B-Tree inside the text
        widget according to BOOLEAN.N�debugrrfs  r
rz
Text.debugnsI���?��7�7�%�%�d�g�g�l�l�4�7�7�G�&D�E�E������T�W�W�g�w�/rc�T�|jj|jd||�y)z?Delete the characters between INDEX1 and INDEX2 (not included).rZNru�rNr�r�s   r
rZzText.deleteus�������T�W�W�h���7rc�n�|j|jj|jd|��S)z�Return tuple (x,y,width,height,baseline) giving the bounding box
        and baseline position of the visible part of the line containing
        the character at INDEX.�	dlineinforErWs  r
rzText.dlineinfoys(���}�}�T�W�W�\�\�$�'�'�;��F�G�Grc��g}d}d}|s	g}|fd�}|}	t|t�s|j|�x}}|d|gz
}|D]}	||	s�	|jd|	z��|j|�|r|j|�|jj
|jdg|���||r|j|�SS#|r|j|�wwxYw)a�Return the contents of the widget between index1 and index2.

        The type of contents returned in filtered based on the keyword
        parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are
        given and true, then the corresponding items are returned. The result
        is a list of triples of the form (key, value, index). If none of the
        keywords are true then 'all' is used by default.

        If the 'command' argument is given, it is called once for each element
        of the list of triples, with the values of each triple serving as the
        arguments to the function. In this case the list is not returned.Nc�,�|j|||f�yr)r�)rArr=rs    r
�
append_triplez Text.dump.<locals>.append_triple�s���
�
�s�E�5�1�2rz-commandr7�dump)rrr'r�r<r
rvr)
rNr�r�r�rorn�	func_namerrrAs
          r
rz	Text.dumps������	����
�F�8>�
3�#�G�
	.��g�s�+�&*�n�n�W�&=�=�	�G��Z��)�)�D����c�7�D�K�K��c�	�2���K�K�������F�#��D�G�G�L�L����&�0�4�0����"�"�9�-���y��"�"�9�-��s�4C�A#C�Cc�R�|jj|jdg|���S)arInternal method

        This method controls the undo mechanism and
        the modified flag. The exact behavior of the
        command depends on the option argument that
        follows the edit argument. The following forms
        of the command are currently supported:

        edit_modified, edit_redo, edit_reset, edit_separator
        and edit_undo

        �editrurys  r
rz	Text.edit�s$���t�w�w�|�|�D�G�G�V�3�d�3�3rc�&�|jd|�S)a;Get or Set the modified flag

        If arg is not specified, returns the modified
        flag of the widget. The insert, delete, edit undo and
        edit redo commands or the user can set or clear the
        modified flag. If boolean is specified, sets the
        modified flag of the widget to arg.
        �modified�r)rNr
s  r
�
edit_modifiedzText.edit_modified�s���y�y��S�)�)rc�$�|jd�S)aRedo the last undone edit

        When the undo option is true, reapplies the last
        undone edits provided no other edits were done since
        then. Generates an error when the redo stack is empty.
        Does nothing when the undo option is false.
        �redorrMs r
�	edit_redozText.edit_redo�s���y�y�� � rc�$�|jd�S)z(Clears the undo and redo stacks
        �resetrrMs r
�
edit_resetzText.edit_reset�s���y�y��!�!rc�$�|jd�S)znInserts a separator (boundary) on the undo stack.

        Does nothing when the undo option is false
        r�rrMs r
�edit_separatorzText.edit_separator�s��
�y�y��%�%rc�$�|jd�S)aDUndoes the last edit action

        If the undo option is true. An edit action is defined
        as all the insert and delete commands that are recorded
        on the undo stack in between two separators. Generates
        an error when the undo stack is empty. Does nothing
        when the undo option is false
        �undorrMs r
�	edit_undozText.edit_undo�s���y�y�� � rc�R�|jj|jd||�S)z5Return the text from INDEX1 to INDEX2 (not included).rrurs   r
rzText.get�s���w�w�|�|�D�G�G�U�F�F�;�;rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z9Return the value of OPTION of an embedded image at INDEX.Nrr7r�r�rcrrur�s   r
�
image_cgetzText.image_cget�sQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�W�f�e�V�D�Drc�.�|jdd|f||�S)z%Configure an embedded image at INDEX.rcrrrCs    r
�image_configurezText.image_configure�s�������e�<�c�2�F�Frc�v�|jj|jdd|g|j||����S)z"Create an embedded image at INDEX.rcrrPrCs    r
�image_createzText.image_create�s9���t�w�w�|�|����'�8�U�*��-�-��R�(�*�	*rc�P�|jj|jdd�S)z3Return all names of embedded images in this widget.rcrdrurMs r
rezText.image_names�s���w�w�|�|�D�G�G�W�g�6�6rc�b�t|jj|jd|��S)z1Return the index in the form line.char for INDEX.r=)rr<r
rvrWs  r
r=z
Text.index�s"���4�7�7�<�<�����%�8�9�9rc�\�|jj|jd||f|z�y)z�Insert CHARS before the characters at INDEX. An additional
        tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.rNru)rNr=�charsrns    r
rzText.inserts&��	
�����d�g�g�x���6��=�>rc�V�|jj|jdd||f�S)z�Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
        Return the current value if None is given for DIRECTION.r�gravityru)rN�markName�	directions   r
�mark_gravityzText.mark_gravitys+���w�w�|�|�
�W�W�f�i��9�=�?�	?rc��|jj|jj|jdd��S)zReturn all mark names.rrdr�rMs r
�
mark_nameszText.mark_namess3���w�w� � �������G�G�V�W�"&�'�	'rc�V�|jj|jdd||�y)z0Set mark MARKNAME before the character at INDEX.rrNru)rNr4r=s   r
�mark_setz
Text.mark_sets�������T�W�W�f�e�X�u�=rc�Z�|jj|jddf|z�y)zDelete all marks in MARKNAMES.r�unsetNru)rN�	markNamess  r
�
mark_unsetzText.mark_unsets"�������d�g�g�v�w�/�)�;�<rc�Z�|jj|jdd|�xsdS)z-Return the name of the next mark after INDEX.r�nextNrurWs  r
�	mark_nextzText.mark_nexts$���w�w�|�|�D�G�G�V�V�U�;�C�t�Crc�Z�|jj|jdd|�xsdS)z2Return the name of the previous mark before INDEX.r�previousNrurWs  r
�
mark_previouszText.mark_previouss$���w�w�|�|�D�G�G�V�Z��?�G�4�Grc�x�|jj|jdd|g|j||����y)aCreates a peer text widget with the given newPathName, and any
        optional standard configuration options. By default the peer will
        have the same start and end line as the parent widget, but
        these can be overridden with the standard configuration options.�peerrNrP)rN�newPathNamer/ros    r
�peer_createzText.peer_create!s5��
	������T�W�W�f�h��	%�
�]�]�3��
#�	%rc��|jj|jj|jdd��S)zYReturns a list of peers of this widget (this does not include
        the widget itself).rFrdr�rMs r
�
peer_nameszText.peer_names)s.���w�w� � ������d�g�g�v�w�!G�H�Hrc�Z�|jj|jd|||g|���y)z�Replaces the range of characters between index1 and index2 with
        the given characters and tags specified by args.

        See the method insert for some more information about args, and the
        method delete for information about the indices.rNru)rNr�r�r1rns     r
rzText.replace.s'��	������T�W�W�i����F��Frc�V�|jj|jdd||�yrrurGs   r
rzText.scan_mark6rrc�V�|jj|jdd||�y)z~Adjust the view of the text to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.rrNrurGs   r
r zText.scan_dragto:r�rc�D�|jdg}|r|jd�|r|jd�|r|jd�|r|jd�|r|jd�|
r|jd�|	r"|jd�|j|	�|r|d	d
k(r|jd�|j|�|j|�|r|j|�t|jj	t|���S)z�Search PATTERN beginning from INDEX until STOPINDEX.
        Return the index of the first character of a match or an
        empty string.rz	-forwardsz
-backwardsz-exactz-regexpz-nocasez-elidez-countrr7r�)rvr�rr<r
r)rNr�r=�	stopindex�forwards�	backwards�exact�regexp�nocasert�eliderns            r
rzText.search@s�������"���T�[�[��-��d�k�k�,�/��$�+�+�h�'��4�;�;�y�)��4�;�;�y�)��$�+�+�h�'��$�+�+�h�'����U�);��w�q�z�S�(�$�+�+�d�*;����G�����E���d�k�k�)�,��4�7�7�<�<��d��,�-�-rc�R�|jj|jd|�y)z3Scroll such that the character at INDEX is visible.r�NrurWs  r
r�zText.seeTr�rc�^�|jj|jdd||f|z�y)z|Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
        Additional pairs of indices may follow in ARGS.�tagr*Nru)rN�tagNamer�rns    r
�tag_addzText.tag_addXs+��	
�����
�W�W�e�U�G�V�4�t�;�	=rc�D�|j|jdd||f|�S)zgUnbind for all characters with TAGNAME for event SEQUENCE  the
        function identified with FUNCID.rXr�r�)rNrYr�r�s    r
r�zText.tag_unbind^s$���|�|�T�W�W�e�V�W�h�G��P�Prc�F�|j|jdd|f|||�S)a+Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value.rXr�r��rNrYr�r�r*s     r
r�z
Text.tag_bindcs+���z�z�4�7�7�E�6�7�;��D�#�'�	'rc�F�|j|jdd|f|||�S)NrXr�r�r]s     r
�	_tag_bindzText._tag_bindls)���z�z�4�7�7�E�6�7�;��D�#�'�	'rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z+Return the value of OPTION for tag TAGNAME.Nrr7r�r�rXrru)rNrYr�s   r
�tag_cgetz
Text.tag_cgetqsQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�U�F�G�V�D�Drc�.�|jdd|f||�S)zConfigure a tag TAGNAME.rXrr)rNrYr/ros    r
�
tag_configurezText.tag_configureys������{�G�<�c�2�F�Frc�Z�|jj|jddf|z�y)zDelete all tags in TAGNAMES.rXrZNru)rN�tagNamess  r
�
tag_deletezText.tag_deletes"�������d�g�g�u�h�/�(�:�;rc�V�|jj|jdd||�y)z`Change the priority of tag TAGNAME such that it is lower
        than the priority of BELOWTHIS.rXr�Nru)rNrYr�s   r
rzText.tag_lower�s ��	
�����T�W�W�e�W�g�y�Arc��|jj|jj|jdd|��S)zReturn a list of all tag names.rXrdr�rWs  r
�	tag_nameszText.tag_names�s3���w�w� � ��G�G�L�L����%��%�8�:�	:rc
��|jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched forward from INDEX1.rX�	nextranger��rNrYr�r�s    r
�
tag_nextrangezText.tag_nextrange��>���w�w� � �������G�G�U�K��&�&�"B�C�	Crc
��|jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched backwards from INDEX1.rX�	prevranger�rls    r
�
tag_prevrangezText.tag_prevrange�rnrc�V�|jj|jdd||�y)zaChange the priority of tag TAGNAME such that it is higher
        than the priority of ABOVETHIS.rXr�Nru)rNrYr�s   r
rzText.tag_raise�s#��	
������G�G�U�G�W�i�	9rc��|jj|jj|jdd|��S)z7Return a list of ranges of text which have tag TAGNAME.rX�rangesr�)rNrYs  r
�
tag_rangeszText.tag_ranges�s5���w�w� � �������G�G�U�H�g�"/�0�	0rc�X�|jj|jdd|||�y)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.rXr1Nrurls    r
�
tag_removezText.tag_remove�s#��������G�G�U�H�g�v�v�	?rc��|dddk7rd|z}|dddk(r|dd}|jj|jdd||�S)z:Return the value of OPTION of an embedded window at INDEX.Nrr7r�r�rtrrur�s   r
�window_cgetzText.window_cget�sQ���"�1�:����6�\�F��"�#�;�#���C�R�[�F��w�w�|�|�D�G�G�X�v�u�f�E�Erc�.�|jdd|f||�S)z&Configure an embedded window at INDEX.rtrrrCs    r
�window_configurezText.window_configure�s������+�u�=�s�B�G�Grc�|�|jj|jdd|f|j||�z�y)zCreate a window at INDEX.rtrNrPrCs    r
�
window_createzText.window_create�s5��������w�w��(�E�2��
�
�c�2�&�'�	(rc��|jj|jj|jdd��S)z4Return all names of embedded windows in this widget.rtrdr�rMs r
�window_nameszText.window_names�s1���w�w� � ��G�G�L�L����(�G�4�6�	6rc�Z�|jj|jddf|z�y)zObsolete function, use see.r�z
-pickplaceNru)rNr�s  r
�yview_pickplacezText.yview_pickplace�s"�������d�g�g�w��5��<�=rrrn)NNNNNNNNrE);rPrQrRr�r
r1rrtrrZrrrrrr!r#r&rr)r+r-rer=rr6r8r:r>rArDrHrJrrr rr�rZr�r�r_rarc�
tag_configrfrrirmrqrrurwryr{�
window_configr}rr�r!rr
rr2sI��>�"��7�2>�5��(0�8�H�%.�P
4�	*�!�"�
&�	!�<�
E�G�')�*�7�:�?�
?�'�
>�=�D�H�,.�%�I�
G�4�6�04�04�7;�.�(,�=�Q�
'�'�
E�G��J�<�B�
:�
C�C�9�0�
?�
F�H�%�M�')�(�6�
>rrc��eZdZdZdd�Zd�Zy)�_setitz>Internal class. It wraps the command in the widget OptionMenu.Nc�.�||_||_||_yr)�
_setit__value�_setit__var�_setit__callback)rN�varrr$s    r
r
z_setit.__init__�s�������
�"��rc��|jj|j�|j�|j|jg|���yyr)r�rr�r�rys  r
r z_setit.__call__�s<���
�
���t�|�|�$��?�?�&��D�O�O�D�L�L�0�4�0�'rrrzr!rr
r�r��s��H�#�
1rr�c�"�eZdZdZd�Zd�Zd�Zy)�
OptionMenuz?OptionMenu which allows the user to select a value from a menu.c	��d|dtddd�}tj||d|�d|_t	|dd�	�x}|_|j|_|jd
�}d
|vr|d
=|r tdtt|��z��|j|t|||���|D] }	|j|	t||	|����"||d<y
)z�Construct an optionmenu widget with the parent MASTER, with
        the resource textvariable set to VARIABLE, the initially selected
        value VALUE, the other menu values VALUES and an additional
        keyword argument command.r6rr0)�borderwidth�textvariable�indicatoron�reliefr.�highlightthicknessr��
tk_optionMenur�r)r��tearoffr�zunknown option -)rxr�N)�RAISEDr~r
rwr��_OptionMenu__menurv�menunamerr�r@r:r�r�)
rNr�r+rr,�kwargsror�r$r3s
          r
r
zOptionMenu.__init__�s���
���&�C�$%�'��	����f�l�B�7�)���!�$�V�Q�?�?��t�{�����
��:�:�i�(������y�!���-�d�4��<�.@�@�A�A����u���%��:�	�	<��A����1�#�H�a��:�
�
<����V�rc�P�|dk(r|jStj||�S)Nr�)r�r~rurs  r
ruzOptionMenu.__getitem__�s&���6�>��;�;���!�!�$��-�-rc�<�tj|�d|_y)z,Destroy this widget and the associated menu.N)r�r�r�rMs r
r�zOptionMenu.destroy�s�����4� ���rN)rPrQrRr�r
rur�r!rr
r�r��s��I��2.�
rr�c�V�eZdZdZdZdidfd�Zd�Zd�Zd�Zd�Z	d	�Z
e
Zd
�Zd�Z
d�Zy)
�ImagezBase class for images.rNc�r�d|_|�td�}t|d|�|_|s,txj
dz
c_dtj
��}|r|rt
||f�}n|r|}d}|j�D]\}}|d|z|fz}�|jjdd||f|z�||_y)	Nzcreate imager<r�pyimager!r7rcr)	r�r�r�r<r��_last_idr4r-r
)	rN�imgtyper�r/r�ror>r2r3s	         r
r
zImage.__init__s�����	��>�&�~�6�F��&�$��/�����N�N�a��N�"'�.�.�2�D�
�#�Y��R�y�1�s�
�r�����I�I�K�D�A�q���Q���
�*�G� ������g�x��$�8�7�B�C���	rc��|jSr)r�rMs r
rOz
Image.__str__s��d�i�i�'rc��|jr)	|jjdd|j�yy#t$rYywxYw)NrcrZ)r�r<r
r�rMs r
rz
Image.__del__s?���9�9�
������W�h��	�	�:����
��
�s�'7�	A�Ac�Z�|jj|jdd|z|�y�Nrr7�r<r
r�rs   r
rzImage.__setitem__s �������T�Y�Y��S��W�e�<rc�V�|jj|jdd|z�Sr�r�rs  r
ruzImage.__getitem__s!���w�w�|�|�D�I�I�{�C��G�<�<rc���d}t|�j�D]\}}|��	|ddk(r|dd}|d|z|fz}�!|jj|jdf|z�y)zConfigure the image.r!Nr�r�r7rt)r4r-r<r
r�)rNror$r2r3s     r
rzImage.configure"sn�����b�M�'�'�)�D�A�q��}��R�5�C�<�Q�s��V���S��U�A�J�&��*�	
�����d�i�i��*�S�0�1rc��|jj|jjdd|j��S)zReturn the height of the image.rcr��r<rQr
r�rMs r
r�zImage.height-s/���w�w�~�~��G�G�L�L��(�D�I�I�6�8�	8rc�P�|jjdd|j�S)z7Return the type of the image, e.g. "photo" or "bitmap".rcr(r�rMs r
r(z
Image.type2s���w�w�|�|�G�V�T�Y�Y�7�7rc��|jj|jjdd|j��S)zReturn the width of the image.rcr�r�rMs r
r�zImage.width6s/���w�w�~�~��G�G�L�L��'�4�9�9�5�7�	7r)rPrQrRr�r�r
rOrrrurrtr�r(r�r!rr
r�r��sE�� ��H�%)�r�$�� (��=�=�2��F�8�
8�7rr�c�h�eZdZdZdidfd�Zd�Zd�Zd�Zd�Zdd�Z	dd	�Z
d
�Zdd�Zdd�Z
d
�Zd�Zy)�
PhotoImagez=Widget which can display images in PGM, PPM, GIF, PNG format.Nc�8�tj|d|||fi|��y)ztCreate an image with NAME.

        Valid resource names: data, format, file, gamma, height, palette,
        width.�photoN�r�r
�rNr�r/r�ros     r
r
zPhotoImage.__init__?s��
	���t�W�d�C��>�2�>rc�P�|jj|jd�y)zDisplay a transparent image.�blankNr�rMs r
r�zPhotoImage.blankFs�������T�Y�Y��(rc�V�|jj|jdd|z�S)zReturn the value of OPTION.rr7r�)rNr�s  r
rzPhotoImage.cgetJs!���w�w�|�|�D�I�I�v�s�V�|�<�<rc�V�|jj|jdd|z�S)Nrr7r�rs  r
ruzPhotoImage.__getitem__Os!���w�w�|�|�D�I�I�v�s�S�y�9�9rc��t|j��}|jj|d|j�|S)z;Return a new PhotoImage with the same image as this widget.r��copy�r�r<r
r�)rN�	destImages  r
r�zPhotoImage.copySs.���d�g�g�.�	������Y���	�	�2��rc��t|j��}|dk(r|}|jj|d|jd||�|S)z�Return a new PhotoImage with the same image as this widget
        but zoom it with a factor of x in the X direction and y in the Y
        direction.  If y is not given, the default value is the same as x.
        r�r�r�z-zoomr��rNr�r�r�s    r
�zoomzPhotoImage.zoomYsA��
�d�g�g�.�	��b�5�A�!������Y���	�	�7�1�Q�?��rc��t|j��}|dk(r|}|jj|d|jd||�|S)z�Return a new PhotoImage based on the same image as this widget
        but use only every Xth or Yth pixel.  If y is not given, the
        default value is the same as x.
        r�r�r�z
-subsampler�r�s    r
�	subsamplezPhotoImage.subsamplecsA��
�d�g�g�.�	��b�5�A�!������Y���	�	�<��!�D��rc�R�|jj|jd||�S)z8Return the color (red, green, blue) of the pixel at X,Y.rr�rGs   r
rzPhotoImage.getms���w�w�|�|�D�I�I�u�a��3�3rc��|jd|f}|r|ddk(r|dd}|dzt|�z}|jj|�y)zzPut row formatted colors to image starting from
        position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))�putr�-torN)r��r�rr<r
)rNr�r/rns    r
r�zPhotoImage.putqsO���	�	�5�$�'��
��!�u��~����V���(�?�U�2�Y�.�D������T�rc��|jd|f}|r|d|fz}|r|dzt|�z}|jj|�y)zRWrite image to file FILENAME in FORMAT starting from
        position FROM_COORDS.�writez-format)z-fromNr�)rN�filename�format�from_coordsrns     r
r�zPhotoImage.write|sM���	�	�7�H�-����9�f�-�-�D���*�$�u�[�'9�9�D������T�rc	��|jj|jj|jdd||��S)z/Return True if the pixel at x,y is transparent.�transparencyr)r<r	r
r�rGs   r
�transparency_getzPhotoImage.transparency_get�s7���w�w�!�!�$�'�'�,�,��I�I�~�u�a��#4�5�	5rc�X�|jj|jdd|||�y)z)Set the transparency of the pixel at x,y.r�rNr�)rNr�r�rgs    r
�transparency_setzPhotoImage.transparency_set�s �������T�Y�Y���q�!�W�Err�rrn)rPrQrRr�r
r�rrur�r�r�rr�r�r�r�r!rr
r�r�<sI��G� �b��?�)�=�
:����4���5�
Frr�c��eZdZdZdidfd�Zy)�BitmapImagez.Widget which can display images in XBM format.Nc�8�tj|d|||fi|��y)zqCreate a bitmap with NAME.

        Valid resource names: background, data, file, foreground, maskdata, maskfile.r�Nr�r�s     r
r
zBitmapImage.__init__�s��	���t�X�t�S�&�?�B�?rr�r!rr
r�r��s��8� �b��@rr�c�n�td�j}|j|jdd��S)Nzuse image_names()rcrd�r�r<r8r
�r<s r
rere��-��	�.�	/�	2�	2�B�
�<�<������1�2�2rc�n�td�j}|j|jdd��S)Nzuse image_types()rcrhr�r�s r
riri�r�rc��eZdZdZdifd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zy)�Spinboxzspinbox widget.Nc�6�tj||d||�y)a�Construct a spinbox widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, background, borderwidth,
            cursor, exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, justify, relief,
            repeatdelay, repeatinterval,
            selectbackground, selectborderwidth
            selectforeground, takefocus, textvariable
            xscrollcommand.

        WIDGET-SPECIFIC OPTIONS

            buttonbackground, buttoncursor,
            buttondownrelief, buttonuprelief,
            command, disabledbackground,
            disabledforeground, format, from,
            invalidcommand, increment,
            readonlybackground, state, to,
            validate, validatecommand values,
            width, wrap,
        �spinboxNr�r�s    r
r
zSpinbox.__init__�s��6	����f�i��b�9rc�v�|j|jj|jd|��xsdS)a�Return a tuple of X1,Y1,X2,Y2 coordinates for a
        rectangle which encloses the character given by index.

        The first two elements of the list give the x and y
        coordinates of the upper-left corner of the screen
        area covered by the character (in pixels relative
        to the widget) and the last two elements give the
        width and height of the character, in pixels. The
        bounding box may refer to a region outside the
        visible area of the window.
        r1NrErWs  r
r1zSpinbox.bbox�s-���}�}�T�W�W�\�\�$�'�'�6�5�A�B�J�d�Jrc�R�|jj|jd||�S)aWDelete one or more elements of the spinbox.

        First is the index of the first character to delete,
        and last is the index of the character just after
        the last one to delete. If last isn't specified it
        defaults to first+1, i.e. a single character is
        deleted.  This command returns an empty string.
        rZrurPs   r
rZzSpinbox.delete�s!���w�w�|�|�D�G�G�X�u�d�;�;rc�N�|jj|jd�S)zReturns the spinbox's stringrrurMs r
rzSpinbox.get�rUrc�P�|jj|jd|�S)z�Alter the position of the insertion cursor.

        The insertion cursor will be displayed just before
        the character given by index. Returns an empty string
        rrurWs  r
rzSpinbox.icursor�s���w�w�|�|�D�G�G�Y��6�6rc�R�|jj|jd||�S)z{Returns the name of the widget at position x, y

        Return value is one of: none, buttondown, buttonup, entry
        r�rurGs   r
r�zSpinbox.identify�s!��
�w�w�|�|�D�G�G�Z��A�6�6rc�P�|jj|jd|�S)z;Returns the numerical index corresponding to index
        r=rurWs  r
r=z
Spinbox.index�s���w�w�|�|�D�G�G�W�e�4�4rc�R�|jj|jd||�S)zDInsert string s at index

         Returns an empty string.
        rru)rNr=r�s   r
rzSpinbox.insert�s!��
�w�w�|�|�D�G�G�X�u�a�8�8rc�P�|jj|jd|�S)z�Causes the specified element to be invoked

        The element could be buttondown or buttonup
        triggering the action associated with it.
        r�ru�rN�elements  r
r�zSpinbox.invoke�s���w�w�|�|�D�G�G�X�w�7�7rc�|�|j|jj|jdf|z��xsdS)rrr!rErys  r
rzSpinbox.scanr�rc�&�|jd|�S)z�Records x and the current view in the spinbox window;

        used in conjunction with later scan dragto commands.
        Typically this command is associated with a mouse button
        press in the widget. It returns an empty string.
        r�rr>s  r
rzSpinbox.scan_mark	s���y�y���#�#rc�&�|jd|�S)a�Compute the difference between the given x argument
        and the x argument to the last scan mark command

        It then adjusts the view left or right by 10 times the
        difference in x-coordinates. This command is typically
        associated with mouse motion events in the widget, to
        produce the effect of dragging the spinbox at high speed
        through the window. The return value is an empty string.
        rr�r>s  r
r zSpinbox.scan_dragtos���y�y��1�%�%rc�|�|j|jj|jdf|z��xsdS)rr�r!rErys  r
r�zSpinbox.selections9���}�}��G�G�L�L�$�'�'�;�/�$�6�7�9�?�<>�	?rc�&�|jd|�S)a�Locate the end of the selection nearest to the character
        given by index,

        Then adjust that end of the selection to be at index
        (i.e including but not going beyond index). The other
        end of the selection is made the anchor point for future
        select to commands. If the selection isn't currently in
        the spinbox, then a new selection is created to include
        the characters between index and the most recent selection
        anchor point, inclusive.
        r#�r�rWs  r
r]zSpinbox.selection_adjust#s���~�~�h��.�.rc�$�|jd�S)zsClear the selection

        If the selection isn't in this widget then the
        command has no effect.
        r�r�rMs r
r�zSpinbox.selection_clear1s���~�~�g�&�&rc�R�|jj|jdd|�S)z�Sets or gets the currently selected element.

        If a spinbutton element is specified, it will be
        displayed depressed.
        r�r�rur�s  r
�selection_elementzSpinbox.selection_element9s!���w�w�|�|�D�G�G�[�)�W�E�Erc�(�|jd|�y)rar*Nr�rWs  r
rbzSpinbox.selection_fromAs�����v�u�%rc��|jj|jj|jdd��S)zUReturn True if there are characters selected in the spinbox, False
        otherwise.r�rdrrMs r
rezSpinbox.selection_presentErfrc�*�|jd||�y)rhriNr�rjs   r
rlzSpinbox.selection_rangeKs�����w��s�+rc�(�|jd|�y)rnr/Nr�rWs  r
rozSpinbox.selection_toOs�����t�U�#rr)rPrQrRr�r
r1rZrrr�r=rr�rrr r�r]r�r�rbrerlror!rr
r�r��sp���"��:�:K�	<�,�7�7�5�
9�8�:�
$�
&�?�
/�'�F�&�;�,�$rr�c��eZdZdZdifd�Zy)�
LabelFramezlabelframe widget.Nc�6�tj||d||�y)a�Construct a labelframe widget with the parent MASTER.

        STANDARD OPTIONS

            borderwidth, cursor, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, padx, pady, relief,
            takefocus, text

        WIDGET-SPECIFIC OPTIONS

            background, class, colormap, container,
            height, labelanchor, labelwidget,
            visual, width
        �
labelframeNr�r�s    r
r
zLabelFrame.__init__Ys�� 	����f�l�C��<rr�r!rr
r�r�Vs���"��=rr�c�z�eZdZdZdifd�Zd�Zd�ZeZd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�ZeZd�Zy)�PanedWindowzpanedwindow widget.Nc�6�tj||d||�y)aTConstruct a panedwindow widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor, height,
            orient, relief, width

        WIDGET-SPECIFIC OPTIONS

            handlepad, handlesize, opaqueresize,
            sashcursor, sashpad, sashrelief,
            sashwidth, showhandle,
        �panedwindowNr�r�s    r
r
zPanedWindow.__init__qs��	����f�m�S�"�=rc�x�|jj|jd|f|j|�z�y)a+Add a child widget to the panedwindow in a new pane.

        The child argument is the name of the child widget
        followed by pairs of arguments that specify how to
        manage the windows. The possible options and values
        are the ones accepted by the paneconfigure method.
        r*NrP)rNrros   r
r*zPanedWindow.add�s-��	
�����d�g�g�u�e�,�t�}�}�R�/@�@�Arc�R�|jj|jd|�y)z�Remove the pane containing child from the panedwindow

        All geometry management options for child will be forgotten.
        r�Nru)rNrs  r
r1zPanedWindow.remove�s��
	
�����T�W�W�h��.rc�R�|jj|jd||�S)a�Identify the panedwindow component at point x, y

        If the point is over a sash or a sash handle, the result
        is a two element list containing the index of the sash or
        handle, and a word indicating whether it is over a sash
        or a handle, such as {0 sash} or {2 handle}. If the point
        is over any other part of the panedwindow, the result is
        an empty list.
        r�rurGs   r
r�zPanedWindow.identify�s!���w�w�|�|�D�G�G�Z��A�6�6rc�|�|j|jj|jdf|z��xsdS)r�proxyr!rErys  r
r�zPanedWindow.proxy�s9���}�}��G�G�L�L�$�'�'�7�+�d�2�3�5�;�8:�	;rc�$�|jd�S)zBReturn the x and y pair of the most recent proxy location
        �coord�r�rMs r
�proxy_coordzPanedWindow.proxy_coord�s���z�z�'�"�"rc�$�|jd�S)z+Remove the proxy from the display.
        r�rrMs r
�proxy_forgetzPanedWindow.proxy_forget�s���z�z�(�#�#rc�(�|jd||�S)z:Place the proxy at the given x and y coordinates.
        r*rrGs   r
�proxy_placezPanedWindow.proxy_place�s���z�z�'�1�a�(�(rc�|�|j|jj|jdf|z��xsdS)r�sashr!rErys  r
r	zPanedWindow.sash�r�rc�&�|jd|�S)aAReturn the current x and y pair for the sash given by index.

        Index must be an integer between 0 and 1 less than the
        number of panes in the panedwindow. The coordinates given are
        those of the top left corner of the region containing the sash.
        pathName sash dragto index x y This command computes the
        difference between the given coordinates and the coordinates
        given to the last sash coord command for the given sash. It then
        moves that sash the computed difference. The return value is the
        empty string.
        r�r	rWs  r
�
sash_coordzPanedWindow.sash_coord�s���y�y��%�(�(rc�&�|jd|�S)zRecords x and y for the sash given by index;

        Used in conjunction with later dragto commands to move the sash.
        rrrWs  r
�	sash_markzPanedWindow.sash_mark�s��
�y�y���'�'rc�*�|jd|||�S)z?Place the sash given by index at the given coordinates
        r*r)rNr=r�r�s    r
�
sash_placezPanedWindow.sash_place�s���y�y��%��A�.�.rc�`�|jj|jdf|d|zfz�S)zwQuery a management option for window.

        Option may be any value allowed by the paneconfigure subcommand
        �panecgetr7ru)rNrr�s   r
rzPanedWindow.panecget�s3��
�w�w�|�|�
�W�W�j�!�U�C��J�$7�7�9�	9rc�"�|�|s|j|jd|�St|t�r#|s!|j	|jd|d|z�S|j
j
|jd|f|j||�z�y)a�
Query or modify the management options for window.

        If no option is specified, returns a list describing all
        of the available options for pathName.  If option is
        specified with no value, then the command returns a list
        describing the one named option (this list will be identical
        to the corresponding sublist of the value returned if no
        option is specified). If one or more option-value pairs are
        specified, then the command modifies the given widget
        option(s) to have the given value(s); in this case the
        command returns an empty string. The following options
        are supported:

        after window
            Insert the window after the window specified. window
            should be the name of a window already managed by pathName.
        before window
            Insert the window before the window specified. window
            should be the name of a window already managed by pathName.
        height size
            Specify a height for the window. The height will be the
            outer dimension of the window including its border, if
            any. If size is an empty string, or if -height is not
            specified, then the height requested internally by the
            window will be used initially; the height may later be
            adjusted by the movement of sashes in the panedwindow.
            Size may be any value accepted by Tk_GetPixels.
        minsize n
            Specifies that the size of the window cannot be made
            less than n. This constraint only affects the size of
            the widget in the paned dimension -- the x dimension
            for horizontal panedwindows, the y dimension for
            vertical panedwindows. May be any value accepted by
            Tk_GetPixels.
        padx n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the X-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        pady n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the Y-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        sticky style
            If a window's pane is larger than the requested
            dimensions of the window, this option may be used
            to position (or stretch) the window within its pane.
            Style is a string that contains zero or more of the
            characters n, s, e or w. The string can optionally
            contains spaces or commas, but they are ignored. Each
            letter refers to a side (north, south, east, or west)
            that the window will "stick" to. If both n and s
            (or e and w) are specified, the window will be
            stretched to fill the entire height (or width) of
            its cavity.
        width size
            Specify a width for the window. The width will be
            the outer dimension of the window including its
            border, if any. If size is an empty string, or
            if -width is not specified, then the width requested
            internally by the window will be used initially; the
            width may later be adjusted by the movement of sashes
            in the panedwindow. Size may be any value accepted by
            Tk_GetPixels.

        N�
paneconfigurer7)rrvrrr
r<r
r�r
s    r
rzPanedWindow.paneconfigure�s���H�;�r��%�%�d�g�g���H�H��c�3����&�&�����'�3�s�7�<�
<������d�g�g���8����s�B�'�(�	)rc��|jj|jj|jd��S)z+Returns an ordered list of the child panes.�panesr�rMs r
rzPanedWindow.panes)s*���w�w� � ������d�g�g�w�!?�@�@rr)rPrQrRr�r
r*r1r�r�r�rrrr	rrrrr�
paneconfigrr!rr
r�r�nsg���"��>� B�/��F�
7�;�
#�
$�
)�
:�
)�(�/�
9�J)�X�J�Arr�c��t�}d|jd�z}|dz
}t||��}|j�t	|d|fd���}|j�||_t	|d|j��}|j�|j�|j�|j�|j�y)	NzThis is Tcl/Tk %s�
tk_patchLevelu
This should be a cedilla: ç�r�z	Click me!c�Z�|jjd|jdz��S)Nz[%s]r�r)�testrr�s r
�<lambda>z_test.<locals>.<lambda>7s)���	�	�(;�(;���	�	�&� 1�1�)<�)3r)r�r��QUIT)r�rrvrr�rr�r�r)r�r^)r�r�rxrr�s     r
�_testr0s���
�4�D���!2�!2�?�!C�C�D��.�.�D��$�T�"�E�	�J�J�L��$�[�"&�3�4�D�	�I�I�K��D�I��$�V�T�\�\�:�D��I�I�K�	�L�L�N��K�K�M��N�N���M�M�Orr�>r�__main__)TNrrk)NNr�F)gr��collections�enumr�rhr8r��tkinter.constantsrXrr�floatr)�	TkVersionr*�
TclVersion�READABLE�WRITABLE�	EXCEPTION�compiler�ASCIIrrr
r"r*r4rB�
namedtuplerDr^�_simple_enum�StrEnumr`r�r�r�r�r�r�r�r�r�rr�rGrNrTrXr^r[rQrRr	rarr|r�r�r�rArrLrNr]rfrpr~r�r�r�r:r5rLrsrvrzr�r�r�r�r�r�rr�r�r�r�r�rerir�r�r�r�globalsr-r�r�
ModuleType�__all__rP)r��objs00r
�<module>r3s@���@��
��������	���	���(�%�%�&�	�
�8�'�'�
(�
������������	�
�B�J�J�{�#�	��B�J�J�y�"�(�(�+�	�,�
�8��!�!�X��$�#�#�Y��.S�-�{�-�-�.@�=�?�S�G�����4�<�<� �'�'�!�'�TO
�O
�d���
��	��"�	�
���q+�q+�h���02�X�2�2E��E�*A��A�<:�


���	�=�A�A�D(,�,�,?�?�*?�?�*m�m�`	p&��r�p&�f!$�
�
��,6�+,�+,�\0.�0.�f4,�4,�n>4��>4�B	�Z��u�d�	�8�z�2�8�<,/�V�,/�^q>�V�U�E�q>�h	��.(�&�.(�bS�F�E�S�l?�F�?�(8�F�8�0q�f�e�U�q�h~*�6�~*�B=��=�:�f�:�(�&�(�B$7�F�$7�N/2��/2�dT>�6�5�%�T>�n1�1�$��$�N;7�;7�|QF��QF�h@�%�@�3�
3�
m$�f�e�m$�d=��=�0}A�&�}A�D�*")����!2�,�!2�I�D�#��/�/�#�&�z�#�u�?O�?O�/P��?�*��!2�,���z��	�G���EO��t���,��t���PN,s*�0M2�?M>�,4N
�2M;�:M;�>N�N__pycache__/__main__.cpython-312.opt-1.pyc000064400000000650151710635150014143 0ustar00�

T��h����dZddlZejdjd�rdejd<ddlmZe�y)zMain entry point�Nz__main__.pyzpython -m tkinter�)�_test)�__doc__�sys�argv�endswith�r�main���)/usr/lib64/python3.12/tkinter/__main__.py�<module>rs6���
��8�8�A�;���
�&�%�C�H�H�Q�K���r__pycache__/__main__.cpython-312.opt-2.pyc000064400000000613151710635150014143 0ustar00�

T��h����	ddlZejdjd�rdejd<ddlmZe�y)�Nz__main__.pyzpython -m tkinter�)�_test)�sys�argv�endswith�r�main���)/usr/lib64/python3.12/tkinter/__main__.py�<module>r
s6���
��8�8�A�;���
�&�%�C�H�H�Q�K���r__pycache__/__main__.cpython-312.pyc000064400000000650151710635150013204 0ustar00�

T��h����dZddlZejdjd�rdejd<ddlmZe�y)zMain entry point�Nz__main__.pyzpython -m tkinter�)�_test)�__doc__�sys�argv�endswith�r�main���)/usr/lib64/python3.12/tkinter/__main__.py�<module>rs6���
��8�8�A�;���
�&�%�C�H�H�Q�K���r__pycache__/colorchooser.cpython-312.opt-1.pyc000064400000005306151710635150015127 0ustar00�

T��hd
��^�ddlmZddgZGd�de�Zd	d�Zedk(rede��yy)
�)�Dialog�Chooser�askcolorc� �eZdZdZdZd�Zd�Zy)ra�Create a dialog for the tk_chooseColor command.

    Args:
        master: The master widget for this dialog.  If not provided,
            defaults to options['parent'] (if defined).
        options: Dictionary of options for the tk_chooseColor call.
            initialcolor: Specifies the selected color when the
                dialog is first displayed.  This can be a tk color
                string or a 3-tuple of ints in the range (0, 255)
                for an RGB triplet.
            parent: The parent window of the color dialog.  The
                color dialog is displayed on top of this.
            title: A string for the title of the dialog box.
    �tk_chooseColorc��	|jd}t|t�rd|z|jd<yy#t$rYywxYw)zvEnsure initialcolor is a tk color string.

        Convert initialcolor from a RGB triplet to a color string.
        �initialcolorz
#%02x%02x%02xN)�options�
isinstance�tuple�KeyError)�self�colors  �-/usr/lib64/python3.12/tkinter/colorchooser.py�_fixoptionszChooser._fixoptions#sK��
	��L�L��0�E��%��'�/>��/F����^�,�(���	��	�s�15�	A�Ac�z�|rt|�sy|j|�\}}}|dz|dz|dzft|�fS)z�Adjust result returned from call to tk_chooseColor.

        Return both an RGB tuple of ints in the range (0, 255) and the
        tk color string in the form #rrggbb.
        )NN�)�str�	winfo_rgb)r�widget�result�r�g�bs      r�
_fixresultzChooser._fixresult0sJ���S��[���"�"�6�*���1�a��3���3���3��'��V��4�4�N)�__name__�
__module__�__qualname__�__doc__�commandrr�rrrrs��
��G��5rNc�b�|r|j�}||d<tdi|��j�S)z�Display dialog window for selection of a color.

    Convenience wrapper for the Chooser class.  Displays the color
    chooser dialog with color as the initial value.
    r	r")�copyr�show)rr
s  rrrDs3��
��,�,�.��"'������W��"�"�$�$r�__main__r)N)�tkinter.commondialogr�__all__rrr�printr"rr�<module>r*sA��(��j�
!��-5�f�-5�f%�"�z��	�'�8�:��r__pycache__/colorchooser.cpython-312.opt-2.pyc000064400000003124151710635150015124 0ustar00�

T��hd
��^�ddlmZddgZGd�de�Zd	d�Zedk(rede��yy)
�)�Dialog�Chooser�askcolorc��eZdZ	dZd�Zd�Zy)r�tk_chooseColorc��		|jd}t|t�rd|z|jd<yy#t$rYywxYw)N�initialcolorz
#%02x%02x%02x)�options�
isinstance�tuple�KeyError)�self�colors  �-/usr/lib64/python3.12/tkinter/colorchooser.py�_fixoptionszChooser._fixoptions#sP��	�	��L�L��0�E��%��'�/>��/F����^�,�(���	��	�s�16�	A�Ac�|�	|rt|�sy|j|�\}}}|dz|dz|dzft|�fS)N)NN�)�str�	winfo_rgb)r�widget�result�r�g�bs      r�
_fixresultzChooser._fixresult0sO��	��S��[���"�"�6�*���1�a��3���3���3��'��V��4�4�N)�__name__�
__module__�__qualname__�commandrr�rrrrs��
��G��5rNc�d�	|r|j�}||d<tdi|��j�S)Nr	r!)�copyr�show)rr
s  rrrDs8���
��,�,�.��"'������W��"�"�$�$r�__main__r)N)�tkinter.commondialogr�__all__rrr�printr!rr�<module>r)sA��(��j�
!��-5�f�-5�f%�"�z��	�'�8�:��r__pycache__/colorchooser.cpython-312.pyc000064400000005306151710635150014170 0ustar00�

T��hd
��^�ddlmZddgZGd�de�Zd	d�Zedk(rede��yy)
�)�Dialog�Chooser�askcolorc� �eZdZdZdZd�Zd�Zy)ra�Create a dialog for the tk_chooseColor command.

    Args:
        master: The master widget for this dialog.  If not provided,
            defaults to options['parent'] (if defined).
        options: Dictionary of options for the tk_chooseColor call.
            initialcolor: Specifies the selected color when the
                dialog is first displayed.  This can be a tk color
                string or a 3-tuple of ints in the range (0, 255)
                for an RGB triplet.
            parent: The parent window of the color dialog.  The
                color dialog is displayed on top of this.
            title: A string for the title of the dialog box.
    �tk_chooseColorc��	|jd}t|t�rd|z|jd<yy#t$rYywxYw)zvEnsure initialcolor is a tk color string.

        Convert initialcolor from a RGB triplet to a color string.
        �initialcolorz
#%02x%02x%02xN)�options�
isinstance�tuple�KeyError)�self�colors  �-/usr/lib64/python3.12/tkinter/colorchooser.py�_fixoptionszChooser._fixoptions#sK��
	��L�L��0�E��%��'�/>��/F����^�,�(���	��	�s�15�	A�Ac�z�|rt|�sy|j|�\}}}|dz|dz|dzft|�fS)z�Adjust result returned from call to tk_chooseColor.

        Return both an RGB tuple of ints in the range (0, 255) and the
        tk color string in the form #rrggbb.
        )NN�)�str�	winfo_rgb)r�widget�result�r�g�bs      r�
_fixresultzChooser._fixresult0sJ���S��[���"�"�6�*���1�a��3���3���3��'��V��4�4�N)�__name__�
__module__�__qualname__�__doc__�commandrr�rrrrs��
��G��5rNc�b�|r|j�}||d<tdi|��j�S)z�Display dialog window for selection of a color.

    Convenience wrapper for the Chooser class.  Displays the color
    chooser dialog with color as the initial value.
    r	r")�copyr�show)rr
s  rrrDs3��
��,�,�.��"'������W��"�"�$�$r�__main__r)N)�tkinter.commondialogr�__all__rrr�printr"rr�<module>r*sA��(��j�
!��-5�f�-5�f%�"�z��	�'�8�:��r__pycache__/commondialog.cpython-312.opt-1.pyc000064400000003543151710635150015077 0ustar00�

T��h	��.�dgZddlmZmZGd�d�Zy)�Dialog�)�_get_temp_root�_destroy_temp_rootc�0�eZdZdZdd�Zd�Zd�Zd�Zd�Zy)rNc�F�|�|jd�}||_||_y)N�parent)�get�master�options)�selfr
rs   �-/usr/lib64/python3.12/tkinter/commondialog.py�__init__zDialog.__init__s#���>��[�[��*�F�������c��y�N�)rs r
�_fixoptionszDialog._fixoptions���rc��|Srr)r�widget�results   r
�
_fixresultzDialog._fixresults���
rc��|j�D]\}}||j|<�|j�|j}|�
t	�}	|j|�|jj|jg|j|j����}|j||�}t|�|S#t|�wxYwr)�itemsrrr
r�_test_callback�tk�call�command�_optionsrr)rr�k�vr
�ss      r
�showzDialog.show s����M�M�O�D�A�q��D�L�L��O�$�	
���������>�#�%�F�	'�����'���	�	���t�|�|�L�f�o�o�d�l�l�.K�L�A������*�A��v�&����
�v�&�s
�A#C�
Cc��yrr)rr
s  r
rzDialog._test_callback4rrr)	�__name__�
__module__�__qualname__rrrrr#rrrr
rrs ���G��
���(
rN)�__all__�tkinterrrrrrr
�<module>r*s���*��6�%
�%
r__pycache__/commondialog.cpython-312.opt-2.pyc000064400000003543151710635150015100 0ustar00�

T��h	��.�dgZddlmZmZGd�d�Zy)�Dialog�)�_get_temp_root�_destroy_temp_rootc�0�eZdZdZdd�Zd�Zd�Zd�Zd�Zy)rNc�F�|�|jd�}||_||_y)N�parent)�get�master�options)�selfr
rs   �-/usr/lib64/python3.12/tkinter/commondialog.py�__init__zDialog.__init__s#���>��[�[��*�F�������c��y�N�)rs r
�_fixoptionszDialog._fixoptions���rc��|Srr)r�widget�results   r
�
_fixresultzDialog._fixresults���
rc��|j�D]\}}||j|<�|j�|j}|�
t	�}	|j|�|jj|jg|j|j����}|j||�}t|�|S#t|�wxYwr)�itemsrrr
r�_test_callback�tk�call�command�_optionsrr)rr�k�vr
�ss      r
�showzDialog.show s����M�M�O�D�A�q��D�L�L��O�$�	
���������>�#�%�F�	'�����'���	�	���t�|�|�L�f�o�o�d�l�l�.K�L�A������*�A��v�&����
�v�&�s
�A#C�
Cc��yrr)rr
s  r
rzDialog._test_callback4rrr)	�__name__�
__module__�__qualname__rrrrr#rrrr
rrs ���G��
���(
rN)�__all__�tkinterrrrrrr
�<module>r*s���*��6�%
�%
r__pycache__/commondialog.cpython-312.pyc000064400000003543151710635150014140 0ustar00�

T��h	��.�dgZddlmZmZGd�d�Zy)�Dialog�)�_get_temp_root�_destroy_temp_rootc�0�eZdZdZdd�Zd�Zd�Zd�Zd�Zy)rNc�F�|�|jd�}||_||_y)N�parent)�get�master�options)�selfr
rs   �-/usr/lib64/python3.12/tkinter/commondialog.py�__init__zDialog.__init__s#���>��[�[��*�F�������c��y�N�)rs r
�_fixoptionszDialog._fixoptions���rc��|Srr)r�widget�results   r
�
_fixresultzDialog._fixresults���
rc��|j�D]\}}||j|<�|j�|j}|�
t	�}	|j|�|jj|jg|j|j����}|j||�}t|�|S#t|�wxYwr)�itemsrrr
r�_test_callback�tk�call�command�_optionsrr)rr�k�vr
�ss      r
�showzDialog.show s����M�M�O�D�A�q��D�L�L��O�$�	
���������>�#�%�F�	'�����'���	�	���t�|�|�L�f�o�o�d�l�l�.K�L�A������*�A��v�&����
�v�&�s
�A#C�
Cc��yrr)rr
s  r
rzDialog._test_callback4rrr)	�__name__�
__module__�__qualname__rrrrr#rrrr
rrs ���G��
���(
rN)�__all__�tkinterrrrrrr
�<module>r*s���*��6�%
�%
r__pycache__/constants.cpython-312.opt-1.pyc000064400000003616151710635150014444 0ustar00�

T��h���8�dxZxZZdxZxZZdZdZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKdHZLyI)J���n�s�w�e�nw�sw�ne�se�ns�ew�nsew�center�none�x�y�both�left�top�right�bottom�raised�sunken�flat�ridge�groove�solid�
horizontal�vertical�numeric�char�word�baseline�inside�outside�selz	sel.firstzsel.last�end�insert�current�anchor�all�normal�disabled�active�hidden�cascade�checkbutton�command�radiobutton�	separator�single�browse�multiple�extended�dotbox�	underline�pieslice�chord�arc�first�last�butt�
projecting�round�bevel�miter�moveto�scroll�units�pagesN)M�NO�FALSE�OFF�YES�TRUE�ON�N�S�W�E�NW�SW�NE�SE�NS�EW�NSEW�CENTER�NONE�X�Y�BOTH�LEFT�TOP�RIGHT�BOTTOM�RAISED�SUNKEN�FLAT�RIDGE�GROOVE�SOLID�
HORIZONTAL�VERTICAL�NUMERIC�CHAR�WORD�BASELINE�INSIDE�OUTSIDE�SEL�	SEL_FIRST�SEL_LAST�END�INSERT�CURRENT�ANCHOR�ALL�NORMAL�DISABLED�ACTIVE�HIDDEN�CASCADE�CHECKBUTTON�COMMAND�RADIOBUTTON�	SEPARATOR�SINGLE�BROWSE�MULTIPLE�EXTENDED�DOTBOX�	UNDERLINE�PIESLICE�CHORD�ARC�FIRST�LAST�BUTT�
PROJECTING�ROUND�BEVEL�MITER�MOVETO�SCROLL�UNITS�PAGES���*/usr/lib64/python3.12/tkinter/constants.py�<module>r�s�������5��
�
��
�D������������������������������������	��
����������
�������
�	��	������
������
��
�	�	��	��������	����	������	��������
�	�����	��	����
�	�
��
��	��
�������
�
��
��
������
��
�r�__pycache__/constants.cpython-312.opt-2.pyc000064400000003616151710635150014445 0ustar00�

T��h���8�dxZxZZdxZxZZdZdZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKdHZLyI)J���n�s�w�e�nw�sw�ne�se�ns�ew�nsew�center�none�x�y�both�left�top�right�bottom�raised�sunken�flat�ridge�groove�solid�
horizontal�vertical�numeric�char�word�baseline�inside�outside�selz	sel.firstzsel.last�end�insert�current�anchor�all�normal�disabled�active�hidden�cascade�checkbutton�command�radiobutton�	separator�single�browse�multiple�extended�dotbox�	underline�pieslice�chord�arc�first�last�butt�
projecting�round�bevel�miter�moveto�scroll�units�pagesN)M�NO�FALSE�OFF�YES�TRUE�ON�N�S�W�E�NW�SW�NE�SE�NS�EW�NSEW�CENTER�NONE�X�Y�BOTH�LEFT�TOP�RIGHT�BOTTOM�RAISED�SUNKEN�FLAT�RIDGE�GROOVE�SOLID�
HORIZONTAL�VERTICAL�NUMERIC�CHAR�WORD�BASELINE�INSIDE�OUTSIDE�SEL�	SEL_FIRST�SEL_LAST�END�INSERT�CURRENT�ANCHOR�ALL�NORMAL�DISABLED�ACTIVE�HIDDEN�CASCADE�CHECKBUTTON�COMMAND�RADIOBUTTON�	SEPARATOR�SINGLE�BROWSE�MULTIPLE�EXTENDED�DOTBOX�	UNDERLINE�PIESLICE�CHORD�ARC�FIRST�LAST�BUTT�
PROJECTING�ROUND�BEVEL�MITER�MOVETO�SCROLL�UNITS�PAGES���*/usr/lib64/python3.12/tkinter/constants.py�<module>r�s�������5��
�
��
�D������������������������������������	��
����������
�������
�	��	������
������
��
�	�	��	��������	����	������	��������
�	�����	��	����
�	�
��
��	��
�������
�
��
��
������
��
�r�__pycache__/constants.cpython-312.pyc000064400000003616151710635150013505 0ustar00�

T��h���8�dxZxZZdxZxZZdZdZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKdHZLyI)J���n�s�w�e�nw�sw�ne�se�ns�ew�nsew�center�none�x�y�both�left�top�right�bottom�raised�sunken�flat�ridge�groove�solid�
horizontal�vertical�numeric�char�word�baseline�inside�outside�selz	sel.firstzsel.last�end�insert�current�anchor�all�normal�disabled�active�hidden�cascade�checkbutton�command�radiobutton�	separator�single�browse�multiple�extended�dotbox�	underline�pieslice�chord�arc�first�last�butt�
projecting�round�bevel�miter�moveto�scroll�units�pagesN)M�NO�FALSE�OFF�YES�TRUE�ON�N�S�W�E�NW�SW�NE�SE�NS�EW�NSEW�CENTER�NONE�X�Y�BOTH�LEFT�TOP�RIGHT�BOTTOM�RAISED�SUNKEN�FLAT�RIDGE�GROOVE�SOLID�
HORIZONTAL�VERTICAL�NUMERIC�CHAR�WORD�BASELINE�INSIDE�OUTSIDE�SEL�	SEL_FIRST�SEL_LAST�END�INSERT�CURRENT�ANCHOR�ALL�NORMAL�DISABLED�ACTIVE�HIDDEN�CASCADE�CHECKBUTTON�COMMAND�RADIOBUTTON�	SEPARATOR�SINGLE�BROWSE�MULTIPLE�EXTENDED�DOTBOX�	UNDERLINE�PIESLICE�CHORD�ARC�FIRST�LAST�BUTT�
PROJECTING�ROUND�BEVEL�MITER�MOVETO�SCROLL�UNITS�PAGES���*/usr/lib64/python3.12/tkinter/constants.py�<module>r�s�������5��
�
��
�D������������������������������������	��
����������
�������
�	��	������
������
��
�	�	��	��������	����	������	��������
�	�����	��	����
�	�
��
��	��
�������
�
��
��
������
��
�r�__pycache__/dialog.cpython-312.opt-1.pyc000064400000004102151710635150013656 0ustar00�

T��h��	���ddlmZmZmZmZmZdgZdZGd�de�Zd�Z	e
dk(r9eddd	d
e	eii�Zedddd
ejeii�Z
ej�yy)�)�	_cnfmerge�Widget�TclError�Button�Pack�Dialog�	questheadc��eZdZdifd�Zd�Zy)rNc�J�t||f�}d|_|j||�|jj	|jj
d|j|d|d|d|dg|d����|_tj|�y#t$rYywxYw)N�
__dialog__�	tk_dialog�title�text�bitmap�default�strings)r�
widgetName�_setup�tk�getint�call�_w�numr�destroyr)�self�master�cnf�kws    �'/usr/lib64/python3.12/tkinter/dialog.py�__init__zDialog.__init__s�����b�	�"��&������F�C� ��7�7�>�>�������!�4�7�7��'�l�C��K��(�m�S��^�'��9�~�	'�(����^�^�D�
!������s�B�	B"�!B"c��y)N�)rs rrzDialog.destroys��t�)�__name__�
__module__�__qualname__r rr"r#rrr
s��"���r#c	�Z�tdddtddd��}t|j�y)Nz
File ModifiedzzFile "Python.h" has been modified since the last time it was saved. Do you want to save it before exiting the application.r)z	Save FilezDiscard ChangeszReturn to Editor)rrrrr)r�DIALOG_ICON�printr)�ds r�_testr+s4���t��2�!,�!"�"6�
7�
	8�A�
�!�%�%�Lr#�__main__Nr�Test�command�Quit)�tkinterrrrrr�__all__r(rr+r$�t�quit�q�mainloopr"r#r�<module>r6s���>�=��*�����V��"��z���t�f�f����B� �	!�A�	�t�f�f������B� �	!�A��J�J�L�r#__pycache__/dialog.cpython-312.opt-2.pyc000064400000004102151710635150013657 0ustar00�

T��h��	���ddlmZmZmZmZmZdgZdZGd�de�Zd�Z	e
dk(r9eddd	d
e	eii�Zedddd
ejeii�Z
ej�yy)�)�	_cnfmerge�Widget�TclError�Button�Pack�Dialog�	questheadc��eZdZdifd�Zd�Zy)rNc�J�t||f�}d|_|j||�|jj	|jj
d|j|d|d|d|dg|d����|_tj|�y#t$rYywxYw)N�
__dialog__�	tk_dialog�title�text�bitmap�default�strings)r�
widgetName�_setup�tk�getint�call�_w�numr�destroyr)�self�master�cnf�kws    �'/usr/lib64/python3.12/tkinter/dialog.py�__init__zDialog.__init__s�����b�	�"��&������F�C� ��7�7�>�>�������!�4�7�7��'�l�C��K��(�m�S��^�'��9�~�	'�(����^�^�D�
!������s�B�	B"�!B"c��y)N�)rs rrzDialog.destroys��t�)�__name__�
__module__�__qualname__r rr"r#rrr
s��"���r#c	�Z�tdddtddd��}t|j�y)Nz
File ModifiedzzFile "Python.h" has been modified since the last time it was saved. Do you want to save it before exiting the application.r)z	Save FilezDiscard ChangeszReturn to Editor)rrrrr)r�DIALOG_ICON�printr)�ds r�_testr+s4���t��2�!,�!"�"6�
7�
	8�A�
�!�%�%�Lr#�__main__Nr�Test�command�Quit)�tkinterrrrrr�__all__r(rr+r$�t�quit�q�mainloopr"r#r�<module>r6s���>�=��*�����V��"��z���t�f�f����B� �	!�A�	�t�f�f������B� �	!�A��J�J�L�r#__pycache__/dialog.cpython-312.pyc000064400000004102151710635150012717 0ustar00�

T��h��	���ddlmZmZmZmZmZdgZdZGd�de�Zd�Z	e
dk(r9eddd	d
e	eii�Zedddd
ejeii�Z
ej�yy)�)�	_cnfmerge�Widget�TclError�Button�Pack�Dialog�	questheadc��eZdZdifd�Zd�Zy)rNc�J�t||f�}d|_|j||�|jj	|jj
d|j|d|d|d|dg|d����|_tj|�y#t$rYywxYw)N�
__dialog__�	tk_dialog�title�text�bitmap�default�strings)r�
widgetName�_setup�tk�getint�call�_w�numr�destroyr)�self�master�cnf�kws    �'/usr/lib64/python3.12/tkinter/dialog.py�__init__zDialog.__init__s�����b�	�"��&������F�C� ��7�7�>�>�������!�4�7�7��'�l�C��K��(�m�S��^�'��9�~�	'�(����^�^�D�
!������s�B�	B"�!B"c��y)N�)rs rrzDialog.destroys��t�)�__name__�
__module__�__qualname__r rr"r#rrr
s��"���r#c	�Z�tdddtddd��}t|j�y)Nz
File ModifiedzzFile "Python.h" has been modified since the last time it was saved. Do you want to save it before exiting the application.r)z	Save FilezDiscard ChangeszReturn to Editor)rrrrr)r�DIALOG_ICON�printr)�ds r�_testr+s4���t��2�!,�!"�"6�
7�
	8�A�
�!�%�%�Lr#�__main__Nr�Test�command�Quit)�tkinterrrrrr�__all__r(rr+r$�t�quit�q�mainloopr"r#r�<module>r6s���>�=��*�����V��"��z���t�f�f����B� �	!�A�	�t�f�f������B� �	!�A��J�J�L�r#__pycache__/filedialog.cpython-312.pyc000064400000054130151710635150013565 0ustar00�

T��h[:���dZgd�ZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZddlmZddlmZddlmZiZGd�d	�ZGd
�de�ZGd�d
e�ZGd�dej,�ZGd�de�ZGd�de�Z Gd�dej,�Z!d�Z"d�Z#d�Z$dd�Z%dd�Z&d d�Z'd�Z(d�Z)e*dk(re)�yy)!aUFile selection dialog classes.

Classes:

- FileDialog
- LoadFileDialog
- SaveFileDialog

This module also presents tk common file dialogues, it provides interfaces
to the native file dialogues available in Tk 4.2 and newer, and the
directory dialogue available in Tk 8.3 and newer.
These interfaces were written by Fredrik Lundh, May 1997.
)
�
FileDialog�LoadFileDialog�SaveFileDialog�Open�SaveAs�	Directory�askopenfilename�asksaveasfilename�askopenfilenames�askopenfile�askopenfiles�
asksaveasfile�askdirectory�N)�Frame�LEFT�YES�BOTTOM�Entry�TOP�Button�Tk�X�Toplevel�RIGHT�Y�END�Listbox�BOTH�	Scrollbar)�Dialog)�commondialog)�
_setup_dialogc��eZdZdZdZdd�Zejdddfd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zdd�Zd�Zd�Zdd�Zd�Zd�Zy)ra�Standard file selection dialog -- no checks on selected file.

    Usage:

        d = FileDialog(master)
        fname = d.go(dir_or_file, pattern, default, key)
        if fname is None: ...canceled...
        else: ...open file...

    All arguments to go() are optional.

    The 'key' argument specifies a key in the global dictionary
    'dialogstates', which keeps track of the values for the directory
    and pattern arguments, overriding the values passed in (it does
    not keep track of the default argument!).  If no key is specified,
    the dialog keeps no memory of previous state.  Note that memory is
    kept even when the dialog is canceled.  (All this emulates the
    behavior of the Macintosh file selection dialogs.)

    zFile Selection DialogNc�*�|�|j}||_d|_t|�|_|jj|�|jj|�t
|j�t|j�|_|jjtt��t|j�|_
|jjtt��|jjd|j�t|j�|_|j jt"t��|j jd|j$�t|j�|_|j&jt(t*��t-|j&�|_|j.jt0t2��t5|j&d|j.df��|_|j6jt0t(t*��|j6j9�}|j6j9|dd|ddz�|j6jd	|j:�|j6jd
|j<�|j.j?|j6df��t-|j&�|_ |j@jtBt2��t5|j&d|j@df��|_"|jDjtBt(t*��|j@j?|jDdf��|jDj9�}|jDj9|dd|ddz�|jDjd	|jF�|jDjd
|jH�tK|jd
|jL��|_'|jNjtB��tK|jd|j$��|_(|jPjtBt(��tK|jd|jR��|_*|jTjt0��|jjWd|jR�|jjd|jR�|jjd|jR�y)N)�side�fillz<Return>)�expandr&r�set)�exportselection�yscrollcommand)r%r'r&�z<ButtonRelease-1>z<Double-ButtonRelease-1>�yview)�command�OK)�textr-)r%�Filter)r%r'�Cancel�WM_DELETE_WINDOWz<Alt-w>z<Alt-W>),�title�master�	directoryr�top�iconnamer"r�botframe�packrrr�	selection�bind�ok_event�filterr�filter_command�midframerrr�filesbarrrr�files�bindtags�files_select_event�files_double_event�config�dirsbarr�dirs�dirs_select_event�dirs_double_eventr�
ok_command�	ok_button�
filter_button�cancel_command�
cancel_button�protocol)�selfr4r3�btagss    �+/usr/lib64/python3.12/tkinter/filedialog.py�__init__zFileDialog.__init__:s����=�$�*�*�%��������F�#��������u�������%� ��d�h�h���d�h�h���
��
�
����Q��/��t�x�x����������a��0������J��
�
�6��D�H�H�o��������c���*�������T�%8�%8�9��d�h�h���
��
�
���#�D��1�!�$�-�-�0��
��
�
����A��.��T�]�]�A�-1�]�]�E�,B�D��
��
�
���U�3�T��:��
�
�#�#�%���
�
���E�!�"�I��b�q�	�1�2��
�
���+�T�-D�-D�E��
�
���2�D�4K�4K�L��
�
���d�j�j�'�%:��;� ����/��������t�!��,��D�M�M�1�,0�L�L�%�+@�B��	��	�	���D��4��8������T�Y�Y��$8��9��	�	�"�"�$���	�	���5���9�u�R�a�y�0�1��	�	���*�D�,B�,B�C��	�	���1�4�3I�3I�J���
�
�&*�)-���:���	
�������&�#�D�M�M�)1�,0�,?�,?�A���	
�����T�#��6�#�D�M�M�)1�,0�,?�,?�A���	
�����U��+������,�d�.A�.A�B����
�
�i��!4�!4�5����
�
�i��!4�!4�5��*�c�b�|r|tvrt|\|_}nmtjj	|�}tjj|�r||_n'tjj
|�\|_}|j|j|�|j|�|j�|jj�|jj�|jj�d|_|j j#�|rS|j%�\}}|jr)tjj'|j�}||ft|<|jj)�|jS�N)�dialogstatesr5�os�path�
expanduser�isdir�split�
set_filter�
set_selectionr>r:�	focus_setr6�wait_visibility�grab_set�howr4�mainloop�
get_filter�dirname�destroy)rP�dir_or_file�pattern�default�keyr5s      rR�goz
FileDialog.gozs-���3�,�&�&2�3�&7�#�D�N�G��'�'�,�,�[�9�K��w�w�}�}�[�)�!,���*,�'�'�-�-��*D�'�����������0����7�#�������� � �"���� � �"�����������������!%���!2��I�w��x�x��G�G�O�O�D�H�H�5�	� )�7� 2�L����������x�x�rTc�F�||_|jj�yrX)rdr4�quit)rPrds  rRrozFileDialog.quit�s����������rTc�$�|j�yrX)r>�rP�events  rRrIzFileDialog.dirs_double_event�s�����rTc��|j�\}}|jjd�}tjjtjj
|j|��}|j||�y�N�active)	rfrG�getrZr[�normpath�joinr5r_)rPrr�dir�pat�subdirs     rRrHzFileDialog.dirs_select_event�sY���?�?�$���S������x�(���g�g���r�w�w�|�|�D�N�N�F�C�D������S�!rTc�$�|j�yrX�rJrqs  rRrDzFileDialog.files_double_event�������rTc�\�|jjd�}|j|�yrt)rArvr`)rPrr�files   rRrCzFileDialog.files_select_event�s"���z�z�~�~�h�'�����4� rTc�$�|j�yrXr}rqs  rRr<zFileDialog.ok_event�r~rTc�B�|j|j��yrX)ro�
get_selection�rPs rRrJzFileDialog.ok_command�s���	�	�$�$�$�&�'rTc���|j�\}}	tj|�}||_|j||�|j�tjg}g}|D]{}tjj||�}tjj|�r|j|��Ttj||�s�k|j|��}|jj!dt"�|D]"}|jj%t"|��$|j&j!dt"�|D]"}|j&j%t"|��$tjj)|j+��\}	}
|
tj,k(rd}
|j/|
�y#t$r|jj�YywxYw)NrrV)rfrZ�listdir�OSErrorr4�bellr5r_�sort�pardirr[rxr]�append�fnmatchrG�deleter�insertrAr^r��curdirr`)rPrrryrz�names�subdirs�
matchingfiles�name�fullname�head�tails           rRr>zFileDialog.filter_command�sq���?�?�$���S�	��J�J�s�O�E��������S�!�
�
�
���9�9�+���
��D��w�w�|�|�C��.�H��w�w�}�}�X�&����t�$�����s�+��$�$�T�*��	
�	�	����C� ��D��I�I���S�$�'���
�
���!�S�!�!�D��J�J���c�4�(�"��W�W�]�]�4�#5�#5�#7�8�
��d��2�9�9��R�d����4� ��-�	��K�K�����	�s�G�#G1�0G1c�\�|jj�}tjj	|�}|ddtj
k(stjj
|�r tjj|d�}tjj|�S)N���rU)	r=rvrZr[r\�sepr]rxr^)rPr=s  rRrfzFileDialog.get_filter�sn�������"�����#�#�F�+���"�#�;�"�&�&� �B�G�G�M�M�&�$9��W�W�\�\�&�#�.�F��w�w�}�}�V�$�$rTc�x�|jj�}tjj	|�}|SrX)r:rvrZr[r\�rPr�s  rRr�zFileDialog.get_selection�s-���~�~�!�!�#���w�w�!�!�$�'���rTc�$�|j�yrX)rorqs  rRrMzFileDialog.cancel_command�s���	�	�rTc��tjj|�sV	tj�}|r?tjj||�}tjj
|�}|jjdt�|jjttjj|xstj|xsd��y#t$rd}Y��wxYw)NrrU)rZr[�isabs�getcwdr�rxrwr=r�rr�r�)rPryrz�pwds    rRr_zFileDialog.set_filter�s����w�w�}�}�S�!�
��i�i�k����g�g�l�l�3��,���g�g�&�&�s�+�������1�c�"������3������S�-=�B�I�I�s�z�c� J�K��
�
���
�s�C+�+C9�8C9c���|jjdt�|jjttj
j
|j|��y)Nr)r:r�rr�rZr[rxr5r�s  rRr`zFileDialog.set_selection�s=�������a��%������c�2�7�7�<�<�����#E�FrTrX)�__name__�
__module__�__qualname__�__doc__r3rSrZr�rmrorIrHrDrCr<rJr>rfr�rMr_r`�rTrRrr!sk���*
$�E�>6�@ �Y�Y��R�T��2��"��!��(�!�8%��
�
L�GrTrc��eZdZdZdZd�Zy)rz8File selection dialog which checks that the file exists.zLoad File Selection Dialogc��|j�}tjj|�s|jj�y|j
|�yrX)r�rZr[�isfiler4r�ror�s  rRrJzLoadFileDialog.ok_command�s;���!�!�#���w�w�~�~�d�#��K�K�����I�I�d�OrTN�r�r�r�r�r3rJr�rTrRrr�s��B�(�E�rTrc��eZdZdZdZd�Zy)rz@File selection dialog which checks that the file may be created.zSave File Selection Dialogc��|j�}tjj|�ritjj	|�r|j
j
�yt|jdd|�d�ddd��}|jdk7r]ytjj|�\}}tjj	|�s|j
j
�y|j|�y)	Nz Overwrite Existing File QuestionzOverwrite existing file �?�	questheadr+)�Yesr1)r3r/�bitmaprk�stringsr)r�rZr[�existsr]r4r�r r6�numr^ro)rPr��dr�r�s     rRrJzSaveFileDialog.ok_command�s����!�!�#��
�7�7�>�>�$���w�w�}�}�T�"���� � �"���t�x�x�?�=A�C�)� �0�2�A��u�u��z�������t�,�J�D�$��7�7�=�=��&���� � �"���	�	�$�rTNr�r�rTrRrr�s��J�(�E�rTrc��eZdZd�Zd�Zy)�_Dialogc�n�	t|jd�|jd<y#t$rYywxYw)N�	filetypes)�tuple�options�KeyErrorr�s rR�_fixoptionsz_Dialog._fixoptions2s5��	�(-�d�l�l�;�.G�(H�D�L�L��%���	��	�s�%(�	4�4c���|rM	|j}tjj	|�\}}||j
d<||j
d<||_|S#t$rY�TwxYw)N�
initialdir�initialfile)�string�AttributeErrorrZr[r^r��filename)rP�widget�resultr[r�s     rR�
_fixresultz_Dialog._fixresult9sg���
����������v�.�J�D�$�)-�D�L�L��&�*.�D�L�L��'���
��
��"�
��
�s�A�	A%�$A%N)r�r�r�r�r�r�rTrRr�r�0s���
rTr�c��eZdZdZdZd�Zy)r�Ask for a filename to open�tk_getOpenFilec
��t|t�r\t|D�cgc]}t|d|���c}�}|r4tjj|d�\}}||jd<|S|jj�s9d|jvr+|j||jj|��Stj|||�Scc}w)Nr�rr��multiple)�
isinstancer��getattrrZr[r^r��tk�wantobjectsr��	splitlistr�)rPr�r��rr[r�s      rRr�zOpen._fixresultQs����f�e�$��V�D�V��G�A�x��3�V�D�E�F���W�W�]�]�6�!�9�5�
��d�-1����\�*��M��y�y�$�$�&�:����+E��?�?�6�6�9�9�+>�+>�v�+F�G�G��!�!�$���7�7��Es�CN�r�r�r�r�r-r�r�rTrRrrLs�� ��G�8rTrc��eZdZdZdZy)r�Ask for a filename to save as�tk_getSaveFileN)r�r�r�r�r-r�rTrRrr`s
��#��GrTrc��eZdZdZdZd�Zy)rzAsk for a directory�tk_chooseDirectoryc�n�|r	|j}||jd<||_|S#t$rY�#wxYw)Nr�)r�r�r�r5)rPr�r�s   rRr�zDirectory._fixresultlsC���
�����
*0�D�L�L��&�����
��
"�
��
�s�(�	4�4Nr�r�rTrRrrgs���"�G�rTrc�4�tdi|��j�S)r�r��r�show�r�s rRrr}s���?�'�?���!�!rTc�4�tdi|��j�S)r�r�)rr�r�s rRr	r	�s����G��!�!�#�#rTc�>�d|d<tdi|��j�S)ztAsk for multiple filenames to open

    Returns a list of filenames or empty list if
    cancel button selected
    r+r�r�r�r�s rRr
r
�s#���G�J���?�'�?���!�!rTc�R�tdi|��j�}|rt||�Sy)z8Ask for a filename to open, and returned the opened fileNr�)rr��open��moder�r�s   rRrr�s+����g��#�#�%�H���H�d�#�#�rTc�l�tdi|��}|r&g}|D]}|jt||���|}|S)z�Ask for multiple filenames and return the open file
    objects

    returns a list of open file objects or an empty list if
    cancel selected
    r�)r
r�r�)r�r�rA�ofilesr�s     rRrr�s@��
�'�w�'�E�����H��M�M�$�x��.�/�����LrTc�R�tdi|��j�}|rt||�Sy)z;Ask for a filename to save as, and returned the opened fileNr�)rr�r�r�s   rRr
r
�s-��� �� �%�%�'�H���H�d�#�#�rTc�4�tdi|��j�S)z-Ask for a directory, and return the file namer�)rr�r�s rRrr�s����w��$�$�&�&rTc��t�}|j�t|�}|jd��}t	|�}|jd��}t||�d}	ddl}|j|jd�|j|j�}tdg��}	t|d	�}|j�td|j#|��t%�}	td|	j#|��y#ttf$rY�|wxYw#t $r }td
�t|�Yd}~�zd}~wwxYw)
zSimple test program.�test)rlzutf-8rNrV)z	all filesrU)r�r�zCould not open File: r��saveas)r�withdrawrrmr�print�locale�	setlocale�LC_ALL�nl_langinfo�CODESET�ImportErrorr�rr��close�
BaseException�encoder	)
�root�fd�loadfile�savefile�encr��openfilename�fp�exc�saveasfilenames
          rRr�r��s#��
�4�D��M�M�O�	��	�B��u�u��u� �H�	��	�B��u�u��u� �H�	�(�H���C�
��������r�*�� � ����0��!�,>�+?�@�L����S�!��
���
�

�&�,�%�%�c�*�+�%�&�N�	�(�N�)�)�#�.�/��%
��(�
��
����
�%�&�
�c�
�
���s*�$;D
�-D�
D�D�	E�(E�E�__main__)r�)�w)+r��__all__r�rZ�tkinterrrrrrrrrrrrrrrrr�tkinter.dialogr r!�tkinter.simpledialogr"rYrrrr�rrrrr	r
rrr
rr�r�r�rTrR�<module>rs����K��
�	������"� �.���EG�EG�P�Z���Z��r�l�!�!��88�7�8�(�W����#�#��,"�$�"���"�'�(0�V�z���F�rT__pycache__/scrolledtext.cpython-312.pyc000064400000006376151710635150014213 0ustar00�

T��h��|�dZddlmZmZmZmZmZmZddlm	Z	m
Z
mZmZdgZ
Gd�de�Zd�Zedk(re�yy)	aA ScrolledText widget feels like a text widget but also has a
vertical scroll bar on its right.  (Later, options may be added to
add a horizontal bar as well, to make the bars disappear
automatically when not needed, to move them to the other side of the
window, etc.)

Configuration options are passed to the Text widget.
A Frame widget is inserted between the master and the text, to hold
the Scrollbar widget.
Most methods calls are inherited from the Text widget; Pack, Grid and
Place methods are redirected to the Frame widget however.
�)�Frame�Text�	Scrollbar�Pack�Grid�Place)�RIGHT�LEFT�Y�BOTH�ScrolledTextc��eZdZdd�Zd�Zy)r
Nc	�$�t|�|_t|j�|_|jj	t
t��|jd|jji�tj||jfi|��|j	ttd��|j|jd<tt�j�}tt �j�tt"�j�ztt$�j�z}|j'|�}|D]8}|ddk7s�|dk7s�|d	k7s�t)||t+|j|���:y)
N)�side�fill�yscrollcommandT)rr�expand�commandr�_�config�	configure)r�framer�vbar�packr	r�update�setr�__init__r
r�yview�vars�keysrrr�
difference�setattr�getattr)�self�master�kw�
text_meths�methods�ms      �-/usr/lib64/python3.12/tkinter/scrolledtext.pyrzScrolledText.__init__s���6�]��
��d�j�j�)��	��	�	���E���*�
�	�	�#�T�Y�Y�]�]�3�4��
�
�d�D�J�J�-�"�-��	�	�t�$�t�	�4�#�z�z��	�	�)���$�Z�_�_�&�
��t�*�/�/�#�d�4�j�o�o�&7�7�$�u�+�:J�:J�:L�L���$�$�Z�0���A���t�s�{�q�H�}��k�1A���a�����Q�!7�8��c�,�t|j�S�N)�strr)r$s r*�__str__zScrolledText.__str__)s���4�:�:��r+r-)�__name__�
__module__�__qualname__rr/�r+r*r
r
s��9�(r+c���ddlm}tdd��}|j|t�|jttd��|j�|j�y)Nr)�END�white�
)�bg�heightT)rrr)
�tkinter.constantsr5r
�insert�__doc__rrr
�	focus_set�mainloop)r5�stexts  r*�exampler@-sE��%��G�B�/�E�	�L�L��g��	�J�J�D�t�D�J�1�	�O�O��	�N�N�r+�__main__N)r<�tkinterrrrrrrr:r	r
rr�__all__r
r@r0r3r+r*�<module>rDsE���>�=�2�2��
���4��2��z���I�r+__init__.py000064400000522160151710635150006667 0ustar00"""Wrapper functions for Tcl/Tk.

Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow.

Properties of the widgets are specified with keyword arguments.
Keyword arguments have the same name as the corresponding resource
under Tk.

Widgets are positioned with one of the geometry managers Place, Pack
or Grid. These managers can be called with methods place, pack, grid
available in every Widget.

Actions are bound to events by resources (e.g. keyword argument
command) or with the method bind.

Example (Hello, World):
import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()
"""

import collections
import enum
import sys
import types

import _tkinter # If this fails your Python may not be configured for Tk
TclError = _tkinter.TclError
from tkinter.constants import *
import re

wantobjects = 1
_debug = False  # set to True to print executed Tcl/Tk commands

TkVersion = float(_tkinter.TK_VERSION)
TclVersion = float(_tkinter.TCL_VERSION)

READABLE = _tkinter.READABLE
WRITABLE = _tkinter.WRITABLE
EXCEPTION = _tkinter.EXCEPTION


_magic_re = re.compile(r'([\\{}])')
_space_re = re.compile(r'([\s])', re.ASCII)


def _join(value):
    """Internal function."""
    return ' '.join(map(_stringify, value))


def _stringify(value):
    """Internal function."""
    if isinstance(value, (list, tuple)):
        if len(value) == 1:
            value = _stringify(value[0])
            if _magic_re.search(value):
                value = '{%s}' % value
        else:
            value = '{%s}' % _join(value)
    else:
        if isinstance(value, bytes):
            value = str(value, 'latin1')
        else:
            value = str(value)
        if not value:
            value = '{}'
        elif _magic_re.search(value):
            # add '\' before special characters and spaces
            value = _magic_re.sub(r'\\\1', value)
            value = value.replace('\n', r'\n')
            value = _space_re.sub(r'\\\1', value)
            if value[0] == '"':
                value = '\\' + value
        elif value[0] == '"' or _space_re.search(value):
            value = '{%s}' % value
    return value


def _flatten(seq):
    """Internal function."""
    res = ()
    for item in seq:
        if isinstance(item, (tuple, list)):
            res = res + _flatten(item)
        elif item is not None:
            res = res + (item,)
    return res


try: _flatten = _tkinter._flatten
except AttributeError: pass


def _cnfmerge(cnfs):
    """Internal function."""
    if isinstance(cnfs, dict):
        return cnfs
    elif isinstance(cnfs, (type(None), str)):
        return cnfs
    else:
        cnf = {}
        for c in _flatten(cnfs):
            try:
                cnf.update(c)
            except (AttributeError, TypeError) as msg:
                print("_cnfmerge: fallback due to:", msg)
                for k, v in c.items():
                    cnf[k] = v
        return cnf


try: _cnfmerge = _tkinter._cnfmerge
except AttributeError: pass


def _splitdict(tk, v, cut_minus=True, conv=None):
    """Return a properly formatted dict built from Tcl list pairs.

    If cut_minus is True, the supposed '-' prefix will be removed from
    keys. If conv is specified, it is used to convert values.

    Tcl list is expected to contain an even number of elements.
    """
    t = tk.splitlist(v)
    if len(t) % 2:
        raise RuntimeError('Tcl list representing a dict is expected '
                           'to contain an even number of elements')
    it = iter(t)
    dict = {}
    for key, value in zip(it, it):
        key = str(key)
        if cut_minus and key[0] == '-':
            key = key[1:]
        if conv:
            value = conv(value)
        dict[key] = value
    return dict

class _VersionInfoType(collections.namedtuple('_VersionInfoType',
        ('major', 'minor', 'micro', 'releaselevel', 'serial'))):
    def __str__(self):
        if self.releaselevel == 'final':
            return f'{self.major}.{self.minor}.{self.micro}'
        else:
            return f'{self.major}.{self.minor}{self.releaselevel[0]}{self.serial}'

def _parse_version(version):
    import re
    m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', version)
    major, minor, releaselevel, serial = m.groups()
    major, minor, serial = int(major), int(minor), int(serial)
    if releaselevel == '.':
        micro = serial
        serial = 0
        releaselevel = 'final'
    else:
        micro = 0
        releaselevel = {'a': 'alpha', 'b': 'beta'}[releaselevel]
    return _VersionInfoType(major, minor, micro, releaselevel, serial)


@enum._simple_enum(enum.StrEnum)
class EventType:
    KeyPress = '2'
    Key = KeyPress
    KeyRelease = '3'
    ButtonPress = '4'
    Button = ButtonPress
    ButtonRelease = '5'
    Motion = '6'
    Enter = '7'
    Leave = '8'
    FocusIn = '9'
    FocusOut = '10'
    Keymap = '11'           # undocumented
    Expose = '12'
    GraphicsExpose = '13'   # undocumented
    NoExpose = '14'         # undocumented
    Visibility = '15'
    Create = '16'
    Destroy = '17'
    Unmap = '18'
    Map = '19'
    MapRequest = '20'
    Reparent = '21'
    Configure = '22'
    ConfigureRequest = '23'
    Gravity = '24'
    ResizeRequest = '25'
    Circulate = '26'
    CirculateRequest = '27'
    Property = '28'
    SelectionClear = '29'   # undocumented
    SelectionRequest = '30' # undocumented
    Selection = '31'        # undocumented
    Colormap = '32'
    ClientMessage = '33'    # undocumented
    Mapping = '34'          # undocumented
    VirtualEvent = '35'     # undocumented
    Activate = '36'
    Deactivate = '37'
    MouseWheel = '38'


class Event:
    """Container for the properties of an event.

    Instances of this type are generated if one of the following events occurs:

    KeyPress, KeyRelease - for keyboard events
    ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events
    Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate,
    Colormap, Gravity, Reparent, Property, Destroy, Activate,
    Deactivate - for window events.

    If a callback function for one of these events is registered
    using bind, bind_all, bind_class, or tag_bind, the callback is
    called with an Event as first argument. It will have the
    following attributes (in braces are the event types for which
    the attribute is valid):

        serial - serial number of event
    num - mouse button pressed (ButtonPress, ButtonRelease)
    focus - whether the window has the focus (Enter, Leave)
    height - height of the exposed window (Configure, Expose)
    width - width of the exposed window (Configure, Expose)
    keycode - keycode of the pressed key (KeyPress, KeyRelease)
    state - state of the event as a number (ButtonPress, ButtonRelease,
                            Enter, KeyPress, KeyRelease,
                            Leave, Motion)
    state - state as a string (Visibility)
    time - when the event occurred
    x - x-position of the mouse
    y - y-position of the mouse
    x_root - x-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    y_root - y-position of the mouse on the screen
             (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
    char - pressed character (KeyPress, KeyRelease)
    send_event - see X/Windows documentation
    keysym - keysym of the event as a string (KeyPress, KeyRelease)
    keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
    type - type of the event as a number
    widget - widget in which the event occurred
    delta - delta of wheel movement (MouseWheel)
    """

    def __repr__(self):
        attrs = {k: v for k, v in self.__dict__.items() if v != '??'}
        if not self.char:
            del attrs['char']
        elif self.char != '??':
            attrs['char'] = repr(self.char)
        if not getattr(self, 'send_event', True):
            del attrs['send_event']
        if self.state == 0:
            del attrs['state']
        elif isinstance(self.state, int):
            state = self.state
            mods = ('Shift', 'Lock', 'Control',
                    'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5',
                    'Button1', 'Button2', 'Button3', 'Button4', 'Button5')
            s = []
            for i, n in enumerate(mods):
                if state & (1 << i):
                    s.append(n)
            state = state & ~((1<< len(mods)) - 1)
            if state or not s:
                s.append(hex(state))
            attrs['state'] = '|'.join(s)
        if self.delta == 0:
            del attrs['delta']
        # widget usually is known
        # serial and time are not very interesting
        # keysym_num duplicates keysym
        # x_root and y_root mostly duplicate x and y
        keys = ('send_event',
                'state', 'keysym', 'keycode', 'char',
                'num', 'delta', 'focus',
                'x', 'y', 'width', 'height')
        return '<%s event%s>' % (
            getattr(self.type, 'name', self.type),
            ''.join(' %s=%s' % (k, attrs[k]) for k in keys if k in attrs)
        )


_support_default_root = True
_default_root = None


def NoDefaultRoot():
    """Inhibit setting of default root window.

    Call this function to inhibit that the first instance of
    Tk is used for windows without an explicit parent window.
    """
    global _support_default_root, _default_root
    _support_default_root = False
    # Delete, so any use of _default_root will immediately raise an exception.
    # Rebind before deletion, so repeated calls will not fail.
    _default_root = None
    del _default_root


def _get_default_root(what=None):
    if not _support_default_root:
        raise RuntimeError("No master specified and tkinter is "
                           "configured to not support default root")
    if _default_root is None:
        if what:
            raise RuntimeError(f"Too early to {what}: no default root window")
        root = Tk()
        assert _default_root is root
    return _default_root


def _get_temp_root():
    global _support_default_root
    if not _support_default_root:
        raise RuntimeError("No master specified and tkinter is "
                           "configured to not support default root")
    root = _default_root
    if root is None:
        assert _support_default_root
        _support_default_root = False
        root = Tk()
        _support_default_root = True
        assert _default_root is None
        root.withdraw()
        root._temporary = True
    return root


def _destroy_temp_root(master):
    if getattr(master, '_temporary', False):
        try:
            master.destroy()
        except TclError:
            pass


def _tkerror(err):
    """Internal function."""
    pass


def _exit(code=0):
    """Internal function. Calling it will raise the exception SystemExit."""
    try:
        code = int(code)
    except ValueError:
        pass
    raise SystemExit(code)


_varnum = 0


class Variable:
    """Class to define value holders for e.g. buttons.

    Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations
    that constrain the type of the value returned from get()."""
    _default = ""
    _tk = None
    _tclCommands = None

    def __init__(self, master=None, value=None, name=None):
        """Construct a variable

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        """
        # check for type of NAME parameter to override weird error message
        # raised from Modules/_tkinter.c:SetVar like:
        # TypeError: setvar() takes exactly 3 arguments (2 given)
        if name is not None and not isinstance(name, str):
            raise TypeError("name must be a string")
        global _varnum
        if master is None:
            master = _get_default_root('create variable')
        self._root = master._root()
        self._tk = master.tk
        if name:
            self._name = name
        else:
            self._name = 'PY_VAR' + repr(_varnum)
            _varnum += 1
        if value is not None:
            self.initialize(value)
        elif not self._tk.getboolean(self._tk.call("info", "exists", self._name)):
            self.initialize(self._default)

    def __del__(self):
        """Unset the variable in Tcl."""
        if self._tk is None:
            return
        if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
            self._tk.globalunsetvar(self._name)
        if self._tclCommands is not None:
            for name in self._tclCommands:
                self._tk.deletecommand(name)
            self._tclCommands = None

    def __str__(self):
        """Return the name of the variable in Tcl."""
        return self._name

    def set(self, value):
        """Set the variable to VALUE."""
        return self._tk.globalsetvar(self._name, value)

    initialize = set

    def get(self):
        """Return value of variable."""
        return self._tk.globalgetvar(self._name)

    def _register(self, callback):
        f = CallWrapper(callback, None, self._root).__call__
        cbname = repr(id(f))
        try:
            callback = callback.__func__
        except AttributeError:
            pass
        try:
            cbname = cbname + callback.__name__
        except AttributeError:
            pass
        self._tk.createcommand(cbname, f)
        if self._tclCommands is None:
            self._tclCommands = []
        self._tclCommands.append(cbname)
        return cbname

    def trace_add(self, mode, callback):
        """Define a trace callback for the variable.

        Mode is one of "read", "write", "unset", or a list or tuple of
        such strings.
        Callback must be a function which is called when the variable is
        read, written or unset.

        Return the name of the callback.
        """
        cbname = self._register(callback)
        self._tk.call('trace', 'add', 'variable',
                      self._name, mode, (cbname,))
        return cbname

    def trace_remove(self, mode, cbname):
        """Delete the trace callback for a variable.

        Mode is one of "read", "write", "unset" or a list or tuple of
        such strings.  Must be same as were specified in trace_add().
        cbname is the name of the callback returned from trace_add().
        """
        self._tk.call('trace', 'remove', 'variable',
                      self._name, mode, cbname)
        for m, ca in self.trace_info():
            if self._tk.splitlist(ca)[0] == cbname:
                break
        else:
            self._tk.deletecommand(cbname)
            try:
                self._tclCommands.remove(cbname)
            except ValueError:
                pass

    def trace_info(self):
        """Return all trace callback information."""
        splitlist = self._tk.splitlist
        return [(splitlist(k), v) for k, v in map(splitlist,
            splitlist(self._tk.call('trace', 'info', 'variable', self._name)))]

    def trace_variable(self, mode, callback):
        """Define a trace callback for the variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CALLBACK must be a function which is called when
        the variable is read, written or undefined.

        Return the name of the callback.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_add() instead.
        """
        # TODO: Add deprecation warning
        cbname = self._register(callback)
        self._tk.call("trace", "variable", self._name, mode, cbname)
        return cbname

    trace = trace_variable

    def trace_vdelete(self, mode, cbname):
        """Delete the trace callback for a variable.

        MODE is one of "r", "w", "u" for read, write, undefine.
        CBNAME is the name of the callback returned from trace_variable or trace.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_remove() instead.
        """
        # TODO: Add deprecation warning
        self._tk.call("trace", "vdelete", self._name, mode, cbname)
        cbname = self._tk.splitlist(cbname)[0]
        for m, ca in self.trace_info():
            if self._tk.splitlist(ca)[0] == cbname:
                break
        else:
            self._tk.deletecommand(cbname)
            try:
                self._tclCommands.remove(cbname)
            except ValueError:
                pass

    def trace_vinfo(self):
        """Return all trace callback information.

        This deprecated method wraps a deprecated Tcl method that will
        likely be removed in the future.  Use trace_info() instead.
        """
        # TODO: Add deprecation warning
        return [self._tk.splitlist(x) for x in self._tk.splitlist(
            self._tk.call("trace", "vinfo", self._name))]

    def __eq__(self, other):
        if not isinstance(other, Variable):
            return NotImplemented
        return (self._name == other._name
                and self.__class__.__name__ == other.__class__.__name__
                and self._tk == other._tk)


class StringVar(Variable):
    """Value holder for strings variables."""
    _default = ""

    def __init__(self, master=None, value=None, name=None):
        """Construct a string variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        """
        Variable.__init__(self, master, value, name)

    def get(self):
        """Return value of variable as string."""
        value = self._tk.globalgetvar(self._name)
        if isinstance(value, str):
            return value
        return str(value)


class IntVar(Variable):
    """Value holder for integer variables."""
    _default = 0

    def __init__(self, master=None, value=None, name=None):
        """Construct an integer variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        """
        Variable.__init__(self, master, value, name)

    def get(self):
        """Return the value of the variable as an integer."""
        value = self._tk.globalgetvar(self._name)
        try:
            return self._tk.getint(value)
        except (TypeError, TclError):
            return int(self._tk.getdouble(value))


class DoubleVar(Variable):
    """Value holder for float variables."""
    _default = 0.0

    def __init__(self, master=None, value=None, name=None):
        """Construct a float variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to 0.0)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        """
        Variable.__init__(self, master, value, name)

    def get(self):
        """Return the value of the variable as a float."""
        return self._tk.getdouble(self._tk.globalgetvar(self._name))


class BooleanVar(Variable):
    """Value holder for boolean variables."""
    _default = False

    def __init__(self, master=None, value=None, name=None):
        """Construct a boolean variable.

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to False)
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.
        """
        Variable.__init__(self, master, value, name)

    def set(self, value):
        """Set the variable to VALUE."""
        return self._tk.globalsetvar(self._name, self._tk.getboolean(value))

    initialize = set

    def get(self):
        """Return the value of the variable as a bool."""
        try:
            return self._tk.getboolean(self._tk.globalgetvar(self._name))
        except TclError:
            raise ValueError("invalid literal for getboolean()")


def mainloop(n=0):
    """Run the main loop of Tcl."""
    _get_default_root('run the main loop').tk.mainloop(n)


getint = int

getdouble = float


def getboolean(s):
    """Convert Tcl object to True or False."""
    try:
        return _get_default_root('use getboolean()').tk.getboolean(s)
    except TclError:
        raise ValueError("invalid literal for getboolean()")


# Methods defined on both toplevel and interior widgets

class Misc:
    """Internal class.

    Base class which defines methods common for interior widgets."""

    # used for generating child widget names
    _last_child_ids = None

    # XXX font command?
    _tclCommands = None

    def destroy(self):
        """Internal function.

        Delete all Tcl commands created for
        this widget in the Tcl interpreter."""
        if self._tclCommands is not None:
            for name in self._tclCommands:
                self.tk.deletecommand(name)
            self._tclCommands = None

    def deletecommand(self, name):
        """Internal function.

        Delete the Tcl command provided in NAME."""
        self.tk.deletecommand(name)
        try:
            self._tclCommands.remove(name)
        except ValueError:
            pass

    def tk_strictMotif(self, boolean=None):
        """Set Tcl internal variable, whether the look and feel
        should adhere to Motif.

        A parameter of 1 means adhere to Motif (e.g. no color
        change if mouse passes over slider).
        Returns the set value."""
        return self.tk.getboolean(self.tk.call(
            'set', 'tk_strictMotif', boolean))

    def tk_bisque(self):
        """Change the color scheme to light brown as used in Tk 3.6 and before."""
        self.tk.call('tk_bisque')

    def tk_setPalette(self, *args, **kw):
        """Set a new color scheme for all widget elements.

        A single color as argument will cause that all colors of Tk
        widget elements are derived from this.
        Alternatively several keyword parameters and its associated
        colors can be given. The following keywords are valid:
        activeBackground, foreground, selectColor,
        activeForeground, highlightBackground, selectBackground,
        background, highlightColor, selectForeground,
        disabledForeground, insertBackground, troughColor."""
        self.tk.call(('tk_setPalette',)
              + _flatten(args) + _flatten(list(kw.items())))

    def wait_variable(self, name='PY_VAR'):
        """Wait until the variable is modified.

        A parameter of type IntVar, StringVar, DoubleVar or
        BooleanVar must be given."""
        self.tk.call('tkwait', 'variable', name)
    waitvar = wait_variable # XXX b/w compat

    def wait_window(self, window=None):
        """Wait until a WIDGET is destroyed.

        If no parameter is given self is used."""
        if window is None:
            window = self
        self.tk.call('tkwait', 'window', window._w)

    def wait_visibility(self, window=None):
        """Wait until the visibility of a WIDGET changes
        (e.g. it appears).

        If no parameter is given self is used."""
        if window is None:
            window = self
        self.tk.call('tkwait', 'visibility', window._w)

    def setvar(self, name='PY_VAR', value='1'):
        """Set Tcl variable NAME to VALUE."""
        self.tk.setvar(name, value)

    def getvar(self, name='PY_VAR'):
        """Return value of Tcl variable NAME."""
        return self.tk.getvar(name)

    def getint(self, s):
        try:
            return self.tk.getint(s)
        except TclError as exc:
            raise ValueError(str(exc))

    def getdouble(self, s):
        try:
            return self.tk.getdouble(s)
        except TclError as exc:
            raise ValueError(str(exc))

    def getboolean(self, s):
        """Return a boolean value for Tcl boolean values true and false given as parameter."""
        try:
            return self.tk.getboolean(s)
        except TclError:
            raise ValueError("invalid literal for getboolean()")

    def focus_set(self):
        """Direct input focus to this widget.

        If the application currently does not have the focus
        this widget will get the focus if the application gets
        the focus through the window manager."""
        self.tk.call('focus', self._w)
    focus = focus_set # XXX b/w compat?

    def focus_force(self):
        """Direct input focus to this widget even if the
        application does not have the focus. Use with
        caution!"""
        self.tk.call('focus', '-force', self._w)

    def focus_get(self):
        """Return the widget which has currently the focus in the
        application.

        Use focus_displayof to allow working with several
        displays. Return None if application does not have
        the focus."""
        name = self.tk.call('focus')
        if name == 'none' or not name: return None
        return self._nametowidget(name)

    def focus_displayof(self):
        """Return the widget which has currently the focus on the
        display where this widget is located.

        Return None if the application does not have the focus."""
        name = self.tk.call('focus', '-displayof', self._w)
        if name == 'none' or not name: return None
        return self._nametowidget(name)

    def focus_lastfor(self):
        """Return the widget which would have the focus if top level
        for this widget gets the focus from the window manager."""
        name = self.tk.call('focus', '-lastfor', self._w)
        if name == 'none' or not name: return None
        return self._nametowidget(name)

    def tk_focusFollowsMouse(self):
        """The widget under mouse will get automatically focus. Can not
        be disabled easily."""
        self.tk.call('tk_focusFollowsMouse')

    def tk_focusNext(self):
        """Return the next widget in the focus order which follows
        widget which has currently the focus.

        The focus order first goes to the next child, then to
        the children of the child recursively and then to the
        next sibling which is higher in the stacking order.  A
        widget is omitted if it has the takefocus resource set
        to 0."""
        name = self.tk.call('tk_focusNext', self._w)
        if not name: return None
        return self._nametowidget(name)

    def tk_focusPrev(self):
        """Return previous widget in the focus order. See tk_focusNext for details."""
        name = self.tk.call('tk_focusPrev', self._w)
        if not name: return None
        return self._nametowidget(name)

    def after(self, ms, func=None, *args):
        """Call function once after given time.

        MS specifies the time in milliseconds. FUNC gives the
        function which shall be called. Additional parameters
        are given as parameters to the function call.  Return
        identifier to cancel scheduling with after_cancel."""
        if func is None:
            # I'd rather use time.sleep(ms*0.001)
            self.tk.call('after', ms)
            return None
        else:
            def callit():
                try:
                    func(*args)
                finally:
                    try:
                        self.deletecommand(name)
                    except TclError:
                        pass
            try:
                callit.__name__ = func.__name__
            except AttributeError:
                # Required for callable classes (bpo-44404)
                callit.__name__ = type(func).__name__
            name = self._register(callit)
            return self.tk.call('after', ms, name)

    def after_idle(self, func, *args):
        """Call FUNC once if the Tcl main loop has no event to
        process.

        Return an identifier to cancel the scheduling with
        after_cancel."""
        return self.after('idle', func, *args)

    def after_cancel(self, id):
        """Cancel scheduling of function identified with ID.

        Identifier returned by after or after_idle must be
        given as first parameter.
        """
        if not id:
            raise ValueError('id must be a valid identifier returned from '
                             'after or after_idle')
        try:
            data = self.tk.call('after', 'info', id)
            script = self.tk.splitlist(data)[0]
            self.deletecommand(script)
        except TclError:
            pass
        self.tk.call('after', 'cancel', id)

    def bell(self, displayof=0):
        """Ring a display's bell."""
        self.tk.call(('bell',) + self._displayof(displayof))

    # Clipboard handling:
    def clipboard_get(self, **kw):
        """Retrieve data from the clipboard on window's display.

        The window keyword defaults to the root window of the Tkinter
        application.

        The type keyword specifies the form in which the data is
        to be returned and should be an atom name such as STRING
        or FILE_NAME.  Type defaults to STRING, except on X11, where the default
        is to try UTF8_STRING and fall back to STRING.

        This command is equivalent to:

        selection_get(CLIPBOARD)
        """
        if 'type' not in kw and self._windowingsystem == 'x11':
            try:
                kw['type'] = 'UTF8_STRING'
                return self.tk.call(('clipboard', 'get') + self._options(kw))
            except TclError:
                del kw['type']
        return self.tk.call(('clipboard', 'get') + self._options(kw))

    def clipboard_clear(self, **kw):
        """Clear the data in the Tk clipboard.

        A widget specified for the optional displayof keyword
        argument specifies the target display."""
        if 'displayof' not in kw: kw['displayof'] = self._w
        self.tk.call(('clipboard', 'clear') + self._options(kw))

    def clipboard_append(self, string, **kw):
        """Append STRING to the Tk clipboard.

        A widget specified at the optional displayof keyword
        argument specifies the target display. The clipboard
        can be retrieved with selection_get."""
        if 'displayof' not in kw: kw['displayof'] = self._w
        self.tk.call(('clipboard', 'append') + self._options(kw)
              + ('--', string))
    # XXX grab current w/o window argument

    def grab_current(self):
        """Return widget which has currently the grab in this application
        or None."""
        name = self.tk.call('grab', 'current', self._w)
        if not name: return None
        return self._nametowidget(name)

    def grab_release(self):
        """Release grab for this widget if currently set."""
        self.tk.call('grab', 'release', self._w)

    def grab_set(self):
        """Set grab for this widget.

        A grab directs all events to this and descendant
        widgets in the application."""
        self.tk.call('grab', 'set', self._w)

    def grab_set_global(self):
        """Set global grab for this widget.

        A global grab directs all events to this and
        descendant widgets on the display. Use with caution -
        other applications do not get events anymore."""
        self.tk.call('grab', 'set', '-global', self._w)

    def grab_status(self):
        """Return None, "local" or "global" if this widget has
        no, a local or a global grab."""
        status = self.tk.call('grab', 'status', self._w)
        if status == 'none': status = None
        return status

    def option_add(self, pattern, value, priority = None):
        """Set a VALUE (second parameter) for an option
        PATTERN (first parameter).

        An optional third parameter gives the numeric priority
        (defaults to 80)."""
        self.tk.call('option', 'add', pattern, value, priority)

    def option_clear(self):
        """Clear the option database.

        It will be reloaded if option_add is called."""
        self.tk.call('option', 'clear')

    def option_get(self, name, className):
        """Return the value for an option NAME for this widget
        with CLASSNAME.

        Values with higher priority override lower values."""
        return self.tk.call('option', 'get', self._w, name, className)

    def option_readfile(self, fileName, priority = None):
        """Read file FILENAME into the option database.

        An optional second parameter gives the numeric
        priority."""
        self.tk.call('option', 'readfile', fileName, priority)

    def selection_clear(self, **kw):
        """Clear the current X selection."""
        if 'displayof' not in kw: kw['displayof'] = self._w
        self.tk.call(('selection', 'clear') + self._options(kw))

    def selection_get(self, **kw):
        """Return the contents of the current X selection.

        A keyword parameter selection specifies the name of
        the selection and defaults to PRIMARY.  A keyword
        parameter displayof specifies a widget on the display
        to use. A keyword parameter type specifies the form of data to be
        fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
        before STRING."""
        if 'displayof' not in kw: kw['displayof'] = self._w
        if 'type' not in kw and self._windowingsystem == 'x11':
            try:
                kw['type'] = 'UTF8_STRING'
                return self.tk.call(('selection', 'get') + self._options(kw))
            except TclError:
                del kw['type']
        return self.tk.call(('selection', 'get') + self._options(kw))

    def selection_handle(self, command, **kw):
        """Specify a function COMMAND to call if the X
        selection owned by this widget is queried by another
        application.

        This function must return the contents of the
        selection. The function will be called with the
        arguments OFFSET and LENGTH which allows the chunking
        of very long selections. The following keyword
        parameters can be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME)."""
        name = self._register(command)
        self.tk.call(('selection', 'handle') + self._options(kw)
              + (self._w, name))

    def selection_own(self, **kw):
        """Become owner of X selection.

        A keyword parameter selection specifies the name of
        the selection (default PRIMARY)."""
        self.tk.call(('selection', 'own') +
                 self._options(kw) + (self._w,))

    def selection_own_get(self, **kw):
        """Return owner of X selection.

        The following keyword parameter can
        be provided:
        selection - name of the selection (default PRIMARY),
        type - type of the selection (e.g. STRING, FILE_NAME)."""
        if 'displayof' not in kw: kw['displayof'] = self._w
        name = self.tk.call(('selection', 'own') + self._options(kw))
        if not name: return None
        return self._nametowidget(name)

    def send(self, interp, cmd, *args):
        """Send Tcl command CMD to different interpreter INTERP to be executed."""
        return self.tk.call(('send', interp, cmd) + args)

    def lower(self, belowThis=None):
        """Lower this widget in the stacking order."""
        self.tk.call('lower', self._w, belowThis)

    def tkraise(self, aboveThis=None):
        """Raise this widget in the stacking order."""
        self.tk.call('raise', self._w, aboveThis)

    lift = tkraise

    def info_patchlevel(self):
        """Returns the exact version of the Tcl library."""
        patchlevel = self.tk.call('info', 'patchlevel')
        return _parse_version(patchlevel)

    def winfo_atom(self, name, displayof=0):
        """Return integer which represents atom NAME."""
        args = ('winfo', 'atom') + self._displayof(displayof) + (name,)
        return self.tk.getint(self.tk.call(args))

    def winfo_atomname(self, id, displayof=0):
        """Return name of atom with identifier ID."""
        args = ('winfo', 'atomname') \
               + self._displayof(displayof) + (id,)
        return self.tk.call(args)

    def winfo_cells(self):
        """Return number of cells in the colormap for this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'cells', self._w))

    def winfo_children(self):
        """Return a list of all widgets which are children of this widget."""
        result = []
        for child in self.tk.splitlist(
            self.tk.call('winfo', 'children', self._w)):
            try:
                # Tcl sometimes returns extra windows, e.g. for
                # menus; those need to be skipped
                result.append(self._nametowidget(child))
            except KeyError:
                pass
        return result

    def winfo_class(self):
        """Return window class name of this widget."""
        return self.tk.call('winfo', 'class', self._w)

    def winfo_colormapfull(self):
        """Return True if at the last color request the colormap was full."""
        return self.tk.getboolean(
            self.tk.call('winfo', 'colormapfull', self._w))

    def winfo_containing(self, rootX, rootY, displayof=0):
        """Return the widget which is at the root coordinates ROOTX, ROOTY."""
        args = ('winfo', 'containing') \
               + self._displayof(displayof) + (rootX, rootY)
        name = self.tk.call(args)
        if not name: return None
        return self._nametowidget(name)

    def winfo_depth(self):
        """Return the number of bits per pixel."""
        return self.tk.getint(self.tk.call('winfo', 'depth', self._w))

    def winfo_exists(self):
        """Return true if this widget exists."""
        return self.tk.getint(
            self.tk.call('winfo', 'exists', self._w))

    def winfo_fpixels(self, number):
        """Return the number of pixels for the given distance NUMBER
        (e.g. "3c") as float."""
        return self.tk.getdouble(self.tk.call(
            'winfo', 'fpixels', self._w, number))

    def winfo_geometry(self):
        """Return geometry string for this widget in the form "widthxheight+X+Y"."""
        return self.tk.call('winfo', 'geometry', self._w)

    def winfo_height(self):
        """Return height of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'height', self._w))

    def winfo_id(self):
        """Return identifier ID for this widget."""
        return int(self.tk.call('winfo', 'id', self._w), 0)

    def winfo_interps(self, displayof=0):
        """Return the name of all Tcl interpreters for this display."""
        args = ('winfo', 'interps') + self._displayof(displayof)
        return self.tk.splitlist(self.tk.call(args))

    def winfo_ismapped(self):
        """Return true if this widget is mapped."""
        return self.tk.getint(
            self.tk.call('winfo', 'ismapped', self._w))

    def winfo_manager(self):
        """Return the window manager name for this widget."""
        return self.tk.call('winfo', 'manager', self._w)

    def winfo_name(self):
        """Return the name of this widget."""
        return self.tk.call('winfo', 'name', self._w)

    def winfo_parent(self):
        """Return the name of the parent of this widget."""
        return self.tk.call('winfo', 'parent', self._w)

    def winfo_pathname(self, id, displayof=0):
        """Return the pathname of the widget given by ID."""
        if isinstance(id, int):
            id = hex(id)
        args = ('winfo', 'pathname') \
               + self._displayof(displayof) + (id,)
        return self.tk.call(args)

    def winfo_pixels(self, number):
        """Rounded integer value of winfo_fpixels."""
        return self.tk.getint(
            self.tk.call('winfo', 'pixels', self._w, number))

    def winfo_pointerx(self):
        """Return the x coordinate of the pointer on the root window."""
        return self.tk.getint(
            self.tk.call('winfo', 'pointerx', self._w))

    def winfo_pointerxy(self):
        """Return a tuple of x and y coordinates of the pointer on the root window."""
        return self._getints(
            self.tk.call('winfo', 'pointerxy', self._w))

    def winfo_pointery(self):
        """Return the y coordinate of the pointer on the root window."""
        return self.tk.getint(
            self.tk.call('winfo', 'pointery', self._w))

    def winfo_reqheight(self):
        """Return requested height of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'reqheight', self._w))

    def winfo_reqwidth(self):
        """Return requested width of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'reqwidth', self._w))

    def winfo_rgb(self, color):
        """Return a tuple of integer RGB values in range(65536) for color in this widget."""
        return self._getints(
            self.tk.call('winfo', 'rgb', self._w, color))

    def winfo_rootx(self):
        """Return x coordinate of upper left corner of this widget on the
        root window."""
        return self.tk.getint(
            self.tk.call('winfo', 'rootx', self._w))

    def winfo_rooty(self):
        """Return y coordinate of upper left corner of this widget on the
        root window."""
        return self.tk.getint(
            self.tk.call('winfo', 'rooty', self._w))

    def winfo_screen(self):
        """Return the screen name of this widget."""
        return self.tk.call('winfo', 'screen', self._w)

    def winfo_screencells(self):
        """Return the number of the cells in the colormap of the screen
        of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'screencells', self._w))

    def winfo_screendepth(self):
        """Return the number of bits per pixel of the root window of the
        screen of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'screendepth', self._w))

    def winfo_screenheight(self):
        """Return the number of pixels of the height of the screen of this widget
        in pixel."""
        return self.tk.getint(
            self.tk.call('winfo', 'screenheight', self._w))

    def winfo_screenmmheight(self):
        """Return the number of pixels of the height of the screen of
        this widget in mm."""
        return self.tk.getint(
            self.tk.call('winfo', 'screenmmheight', self._w))

    def winfo_screenmmwidth(self):
        """Return the number of pixels of the width of the screen of
        this widget in mm."""
        return self.tk.getint(
            self.tk.call('winfo', 'screenmmwidth', self._w))

    def winfo_screenvisual(self):
        """Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the default
        colormodel of this screen."""
        return self.tk.call('winfo', 'screenvisual', self._w)

    def winfo_screenwidth(self):
        """Return the number of pixels of the width of the screen of
        this widget in pixel."""
        return self.tk.getint(
            self.tk.call('winfo', 'screenwidth', self._w))

    def winfo_server(self):
        """Return information of the X-Server of the screen of this widget in
        the form "XmajorRminor vendor vendorVersion"."""
        return self.tk.call('winfo', 'server', self._w)

    def winfo_toplevel(self):
        """Return the toplevel widget of this widget."""
        return self._nametowidget(self.tk.call(
            'winfo', 'toplevel', self._w))

    def winfo_viewable(self):
        """Return true if the widget and all its higher ancestors are mapped."""
        return self.tk.getint(
            self.tk.call('winfo', 'viewable', self._w))

    def winfo_visual(self):
        """Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the
        colormodel of this widget."""
        return self.tk.call('winfo', 'visual', self._w)

    def winfo_visualid(self):
        """Return the X identifier for the visual for this widget."""
        return self.tk.call('winfo', 'visualid', self._w)

    def winfo_visualsavailable(self, includeids=False):
        """Return a list of all visuals available for the screen
        of this widget.

        Each item in the list consists of a visual name (see winfo_visual), a
        depth and if includeids is true is given also the X identifier."""
        data = self.tk.call('winfo', 'visualsavailable', self._w,
                            'includeids' if includeids else None)
        data = [self.tk.splitlist(x) for x in self.tk.splitlist(data)]
        return [self.__winfo_parseitem(x) for x in data]

    def __winfo_parseitem(self, t):
        """Internal function."""
        return t[:1] + tuple(map(self.__winfo_getint, t[1:]))

    def __winfo_getint(self, x):
        """Internal function."""
        return int(x, 0)

    def winfo_vrootheight(self):
        """Return the height of the virtual root window associated with this
        widget in pixels. If there is no virtual root window return the
        height of the screen."""
        return self.tk.getint(
            self.tk.call('winfo', 'vrootheight', self._w))

    def winfo_vrootwidth(self):
        """Return the width of the virtual root window associated with this
        widget in pixel. If there is no virtual root window return the
        width of the screen."""
        return self.tk.getint(
            self.tk.call('winfo', 'vrootwidth', self._w))

    def winfo_vrootx(self):
        """Return the x offset of the virtual root relative to the root
        window of the screen of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'vrootx', self._w))

    def winfo_vrooty(self):
        """Return the y offset of the virtual root relative to the root
        window of the screen of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'vrooty', self._w))

    def winfo_width(self):
        """Return the width of this widget."""
        return self.tk.getint(
            self.tk.call('winfo', 'width', self._w))

    def winfo_x(self):
        """Return the x coordinate of the upper left corner of this widget
        in the parent."""
        return self.tk.getint(
            self.tk.call('winfo', 'x', self._w))

    def winfo_y(self):
        """Return the y coordinate of the upper left corner of this widget
        in the parent."""
        return self.tk.getint(
            self.tk.call('winfo', 'y', self._w))

    def update(self):
        """Enter event loop until all pending events have been processed by Tcl."""
        self.tk.call('update')

    def update_idletasks(self):
        """Enter event loop until all idle callbacks have been called. This
        will update the display of windows but not process events caused by
        the user."""
        self.tk.call('update', 'idletasks')

    def bindtags(self, tagList=None):
        """Set or get the list of bindtags for this widget.

        With no argument return the list of all bindtags associated with
        this widget. With a list of strings as argument the bindtags are
        set to this list. The bindtags determine in which order events are
        processed (see bind)."""
        if tagList is None:
            return self.tk.splitlist(
                self.tk.call('bindtags', self._w))
        else:
            self.tk.call('bindtags', self._w, tagList)

    def _bind(self, what, sequence, func, add, needcleanup=1):
        """Internal function."""
        if isinstance(func, str):
            self.tk.call(what + (sequence, func))
        elif func:
            funcid = self._register(func, self._substitute,
                        needcleanup)
            cmd = ('%sif {"[%s %s]" == "break"} break\n'
                   %
                   (add and '+' or '',
                funcid, self._subst_format_str))
            self.tk.call(what + (sequence, cmd))
            return funcid
        elif sequence:
            return self.tk.call(what + (sequence,))
        else:
            return self.tk.splitlist(self.tk.call(what))

    def bind(self, sequence=None, func=None, add=None):
        """Bind to this widget at event SEQUENCE a call to function FUNC.

        SEQUENCE is a string of concatenated event
        patterns. An event pattern is of the form
        <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
        of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
        Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
        B3, Alt, Button4, B4, Double, Button5, B5 Triple,
        Mod1, M1. TYPE is one of Activate, Enter, Map,
        ButtonPress, Button, Expose, Motion, ButtonRelease
        FocusIn, MouseWheel, Circulate, FocusOut, Property,
        Colormap, Gravity Reparent, Configure, KeyPress, Key,
        Unmap, Deactivate, KeyRelease Visibility, Destroy,
        Leave and DETAIL is the button number for ButtonPress,
        ButtonRelease and DETAIL is the Keysym for KeyPress and
        KeyRelease. Examples are
        <Control-Button-1> for pressing Control and mouse button 1 or
        <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
        An event pattern can also be a virtual event of the form
        <<AString>> where AString can be arbitrary. This
        event can be generated by event_generate.
        If events are concatenated they must appear shortly
        after each other.

        FUNC will be called if the event sequence occurs with an
        instance of Event as argument. If the return value of FUNC is
        "break" no further bound function is invoked.

        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function.

        Bind will return an identifier to allow deletion of the bound function with
        unbind without memory leak.

        If FUNC or SEQUENCE is omitted the bound function or list
        of bound events are returned."""

        return self._bind(('bind', self._w), sequence, func, add)

    def unbind(self, sequence, funcid=None):
        """Unbind for this widget the event SEQUENCE.

        If FUNCID is given, only unbind the function identified with FUNCID
        and also delete the corresponding Tcl command.

        Otherwise destroy the current binding for SEQUENCE, leaving SEQUENCE
        unbound.
        """
        self._unbind(('bind', self._w, sequence), funcid)

    def _unbind(self, what, funcid=None):
        if funcid is None:
            self.tk.call(*what, '')
        else:
            lines = self.tk.call(what).split('\n')
            prefix = f'if {{"[{funcid} '
            keep = '\n'.join(line for line in lines
                             if not line.startswith(prefix))
            if not keep.strip():
                keep = ''
            self.tk.call(*what, keep)
            self.deletecommand(funcid)

    def bind_all(self, sequence=None, func=None, add=None):
        """Bind to all widgets at an event SEQUENCE a call to function FUNC.
        An additional boolean parameter ADD specifies whether FUNC will
        be called additionally to the other bound function or whether
        it will replace the previous function. See bind for the return value."""
        return self._root()._bind(('bind', 'all'), sequence, func, add, True)

    def unbind_all(self, sequence):
        """Unbind for all widgets for event SEQUENCE all functions."""
        self._root()._unbind(('bind', 'all', sequence))

    def bind_class(self, className, sequence=None, func=None, add=None):
        """Bind to widgets with bindtag CLASSNAME at event
        SEQUENCE a call of function FUNC. An additional
        boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or
        whether it will replace the previous function. See bind for
        the return value."""

        return self._root()._bind(('bind', className), sequence, func, add, True)

    def unbind_class(self, className, sequence):
        """Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE
        all functions."""
        self._root()._unbind(('bind', className, sequence))

    def mainloop(self, n=0):
        """Call the mainloop of Tk."""
        self.tk.mainloop(n)

    def quit(self):
        """Quit the Tcl interpreter. All widgets will be destroyed."""
        self.tk.quit()

    def _getints(self, string):
        """Internal function."""
        if string:
            return tuple(map(self.tk.getint, self.tk.splitlist(string)))

    def _getdoubles(self, string):
        """Internal function."""
        if string:
            return tuple(map(self.tk.getdouble, self.tk.splitlist(string)))

    def _getboolean(self, string):
        """Internal function."""
        if string:
            return self.tk.getboolean(string)

    def _displayof(self, displayof):
        """Internal function."""
        if displayof:
            return ('-displayof', displayof)
        if displayof is None:
            return ('-displayof', self._w)
        return ()

    @property
    def _windowingsystem(self):
        """Internal function."""
        try:
            return self._root()._windowingsystem_cached
        except AttributeError:
            ws = self._root()._windowingsystem_cached = \
                        self.tk.call('tk', 'windowingsystem')
            return ws

    def _options(self, cnf, kw = None):
        """Internal function."""
        if kw:
            cnf = _cnfmerge((cnf, kw))
        else:
            cnf = _cnfmerge(cnf)
        res = ()
        for k, v in cnf.items():
            if v is not None:
                if k[-1] == '_': k = k[:-1]
                if callable(v):
                    v = self._register(v)
                elif isinstance(v, (tuple, list)):
                    nv = []
                    for item in v:
                        if isinstance(item, int):
                            nv.append(str(item))
                        elif isinstance(item, str):
                            nv.append(_stringify(item))
                        else:
                            break
                    else:
                        v = ' '.join(nv)
                res = res + ('-'+k, v)
        return res

    def nametowidget(self, name):
        """Return the Tkinter instance of a widget identified by
        its Tcl name NAME."""
        name = str(name).split('.')
        w = self

        if not name[0]:
            w = w._root()
            name = name[1:]

        for n in name:
            if not n:
                break
            w = w.children[n]

        return w

    _nametowidget = nametowidget

    def _register(self, func, subst=None, needcleanup=1):
        """Return a newly created Tcl function. If this
        function is called, the Python function FUNC will
        be executed. An optional function SUBST can
        be given which will be executed before FUNC."""
        f = CallWrapper(func, subst, self).__call__
        name = repr(id(f))
        try:
            func = func.__func__
        except AttributeError:
            pass
        try:
            name = name + func.__name__
        except AttributeError:
            pass
        self.tk.createcommand(name, f)
        if needcleanup:
            if self._tclCommands is None:
                self._tclCommands = []
            self._tclCommands.append(name)
        return name

    register = _register

    def _root(self):
        """Internal function."""
        w = self
        while w.master is not None: w = w.master
        return w
    _subst_format = ('%#', '%b', '%f', '%h', '%k',
             '%s', '%t', '%w', '%x', '%y',
             '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y', '%D')
    _subst_format_str = " ".join(_subst_format)

    def _substitute(self, *args):
        """Internal function."""
        if len(args) != len(self._subst_format): return args
        getboolean = self.tk.getboolean

        getint = self.tk.getint
        def getint_event(s):
            """Tk changed behavior in 8.4.2, returning "??" rather more often."""
            try:
                return getint(s)
            except (ValueError, TclError):
                return s

        nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args
        # Missing: (a, c, d, m, o, v, B, R)
        e = Event()
        # serial field: valid for all events
        # number of button: ButtonPress and ButtonRelease events only
        # height field: Configure, ConfigureRequest, Create,
        # ResizeRequest, and Expose events only
        # keycode field: KeyPress and KeyRelease events only
        # time field: "valid for events that contain a time field"
        # width field: Configure, ConfigureRequest, Create, ResizeRequest,
        # and Expose events only
        # x field: "valid for events that contain an x field"
        # y field: "valid for events that contain a y field"
        # keysym as decimal: KeyPress and KeyRelease events only
        # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress,
        # KeyRelease, and Motion events
        e.serial = getint(nsign)
        e.num = getint_event(b)
        try: e.focus = getboolean(f)
        except TclError: pass
        e.height = getint_event(h)
        e.keycode = getint_event(k)
        e.state = getint_event(s)
        e.time = getint_event(t)
        e.width = getint_event(w)
        e.x = getint_event(x)
        e.y = getint_event(y)
        e.char = A
        try: e.send_event = getboolean(E)
        except TclError: pass
        e.keysym = K
        e.keysym_num = getint_event(N)
        try:
            e.type = EventType(T)
        except ValueError:
            e.type = T
        try:
            e.widget = self._nametowidget(W)
        except KeyError:
            e.widget = W
        e.x_root = getint_event(X)
        e.y_root = getint_event(Y)
        try:
            e.delta = getint(D)
        except (ValueError, TclError):
            e.delta = 0
        return (e,)

    def _report_exception(self):
        """Internal function."""
        exc, val, tb = sys.exc_info()
        root = self._root()
        root.report_callback_exception(exc, val, tb)

    def _getconfigure(self, *args):
        """Call Tcl configure command and return the result as a dict."""
        cnf = {}
        for x in self.tk.splitlist(self.tk.call(*args)):
            x = self.tk.splitlist(x)
            cnf[x[0][1:]] = (x[0][1:],) + x[1:]
        return cnf

    def _getconfigure1(self, *args):
        x = self.tk.splitlist(self.tk.call(*args))
        return (x[0][1:],) + x[1:]

    def _configure(self, cmd, cnf, kw):
        """Internal function."""
        if kw:
            cnf = _cnfmerge((cnf, kw))
        elif cnf:
            cnf = _cnfmerge(cnf)
        if cnf is None:
            return self._getconfigure(_flatten((self._w, cmd)))
        if isinstance(cnf, str):
            return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf)))
        self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
    # These used to be defined in Widget:

    def configure(self, cnf=None, **kw):
        """Configure resources of a widget.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method keys.
        """
        return self._configure('configure', cnf, kw)

    config = configure

    def cget(self, key):
        """Return the resource value for a KEY given as string."""
        return self.tk.call(self._w, 'cget', '-' + key)

    __getitem__ = cget

    def __setitem__(self, key, value):
        self.configure({key: value})

    def keys(self):
        """Return a list of all resource names of this widget."""
        splitlist = self.tk.splitlist
        return [splitlist(x)[0][1:] for x in
                splitlist(self.tk.call(self._w, 'configure'))]

    def __str__(self):
        """Return the window path name of this widget."""
        return self._w

    def __repr__(self):
        return '<%s.%s object %s>' % (
            self.__class__.__module__, self.__class__.__qualname__, self._w)

    # Pack methods that apply to the master
    _noarg_ = ['_noarg_']

    def pack_propagate(self, flag=_noarg_):
        """Set or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given the current setting will be returned.
        """
        if flag is Misc._noarg_:
            return self._getboolean(self.tk.call(
                'pack', 'propagate', self._w))
        else:
            self.tk.call('pack', 'propagate', self._w, flag)

    propagate = pack_propagate

    def pack_slaves(self):
        """Return a list of all slaves of this widget
        in its packing order."""
        return [self._nametowidget(x) for x in
                self.tk.splitlist(
                   self.tk.call('pack', 'slaves', self._w))]

    slaves = pack_slaves

    # Place method that applies to the master
    def place_slaves(self):
        """Return a list of all slaves of this widget
        in its packing order."""
        return [self._nametowidget(x) for x in
                self.tk.splitlist(
                   self.tk.call(
                       'place', 'slaves', self._w))]

    # Grid methods that apply to the master

    def grid_anchor(self, anchor=None): # new in Tk 8.5
        """The anchor value controls how to place the grid within the
        master when no row/column has any weight.

        The default anchor is nw."""
        self.tk.call('grid', 'anchor', self._w, anchor)

    anchor = grid_anchor

    def grid_bbox(self, column=None, row=None, col2=None, row2=None):
        """Return a tuple of integer coordinates for the bounding
        box of this widget controlled by the geometry manager grid.

        If COLUMN, ROW is given the bounding box applies from
        the cell with row and column 0 to the specified
        cell. If COL2 and ROW2 are given the bounding box
        starts at that cell.

        The returned integers specify the offset of the upper left
        corner in the master widget and the width and height.
        """
        args = ('grid', 'bbox', self._w)
        if column is not None and row is not None:
            args = args + (column, row)
        if col2 is not None and row2 is not None:
            args = args + (col2, row2)
        return self._getints(self.tk.call(*args)) or None

    bbox = grid_bbox

    def _gridconvvalue(self, value):
        if isinstance(value, (str, _tkinter.Tcl_Obj)):
            try:
                svalue = str(value)
                if not svalue:
                    return None
                elif '.' in svalue:
                    return self.tk.getdouble(svalue)
                else:
                    return self.tk.getint(svalue)
            except (ValueError, TclError):
                pass
        return value

    def _grid_configure(self, command, index, cnf, kw):
        """Internal function."""
        if isinstance(cnf, str) and not kw:
            if cnf[-1:] == '_':
                cnf = cnf[:-1]
            if cnf[:1] != '-':
                cnf = '-'+cnf
            options = (cnf,)
        else:
            options = self._options(cnf, kw)
        if not options:
            return _splitdict(
                self.tk,
                self.tk.call('grid', command, self._w, index),
                conv=self._gridconvvalue)
        res = self.tk.call(
                  ('grid', command, self._w, index)
                  + options)
        if len(options) == 1:
            return self._gridconvvalue(res)

    def grid_columnconfigure(self, index, cnf={}, **kw):
        """Configure column INDEX of a grid.

        Valid resources are minsize (minimum size of the column),
        weight (how much does additional space propagate to this column)
        and pad (how much space to let additionally)."""
        return self._grid_configure('columnconfigure', index, cnf, kw)

    columnconfigure = grid_columnconfigure

    def grid_location(self, x, y):
        """Return a tuple of column and row which identify the cell
        at which the pixel at position X and Y inside the master
        widget is located."""
        return self._getints(
            self.tk.call(
                'grid', 'location', self._w, x, y)) or None

    def grid_propagate(self, flag=_noarg_):
        """Set or get the status for propagation of geometry information.

        A boolean argument specifies whether the geometry information
        of the slaves will determine the size of this widget. If no argument
        is given, the current setting will be returned.
        """
        if flag is Misc._noarg_:
            return self._getboolean(self.tk.call(
                'grid', 'propagate', self._w))
        else:
            self.tk.call('grid', 'propagate', self._w, flag)

    def grid_rowconfigure(self, index, cnf={}, **kw):
        """Configure row INDEX of a grid.

        Valid resources are minsize (minimum size of the row),
        weight (how much does additional space propagate to this row)
        and pad (how much space to let additionally)."""
        return self._grid_configure('rowconfigure', index, cnf, kw)

    rowconfigure = grid_rowconfigure

    def grid_size(self):
        """Return a tuple of the number of column and rows in the grid."""
        return self._getints(
            self.tk.call('grid', 'size', self._w)) or None

    size = grid_size

    def grid_slaves(self, row=None, column=None):
        """Return a list of all slaves of this widget
        in its packing order."""
        args = ()
        if row is not None:
            args = args + ('-row', row)
        if column is not None:
            args = args + ('-column', column)
        return [self._nametowidget(x) for x in
                self.tk.splitlist(self.tk.call(
                   ('grid', 'slaves', self._w) + args))]

    # Support for the "event" command, new in Tk 4.2.
    # By Case Roole.

    def event_add(self, virtual, *sequences):
        """Bind a virtual event VIRTUAL (of the form <<Name>>)
        to an event SEQUENCE such that the virtual event is triggered
        whenever SEQUENCE occurs."""
        args = ('event', 'add', virtual) + sequences
        self.tk.call(args)

    def event_delete(self, virtual, *sequences):
        """Unbind a virtual event VIRTUAL from SEQUENCE."""
        args = ('event', 'delete', virtual) + sequences
        self.tk.call(args)

    def event_generate(self, sequence, **kw):
        """Generate an event SEQUENCE. Additional
        keyword arguments specify parameter of the event
        (e.g. x, y, rootx, rooty)."""
        args = ('event', 'generate', self._w, sequence)
        for k, v in kw.items():
            args = args + ('-%s' % k, str(v))
        self.tk.call(args)

    def event_info(self, virtual=None):
        """Return a list of all virtual events or the information
        about the SEQUENCE bound to the virtual event VIRTUAL."""
        return self.tk.splitlist(
            self.tk.call('event', 'info', virtual))

    # Image related commands

    def image_names(self):
        """Return a list of all existing image names."""
        return self.tk.splitlist(self.tk.call('image', 'names'))

    def image_types(self):
        """Return a list of all available image types (e.g. photo bitmap)."""
        return self.tk.splitlist(self.tk.call('image', 'types'))


class CallWrapper:
    """Internal class. Stores function to call when some user
    defined Tcl function is called e.g. after an event occurred."""

    def __init__(self, func, subst, widget):
        """Store FUNC, SUBST and WIDGET as members."""
        self.func = func
        self.subst = subst
        self.widget = widget

    def __call__(self, *args):
        """Apply first function SUBST to arguments, than FUNC."""
        try:
            if self.subst:
                args = self.subst(*args)
            return self.func(*args)
        except SystemExit:
            raise
        except:
            self.widget._report_exception()


class XView:
    """Mix-in class for querying and changing the horizontal position
    of a widget's window."""

    def xview(self, *args):
        """Query and change the horizontal position of the view."""
        res = self.tk.call(self._w, 'xview', *args)
        if not args:
            return self._getdoubles(res)

    def xview_moveto(self, fraction):
        """Adjusts the view in the window so that FRACTION of the
        total width of the canvas is off-screen to the left."""
        self.tk.call(self._w, 'xview', 'moveto', fraction)

    def xview_scroll(self, number, what):
        """Shift the x-view according to NUMBER which is measured in "units"
        or "pages" (WHAT)."""
        self.tk.call(self._w, 'xview', 'scroll', number, what)


class YView:
    """Mix-in class for querying and changing the vertical position
    of a widget's window."""

    def yview(self, *args):
        """Query and change the vertical position of the view."""
        res = self.tk.call(self._w, 'yview', *args)
        if not args:
            return self._getdoubles(res)

    def yview_moveto(self, fraction):
        """Adjusts the view in the window so that FRACTION of the
        total height of the canvas is off-screen to the top."""
        self.tk.call(self._w, 'yview', 'moveto', fraction)

    def yview_scroll(self, number, what):
        """Shift the y-view according to NUMBER which is measured in
        "units" or "pages" (WHAT)."""
        self.tk.call(self._w, 'yview', 'scroll', number, what)


class Wm:
    """Provides functions for the communication with the window manager."""

    def wm_aspect(self,
              minNumer=None, minDenom=None,
              maxNumer=None, maxDenom=None):
        """Instruct the window manager to set the aspect ratio (width/height)
        of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
        of the actual values if no argument is given."""
        return self._getints(
            self.tk.call('wm', 'aspect', self._w,
                     minNumer, minDenom,
                     maxNumer, maxDenom))

    aspect = wm_aspect

    def wm_attributes(self, *args):
        """This subcommand returns or sets platform specific attributes

        The first form returns a list of the platform specific flags and
        their values. The second form returns the value for the specific
        option. The third form sets one or more of the values. The values
        are as follows:

        On Windows, -disabled gets or sets whether the window is in a
        disabled state. -toolwindow gets or sets the style of the window
        to toolwindow (as defined in the MSDN). -topmost gets or sets
        whether this is a topmost window (displays above all other
        windows).

        On Macintosh, XXXXX

        On Unix, there are currently no special attribute values.
        """
        args = ('wm', 'attributes', self._w) + args
        return self.tk.call(args)

    attributes = wm_attributes

    def wm_client(self, name=None):
        """Store NAME in WM_CLIENT_MACHINE property of this widget. Return
        current value."""
        return self.tk.call('wm', 'client', self._w, name)

    client = wm_client

    def wm_colormapwindows(self, *wlist):
        """Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
        of this widget. This list contains windows whose colormaps differ from their
        parents. Return current list of widgets if WLIST is empty."""
        if len(wlist) > 1:
            wlist = (wlist,) # Tk needs a list of windows here
        args = ('wm', 'colormapwindows', self._w) + wlist
        if wlist:
            self.tk.call(args)
        else:
            return [self._nametowidget(x)
                    for x in self.tk.splitlist(self.tk.call(args))]

    colormapwindows = wm_colormapwindows

    def wm_command(self, value=None):
        """Store VALUE in WM_COMMAND property. It is the command
        which shall be used to invoke the application. Return current
        command if VALUE is None."""
        return self.tk.call('wm', 'command', self._w, value)

    command = wm_command

    def wm_deiconify(self):
        """Deiconify this widget. If it was never mapped it will not be mapped.
        On Windows it will raise this widget and give it the focus."""
        return self.tk.call('wm', 'deiconify', self._w)

    deiconify = wm_deiconify

    def wm_focusmodel(self, model=None):
        """Set focus model to MODEL. "active" means that this widget will claim
        the focus itself, "passive" means that the window manager shall give
        the focus. Return current focus model if MODEL is None."""
        return self.tk.call('wm', 'focusmodel', self._w, model)

    focusmodel = wm_focusmodel

    def wm_forget(self, window): # new in Tk 8.5
        """The window will be unmapped from the screen and will no longer
        be managed by wm. toplevel windows will be treated like frame
        windows once they are no longer managed by wm, however, the menu
        option configuration will be remembered and the menus will return
        once the widget is managed again."""
        self.tk.call('wm', 'forget', window)

    forget = wm_forget

    def wm_frame(self):
        """Return identifier for decorative frame of this widget if present."""
        return self.tk.call('wm', 'frame', self._w)

    frame = wm_frame

    def wm_geometry(self, newGeometry=None):
        """Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
        current value if None is given."""
        return self.tk.call('wm', 'geometry', self._w, newGeometry)

    geometry = wm_geometry

    def wm_grid(self,
         baseWidth=None, baseHeight=None,
         widthInc=None, heightInc=None):
        """Instruct the window manager that this widget shall only be
        resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
        height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
        number of grid units requested in Tk_GeometryRequest."""
        return self._getints(self.tk.call(
            'wm', 'grid', self._w,
            baseWidth, baseHeight, widthInc, heightInc))

    grid = wm_grid

    def wm_group(self, pathName=None):
        """Set the group leader widgets for related widgets to PATHNAME. Return
        the group leader of this widget if None is given."""
        return self.tk.call('wm', 'group', self._w, pathName)

    group = wm_group

    def wm_iconbitmap(self, bitmap=None, default=None):
        """Set bitmap for the iconified widget to BITMAP. Return
        the bitmap if None is given.

        Under Windows, the DEFAULT parameter can be used to set the icon
        for the widget and any descendants that don't have an icon set
        explicitly.  DEFAULT can be the relative path to a .ico file
        (example: root.iconbitmap(default='myicon.ico') ).  See Tk
        documentation for more information."""
        if default is not None:
            return self.tk.call('wm', 'iconbitmap', self._w, '-default', default)
        else:
            return self.tk.call('wm', 'iconbitmap', self._w, bitmap)

    iconbitmap = wm_iconbitmap

    def wm_iconify(self):
        """Display widget as icon."""
        return self.tk.call('wm', 'iconify', self._w)

    iconify = wm_iconify

    def wm_iconmask(self, bitmap=None):
        """Set mask for the icon bitmap of this widget. Return the
        mask if None is given."""
        return self.tk.call('wm', 'iconmask', self._w, bitmap)

    iconmask = wm_iconmask

    def wm_iconname(self, newName=None):
        """Set the name of the icon for this widget. Return the name if
        None is given."""
        return self.tk.call('wm', 'iconname', self._w, newName)

    iconname = wm_iconname

    def wm_iconphoto(self, default=False, *args): # new in Tk 8.5
        """Sets the titlebar icon for this window based on the named photo
        images passed through args. If default is True, this is applied to
        all future created toplevels as well.

        The data in the images is taken as a snapshot at the time of
        invocation. If the images are later changed, this is not reflected
        to the titlebar icons. Multiple images are accepted to allow
        different images sizes to be provided. The window manager may scale
        provided icons to an appropriate size.

        On Windows, the images are packed into a Windows icon structure.
        This will override an icon specified to wm_iconbitmap, and vice
        versa.

        On X, the images are arranged into the _NET_WM_ICON X property,
        which most modern window managers support. An icon specified by
        wm_iconbitmap may exist simultaneously.

        On Macintosh, this currently does nothing."""
        if default:
            self.tk.call('wm', 'iconphoto', self._w, "-default", *args)
        else:
            self.tk.call('wm', 'iconphoto', self._w, *args)

    iconphoto = wm_iconphoto

    def wm_iconposition(self, x=None, y=None):
        """Set the position of the icon of this widget to X and Y. Return
        a tuple of the current values of X and X if None is given."""
        return self._getints(self.tk.call(
            'wm', 'iconposition', self._w, x, y))

    iconposition = wm_iconposition

    def wm_iconwindow(self, pathName=None):
        """Set widget PATHNAME to be displayed instead of icon. Return the current
        value if None is given."""
        return self.tk.call('wm', 'iconwindow', self._w, pathName)

    iconwindow = wm_iconwindow

    def wm_manage(self, widget): # new in Tk 8.5
        """The widget specified will become a stand alone top-level window.
        The window will be decorated with the window managers title bar,
        etc."""
        self.tk.call('wm', 'manage', widget)

    manage = wm_manage

    def wm_maxsize(self, width=None, height=None):
        """Set max WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given."""
        return self._getints(self.tk.call(
            'wm', 'maxsize', self._w, width, height))

    maxsize = wm_maxsize

    def wm_minsize(self, width=None, height=None):
        """Set min WIDTH and HEIGHT for this widget. If the window is gridded
        the values are given in grid units. Return the current values if None
        is given."""
        return self._getints(self.tk.call(
            'wm', 'minsize', self._w, width, height))

    minsize = wm_minsize

    def wm_overrideredirect(self, boolean=None):
        """Instruct the window manager to ignore this widget
        if BOOLEAN is given with 1. Return the current value if None
        is given."""
        return self._getboolean(self.tk.call(
            'wm', 'overrideredirect', self._w, boolean))

    overrideredirect = wm_overrideredirect

    def wm_positionfrom(self, who=None):
        """Instruct the window manager that the position of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program"."""
        return self.tk.call('wm', 'positionfrom', self._w, who)

    positionfrom = wm_positionfrom

    def wm_protocol(self, name=None, func=None):
        """Bind function FUNC to command NAME for this widget.
        Return the function bound to NAME if None is given. NAME could be
        e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW"."""
        if callable(func):
            command = self._register(func)
        else:
            command = func
        return self.tk.call(
            'wm', 'protocol', self._w, name, command)

    protocol = wm_protocol

    def wm_resizable(self, width=None, height=None):
        """Instruct the window manager whether this width can be resized
        in WIDTH or HEIGHT. Both values are boolean values."""
        return self.tk.call('wm', 'resizable', self._w, width, height)

    resizable = wm_resizable

    def wm_sizefrom(self, who=None):
        """Instruct the window manager that the size of this widget shall
        be defined by the user if WHO is "user", and by its own policy if WHO is
        "program"."""
        return self.tk.call('wm', 'sizefrom', self._w, who)

    sizefrom = wm_sizefrom

    def wm_state(self, newstate=None):
        """Query or set the state of this widget as one of normal, icon,
        iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only)."""
        return self.tk.call('wm', 'state', self._w, newstate)

    state = wm_state

    def wm_title(self, string=None):
        """Set the title of this widget."""
        return self.tk.call('wm', 'title', self._w, string)

    title = wm_title

    def wm_transient(self, master=None):
        """Instruct the window manager that this widget is transient
        with regard to widget MASTER."""
        return self.tk.call('wm', 'transient', self._w, master)

    transient = wm_transient

    def wm_withdraw(self):
        """Withdraw this widget from the screen such that it is unmapped
        and forgotten by the window manager. Re-draw it with wm_deiconify."""
        return self.tk.call('wm', 'withdraw', self._w)

    withdraw = wm_withdraw


class Tk(Misc, Wm):
    """Toplevel widget of Tk which represents mostly the main window
    of an application. It has an associated Tcl interpreter."""
    _w = '.'

    def __init__(self, screenName=None, baseName=None, className='Tk',
                 useTk=True, sync=False, use=None):
        """Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will
        be created. BASENAME will be used for the identification of the profile file (see
        readprofile).
        It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
        is the name of the widget class."""
        self.master = None
        self.children = {}
        self._tkloaded = False
        # to avoid recursions in the getattr code in case of failure, we
        # ensure that self.tk is always _something_.
        self.tk = None
        if baseName is None:
            import os
            baseName = os.path.basename(sys.argv[0])
            baseName, ext = os.path.splitext(baseName)
            if ext not in ('.py', '.pyc'):
                baseName = baseName + ext
        interactive = False
        self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
        if _debug:
            self.tk.settrace(_print_command)
        if useTk:
            self._loadtk()
        if not sys.flags.ignore_environment:
            # Issue #16248: Honor the -E flag to avoid code injection.
            self.readprofile(baseName, className)

    def loadtk(self):
        if not self._tkloaded:
            self.tk.loadtk()
            self._loadtk()

    def _loadtk(self):
        self._tkloaded = True
        global _default_root
        # Version sanity checks
        tk_version = self.tk.getvar('tk_version')
        if tk_version != _tkinter.TK_VERSION:
            raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
                               % (_tkinter.TK_VERSION, tk_version))
        # Under unknown circumstances, tcl_version gets coerced to float
        tcl_version = str(self.tk.getvar('tcl_version'))
        if tcl_version != _tkinter.TCL_VERSION:
            raise RuntimeError("tcl.h version (%s) doesn't match libtcl.a version (%s)" \
                               % (_tkinter.TCL_VERSION, tcl_version))
        # Create and register the tkerror and exit commands
        # We need to inline parts of _register here, _ register
        # would register differently-named commands.
        if self._tclCommands is None:
            self._tclCommands = []
        self.tk.createcommand('tkerror', _tkerror)
        self.tk.createcommand('exit', _exit)
        self._tclCommands.append('tkerror')
        self._tclCommands.append('exit')
        if _support_default_root and _default_root is None:
            _default_root = self
        self.protocol("WM_DELETE_WINDOW", self.destroy)

    def destroy(self):
        """Destroy this and all descendants widgets. This will
        end the application of this Tcl interpreter."""
        for c in list(self.children.values()): c.destroy()
        self.tk.call('destroy', self._w)
        Misc.destroy(self)
        global _default_root
        if _support_default_root and _default_root is self:
            _default_root = None

    def readprofile(self, baseName, className):
        """Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into
        the Tcl Interpreter and calls exec on the contents of .BASENAME.py and
        .CLASSNAME.py if such a file exists in the home directory."""
        import os
        if 'HOME' in os.environ: home = os.environ['HOME']
        else: home = os.curdir
        class_tcl = os.path.join(home, '.%s.tcl' % className)
        class_py = os.path.join(home, '.%s.py' % className)
        base_tcl = os.path.join(home, '.%s.tcl' % baseName)
        base_py = os.path.join(home, '.%s.py' % baseName)
        dir = {'self': self}
        exec('from tkinter import *', dir)
        if os.path.isfile(class_tcl):
            self.tk.call('source', class_tcl)
        if os.path.isfile(class_py):
            exec(open(class_py).read(), dir)
        if os.path.isfile(base_tcl):
            self.tk.call('source', base_tcl)
        if os.path.isfile(base_py):
            exec(open(base_py).read(), dir)

    def report_callback_exception(self, exc, val, tb):
        """Report callback exception on sys.stderr.

        Applications may want to override this internal function, and
        should when sys.stderr is None."""
        import traceback
        print("Exception in Tkinter callback", file=sys.stderr)
        sys.last_exc = val
        sys.last_type = exc
        sys.last_value = val
        sys.last_traceback = tb
        traceback.print_exception(exc, val, tb)

    def __getattr__(self, attr):
        "Delegate attribute access to the interpreter object"
        return getattr(self.tk, attr)


def _print_command(cmd, *, file=sys.stderr):
    # Print executed Tcl/Tk commands.
    assert isinstance(cmd, tuple)
    cmd = _join(cmd)
    print(cmd, file=file)


# Ideally, the classes Pack, Place and Grid disappear, the
# pack/place/grid methods are defined on the Widget class, and
# everybody uses w.pack_whatever(...) instead of Pack.whatever(w,
# ...), with pack(), place() and grid() being short for
# pack_configure(), place_configure() and grid_columnconfigure(), and
# forget() being short for pack_forget().  As a practical matter, I'm
# afraid that there is too much code out there that may be using the
# Pack, Place or Grid class, so I leave them intact -- but only as
# backwards compatibility features.  Also note that those methods that
# take a master as argument (e.g. pack_propagate) have been moved to
# the Misc class (which now incorporates all methods common between
# toplevel and interior widgets).  Again, for compatibility, these are
# copied into the Pack, Place or Grid class.


def Tcl(screenName=None, baseName=None, className='Tk', useTk=False):
    return Tk(screenName, baseName, className, useTk)


class Pack:
    """Geometry manager Pack.

    Base class to use the methods pack_* in every widget."""

    def pack_configure(self, cnf={}, **kw):
        """Pack a widget in the parent widget. Use as options:
        after=widget - pack it after you have packed widget
        anchor=NSEW (or subset) - position widget according to
                                  given direction
        before=widget - pack it before you will pack widget
        expand=bool - expand widget if parent size grows
        fill=NONE or X or Y or BOTH - fill widget if widget grows
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.
        """
        self.tk.call(
              ('pack', 'configure', self._w)
              + self._options(cnf, kw))

    pack = configure = config = pack_configure

    def pack_forget(self):
        """Unmap this widget and do not use it for the packing order."""
        self.tk.call('pack', 'forget', self._w)

    forget = pack_forget

    def pack_info(self):
        """Return information about the packing options
        for this widget."""
        d = _splitdict(self.tk, self.tk.call('pack', 'info', self._w))
        if 'in' in d:
            d['in'] = self.nametowidget(d['in'])
        return d

    info = pack_info
    propagate = pack_propagate = Misc.pack_propagate
    slaves = pack_slaves = Misc.pack_slaves


class Place:
    """Geometry manager Place.

    Base class to use the methods place_* in every widget."""

    def place_configure(self, cnf={}, **kw):
        """Place a widget in the parent widget. Use as options:
        in=master - master relative to which the widget is placed
        in_=master - see 'in' option description
        x=amount - locate anchor of this widget at position x of master
        y=amount - locate anchor of this widget at position y of master
        relx=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to width of master (1.0 is right edge)
        rely=amount - locate anchor of this widget between 0.0 and 1.0
                      relative to height of master (1.0 is bottom edge)
        anchor=NSEW (or subset) - position anchor according to given direction
        width=amount - width of this widget in pixel
        height=amount - height of this widget in pixel
        relwidth=amount - width of this widget between 0.0 and 1.0
                          relative to width of master (1.0 is the same width
                          as the master)
        relheight=amount - height of this widget between 0.0 and 1.0
                           relative to height of master (1.0 is the same
                           height as the master)
        bordermode="inside" or "outside" - whether to take border width of
                                           master widget into account
        """
        self.tk.call(
              ('place', 'configure', self._w)
              + self._options(cnf, kw))

    place = configure = config = place_configure

    def place_forget(self):
        """Unmap this widget."""
        self.tk.call('place', 'forget', self._w)

    forget = place_forget

    def place_info(self):
        """Return information about the placing options
        for this widget."""
        d = _splitdict(self.tk, self.tk.call('place', 'info', self._w))
        if 'in' in d:
            d['in'] = self.nametowidget(d['in'])
        return d

    info = place_info
    slaves = place_slaves = Misc.place_slaves


class Grid:
    """Geometry manager Grid.

    Base class to use the methods grid_* in every widget."""
    # Thanks to Masazumi Yoshikawa (yosikawa@isi.edu)

    def grid_configure(self, cnf={}, **kw):
        """Position a widget in the parent widget in a grid. Use as options:
        column=number - use cell identified with given column (starting with 0)
        columnspan=number - this widget will span several columns
        in=master - use master to contain this widget
        in_=master - see 'in' option description
        ipadx=amount - add internal padding in x direction
        ipady=amount - add internal padding in y direction
        padx=amount - add padding in x direction
        pady=amount - add padding in y direction
        row=number - use cell identified with given row (starting with 0)
        rowspan=number - this widget will span several rows
        sticky=NSEW - if cell is larger on which sides will this
                      widget stick to the cell boundary
        """
        self.tk.call(
              ('grid', 'configure', self._w)
              + self._options(cnf, kw))

    grid = configure = config = grid_configure
    bbox = grid_bbox = Misc.grid_bbox
    columnconfigure = grid_columnconfigure = Misc.grid_columnconfigure

    def grid_forget(self):
        """Unmap this widget."""
        self.tk.call('grid', 'forget', self._w)

    forget = grid_forget

    def grid_remove(self):
        """Unmap this widget but remember the grid options."""
        self.tk.call('grid', 'remove', self._w)

    def grid_info(self):
        """Return information about the options
        for positioning this widget in a grid."""
        d = _splitdict(self.tk, self.tk.call('grid', 'info', self._w))
        if 'in' in d:
            d['in'] = self.nametowidget(d['in'])
        return d

    info = grid_info
    location = grid_location = Misc.grid_location
    propagate = grid_propagate = Misc.grid_propagate
    rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure
    size = grid_size = Misc.grid_size
    slaves = grid_slaves = Misc.grid_slaves


class BaseWidget(Misc):
    """Internal class."""

    def _setup(self, master, cnf):
        """Internal function. Sets up information about children."""
        if master is None:
            master = _get_default_root()
        self.master = master
        self.tk = master.tk
        name = None
        if 'name' in cnf:
            name = cnf['name']
            del cnf['name']
        if not name:
            name = self.__class__.__name__.lower()
            if name[-1].isdigit():
                name += "!"  # Avoid duplication when calculating names below
            if master._last_child_ids is None:
                master._last_child_ids = {}
            count = master._last_child_ids.get(name, 0) + 1
            master._last_child_ids[name] = count
            if count == 1:
                name = '!%s' % (name,)
            else:
                name = '!%s%d' % (name, count)
        self._name = name
        if master._w=='.':
            self._w = '.' + name
        else:
            self._w = master._w + '.' + name
        self.children = {}
        if self._name in self.master.children:
            self.master.children[self._name].destroy()
        self.master.children[self._name] = self

    def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
        """Construct a widget with the parent widget MASTER, a name WIDGETNAME
        and appropriate options."""
        if kw:
            cnf = _cnfmerge((cnf, kw))
        self.widgetName = widgetName
        self._setup(master, cnf)
        if self._tclCommands is None:
            self._tclCommands = []
        classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)]
        for k, v in classes:
            del cnf[k]
        self.tk.call(
            (widgetName, self._w) + extra + self._options(cnf))
        for k, v in classes:
            k.configure(self, v)

    def destroy(self):
        """Destroy this and all descendants widgets."""
        for c in list(self.children.values()): c.destroy()
        self.tk.call('destroy', self._w)
        if self._name in self.master.children:
            del self.master.children[self._name]
        Misc.destroy(self)

    def _do(self, name, args=()):
        # XXX Obsolete -- better use self.tk.call directly!
        return self.tk.call((self._w, name) + args)


class Widget(BaseWidget, Pack, Place, Grid):
    """Internal class.

    Base class for a widget which can be positioned with the geometry managers
    Pack, Place or Grid."""
    pass


class Toplevel(BaseWidget, Wm):
    """Toplevel widget, e.g. for dialogs."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a toplevel widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, menu, relief, screen, takefocus,
        use, visual, width."""
        if kw:
            cnf = _cnfmerge((cnf, kw))
        extra = ()
        for wmkey in ['screen', 'class_', 'class', 'visual',
                  'colormap']:
            if wmkey in cnf:
                val = cnf[wmkey]
                # TBD: a hack needed because some keys
                # are not valid as keyword arguments
                if wmkey[-1] == '_': opt = '-'+wmkey[:-1]
                else: opt = '-'+wmkey
                extra = extra + (opt, val)
                del cnf[wmkey]
        BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra)
        root = self._root()
        self.iconname(root.iconname())
        self.title(root.title())
        self.protocol("WM_DELETE_WINDOW", self.destroy)


class Button(Widget):
    """Button widget."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a button widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, repeatdelay,
            repeatinterval, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            command, compound, default, height,
            overrelief, state, width
        """
        Widget.__init__(self, master, 'button', cnf, kw)

    def flash(self):
        """Flash the button.

        This is accomplished by redisplaying
        the button several times, alternating between active and
        normal colors. At the end of the flash the button is left
        in the same normal/active state as when the command was
        invoked. This command is ignored if the button's state is
        disabled.
        """
        self.tk.call(self._w, 'flash')

    def invoke(self):
        """Invoke the command associated with the button.

        The return value is the return value from the command,
        or an empty string if there is no command associated with
        the button. This command is ignored if the button's state
        is disabled.
        """
        return self.tk.call(self._w, 'invoke')


class Canvas(Widget, XView, YView):
    """Canvas widget to display graphical elements like lines or text."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a canvas widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, closeenough,
        confine, cursor, height, highlightbackground, highlightcolor,
        highlightthickness, insertbackground, insertborderwidth,
        insertofftime, insertontime, insertwidth, offset, relief,
        scrollregion, selectbackground, selectborderwidth, selectforeground,
        state, takefocus, width, xscrollcommand, xscrollincrement,
        yscrollcommand, yscrollincrement."""
        Widget.__init__(self, master, 'canvas', cnf, kw)

    def addtag(self, *args):
        """Internal function."""
        self.tk.call((self._w, 'addtag') + args)

    def addtag_above(self, newtag, tagOrId):
        """Add tag NEWTAG to all items above TAGORID."""
        self.addtag(newtag, 'above', tagOrId)

    def addtag_all(self, newtag):
        """Add tag NEWTAG to all items."""
        self.addtag(newtag, 'all')

    def addtag_below(self, newtag, tagOrId):
        """Add tag NEWTAG to all items below TAGORID."""
        self.addtag(newtag, 'below', tagOrId)

    def addtag_closest(self, newtag, x, y, halo=None, start=None):
        """Add tag NEWTAG to item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken."""
        self.addtag(newtag, 'closest', x, y, halo, start)

    def addtag_enclosed(self, newtag, x1, y1, x2, y2):
        """Add tag NEWTAG to all items in the rectangle defined
        by X1,Y1,X2,Y2."""
        self.addtag(newtag, 'enclosed', x1, y1, x2, y2)

    def addtag_overlapping(self, newtag, x1, y1, x2, y2):
        """Add tag NEWTAG to all items which overlap the rectangle
        defined by X1,Y1,X2,Y2."""
        self.addtag(newtag, 'overlapping', x1, y1, x2, y2)

    def addtag_withtag(self, newtag, tagOrId):
        """Add tag NEWTAG to all items with TAGORID."""
        self.addtag(newtag, 'withtag', tagOrId)

    def bbox(self, *args):
        """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses all items with tags specified as arguments."""
        return self._getints(
            self.tk.call((self._w, 'bbox') + args)) or None

    def tag_unbind(self, tagOrId, sequence, funcid=None):
        """Unbind for all items with TAGORID for event SEQUENCE  the
        function identified with FUNCID."""
        self._unbind((self._w, 'bind', tagOrId, sequence), funcid)

    def tag_bind(self, tagOrId, sequence=None, func=None, add=None):
        """Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value."""
        return self._bind((self._w, 'bind', tagOrId),
                  sequence, func, add)

    def canvasx(self, screenx, gridspacing=None):
        """Return the canvas x coordinate of pixel position SCREENX rounded
        to nearest multiple of GRIDSPACING units."""
        return self.tk.getdouble(self.tk.call(
            self._w, 'canvasx', screenx, gridspacing))

    def canvasy(self, screeny, gridspacing=None):
        """Return the canvas y coordinate of pixel position SCREENY rounded
        to nearest multiple of GRIDSPACING units."""
        return self.tk.getdouble(self.tk.call(
            self._w, 'canvasy', screeny, gridspacing))

    def coords(self, *args):
        """Return a list of coordinates for the item given in ARGS."""
        args = _flatten(args)
        return [self.tk.getdouble(x) for x in
                           self.tk.splitlist(
                   self.tk.call((self._w, 'coords') + args))]

    def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
        """Internal function."""
        args = _flatten(args)
        cnf = args[-1]
        if isinstance(cnf, (dict, tuple)):
            args = args[:-1]
        else:
            cnf = {}
        return self.tk.getint(self.tk.call(
            self._w, 'create', itemType,
            *(args + self._options(cnf, kw))))

    def create_arc(self, *args, **kw):
        """Create arc shaped region with coordinates x1,y1,x2,y2."""
        return self._create('arc', args, kw)

    def create_bitmap(self, *args, **kw):
        """Create bitmap with coordinates x1,y1."""
        return self._create('bitmap', args, kw)

    def create_image(self, *args, **kw):
        """Create image item with coordinates x1,y1."""
        return self._create('image', args, kw)

    def create_line(self, *args, **kw):
        """Create line with coordinates x1,y1,...,xn,yn."""
        return self._create('line', args, kw)

    def create_oval(self, *args, **kw):
        """Create oval with coordinates x1,y1,x2,y2."""
        return self._create('oval', args, kw)

    def create_polygon(self, *args, **kw):
        """Create polygon with coordinates x1,y1,...,xn,yn."""
        return self._create('polygon', args, kw)

    def create_rectangle(self, *args, **kw):
        """Create rectangle with coordinates x1,y1,x2,y2."""
        return self._create('rectangle', args, kw)

    def create_text(self, *args, **kw):
        """Create text with coordinates x1,y1."""
        return self._create('text', args, kw)

    def create_window(self, *args, **kw):
        """Create window with coordinates x1,y1,x2,y2."""
        return self._create('window', args, kw)

    def dchars(self, *args):
        """Delete characters of text items identified by tag or id in ARGS (possibly
        several times) from FIRST to LAST character (including)."""
        self.tk.call((self._w, 'dchars') + args)

    def delete(self, *args):
        """Delete items identified by all tag or ids contained in ARGS."""
        self.tk.call((self._w, 'delete') + args)

    def dtag(self, *args):
        """Delete tag or id given as last arguments in ARGS from items
        identified by first argument in ARGS."""
        self.tk.call((self._w, 'dtag') + args)

    def find(self, *args):
        """Internal function."""
        return self._getints(
            self.tk.call((self._w, 'find') + args)) or ()

    def find_above(self, tagOrId):
        """Return items above TAGORID."""
        return self.find('above', tagOrId)

    def find_all(self):
        """Return all items."""
        return self.find('all')

    def find_below(self, tagOrId):
        """Return all items below TAGORID."""
        return self.find('below', tagOrId)

    def find_closest(self, x, y, halo=None, start=None):
        """Return item which is closest to pixel at X, Y.
        If several match take the top-most.
        All items closer than HALO are considered overlapping (all are
        closest). If START is specified the next below this tag is taken."""
        return self.find('closest', x, y, halo, start)

    def find_enclosed(self, x1, y1, x2, y2):
        """Return all items in rectangle defined
        by X1,Y1,X2,Y2."""
        return self.find('enclosed', x1, y1, x2, y2)

    def find_overlapping(self, x1, y1, x2, y2):
        """Return all items which overlap the rectangle
        defined by X1,Y1,X2,Y2."""
        return self.find('overlapping', x1, y1, x2, y2)

    def find_withtag(self, tagOrId):
        """Return all items with TAGORID."""
        return self.find('withtag', tagOrId)

    def focus(self, *args):
        """Set focus to the first item specified in ARGS."""
        return self.tk.call((self._w, 'focus') + args)

    def gettags(self, *args):
        """Return tags associated with the first item specified in ARGS."""
        return self.tk.splitlist(
            self.tk.call((self._w, 'gettags') + args))

    def icursor(self, *args):
        """Set cursor at position POS in the item identified by TAGORID.
        In ARGS TAGORID must be first."""
        self.tk.call((self._w, 'icursor') + args)

    def index(self, *args):
        """Return position of cursor as integer in item specified in ARGS."""
        return self.tk.getint(self.tk.call((self._w, 'index') + args))

    def insert(self, *args):
        """Insert TEXT in item TAGORID at position POS. ARGS must
        be TAGORID POS TEXT."""
        self.tk.call((self._w, 'insert') + args)

    def itemcget(self, tagOrId, option):
        """Return the resource value for an OPTION for item TAGORID."""
        return self.tk.call(
            (self._w, 'itemcget') + (tagOrId, '-'+option))

    def itemconfigure(self, tagOrId, cnf=None, **kw):
        """Configure resources of an item TAGORID.

        The values for resources are specified as keyword
        arguments. To get an overview about
        the allowed keyword arguments call the method without arguments.
        """
        return self._configure(('itemconfigure', tagOrId), cnf, kw)

    itemconfig = itemconfigure

    # lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
    # so the preferred name for them is tag_lower, tag_raise
    # (similar to tag_bind, and similar to the Text widget);
    # unfortunately can't delete the old ones yet (maybe in 1.6)
    def tag_lower(self, *args):
        """Lower an item TAGORID given in ARGS
        (optional below another item)."""
        self.tk.call((self._w, 'lower') + args)

    lower = tag_lower

    def move(self, *args):
        """Move an item TAGORID given in ARGS."""
        self.tk.call((self._w, 'move') + args)

    def moveto(self, tagOrId, x='', y=''):
        """Move the items given by TAGORID in the canvas coordinate
        space so that the first coordinate pair of the bottommost
        item with tag TAGORID is located at position (X,Y).
        X and Y may be the empty string, in which case the
        corresponding coordinate will be unchanged. All items matching
        TAGORID remain in the same positions relative to each other."""
        self.tk.call(self._w, 'moveto', tagOrId, x, y)

    def postscript(self, cnf={}, **kw):
        """Print the contents of the canvas to a postscript
        file. Valid options: colormap, colormode, file, fontmap,
        height, pageanchor, pageheight, pagewidth, pagex, pagey,
        rotate, width, x, y."""
        return self.tk.call((self._w, 'postscript') +
                    self._options(cnf, kw))

    def tag_raise(self, *args):
        """Raise an item TAGORID given in ARGS
        (optional above another item)."""
        self.tk.call((self._w, 'raise') + args)

    lift = tkraise = tag_raise

    def scale(self, *args):
        """Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE."""
        self.tk.call((self._w, 'scale') + args)

    def scan_mark(self, x, y):
        """Remember the current X, Y coordinates."""
        self.tk.call(self._w, 'scan', 'mark', x, y)

    def scan_dragto(self, x, y, gain=10):
        """Adjust the view of the canvas to GAIN times the
        difference between X and Y and the coordinates given in
        scan_mark."""
        self.tk.call(self._w, 'scan', 'dragto', x, y, gain)

    def select_adjust(self, tagOrId, index):
        """Adjust the end of the selection near the cursor of an item TAGORID to index."""
        self.tk.call(self._w, 'select', 'adjust', tagOrId, index)

    def select_clear(self):
        """Clear the selection if it is in this widget."""
        self.tk.call(self._w, 'select', 'clear')

    def select_from(self, tagOrId, index):
        """Set the fixed end of a selection in item TAGORID to INDEX."""
        self.tk.call(self._w, 'select', 'from', tagOrId, index)

    def select_item(self):
        """Return the item which has the selection."""
        return self.tk.call(self._w, 'select', 'item') or None

    def select_to(self, tagOrId, index):
        """Set the variable end of a selection in item TAGORID to INDEX."""
        self.tk.call(self._w, 'select', 'to', tagOrId, index)

    def type(self, tagOrId):
        """Return the type of the item TAGORID."""
        return self.tk.call(self._w, 'type', tagOrId) or None


_checkbutton_count = 0

class Checkbutton(Widget):
    """Checkbutton widget which is either in on- or off-state."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a checkbutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, offvalue, onvalue, padx, pady, relief,
        selectcolor, selectimage, state, takefocus, text, textvariable,
        underline, variable, width, wraplength."""
        Widget.__init__(self, master, 'checkbutton', cnf, kw)

    def _setup(self, master, cnf):
        # Because Checkbutton defaults to a variable with the same name as
        # the widget, Checkbutton default names must be globally unique,
        # not just unique within the parent widget.
        if not cnf.get('name'):
            global _checkbutton_count
            name = self.__class__.__name__.lower()
            _checkbutton_count += 1
            # To avoid collisions with ttk.Checkbutton, use the different
            # name template.
            cnf['name'] = f'!{name}-{_checkbutton_count}'
        super()._setup(master, cnf)

    def deselect(self):
        """Put the button in off-state."""
        self.tk.call(self._w, 'deselect')

    def flash(self):
        """Flash the button."""
        self.tk.call(self._w, 'flash')

    def invoke(self):
        """Toggle the button and invoke a command if given as resource."""
        return self.tk.call(self._w, 'invoke')

    def select(self):
        """Put the button in on-state."""
        self.tk.call(self._w, 'select')

    def toggle(self):
        """Toggle the button."""
        self.tk.call(self._w, 'toggle')


class Entry(Widget, XView):
    """Entry widget which allows displaying simple text."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct an entry widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, highlightbackground,
        highlightcolor, highlightthickness, insertbackground,
        insertborderwidth, insertofftime, insertontime, insertwidth,
        invalidcommand, invcmd, justify, relief, selectbackground,
        selectborderwidth, selectforeground, show, state, takefocus,
        textvariable, validate, validatecommand, vcmd, width,
        xscrollcommand."""
        Widget.__init__(self, master, 'entry', cnf, kw)

    def delete(self, first, last=None):
        """Delete text from FIRST to LAST (not included)."""
        self.tk.call(self._w, 'delete', first, last)

    def get(self):
        """Return the text."""
        return self.tk.call(self._w, 'get')

    def icursor(self, index):
        """Insert cursor at INDEX."""
        self.tk.call(self._w, 'icursor', index)

    def index(self, index):
        """Return position of cursor."""
        return self.tk.getint(self.tk.call(
            self._w, 'index', index))

    def insert(self, index, string):
        """Insert STRING at INDEX."""
        self.tk.call(self._w, 'insert', index, string)

    def scan_mark(self, x):
        """Remember the current X, Y coordinates."""
        self.tk.call(self._w, 'scan', 'mark', x)

    def scan_dragto(self, x):
        """Adjust the view of the canvas to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark."""
        self.tk.call(self._w, 'scan', 'dragto', x)

    def selection_adjust(self, index):
        """Adjust the end of the selection near the cursor to INDEX."""
        self.tk.call(self._w, 'selection', 'adjust', index)

    select_adjust = selection_adjust

    def selection_clear(self):
        """Clear the selection if it is in this widget."""
        self.tk.call(self._w, 'selection', 'clear')

    select_clear = selection_clear

    def selection_from(self, index):
        """Set the fixed end of a selection to INDEX."""
        self.tk.call(self._w, 'selection', 'from', index)

    select_from = selection_from

    def selection_present(self):
        """Return True if there are characters selected in the entry, False
        otherwise."""
        return self.tk.getboolean(
            self.tk.call(self._w, 'selection', 'present'))

    select_present = selection_present

    def selection_range(self, start, end):
        """Set the selection from START to END (not included)."""
        self.tk.call(self._w, 'selection', 'range', start, end)

    select_range = selection_range

    def selection_to(self, index):
        """Set the variable end of a selection to INDEX."""
        self.tk.call(self._w, 'selection', 'to', index)

    select_to = selection_to


class Frame(Widget):
    """Frame widget which may contain other widgets and can have a 3D border."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a frame widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, relief, takefocus, visual, width."""
        cnf = _cnfmerge((cnf, kw))
        extra = ()
        if 'class_' in cnf:
            extra = ('-class', cnf['class_'])
            del cnf['class_']
        elif 'class' in cnf:
            extra = ('-class', cnf['class'])
            del cnf['class']
        Widget.__init__(self, master, 'frame', cnf, {}, extra)


class Label(Widget):
    """Label widget which can display text and bitmaps."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a label widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            height, state, width

        """
        Widget.__init__(self, master, 'label', cnf, kw)


class Listbox(Widget, XView, YView):
    """Listbox widget which can display a list of strings."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a listbox widget with the parent MASTER.

        Valid resource names: background, bd, bg, borderwidth, cursor,
        exportselection, fg, font, foreground, height, highlightbackground,
        highlightcolor, highlightthickness, relief, selectbackground,
        selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
        width, xscrollcommand, yscrollcommand, listvariable."""
        Widget.__init__(self, master, 'listbox', cnf, kw)

    def activate(self, index):
        """Activate item identified by INDEX."""
        self.tk.call(self._w, 'activate', index)

    def bbox(self, index):
        """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses the item identified by the given index."""
        return self._getints(self.tk.call(self._w, 'bbox', index)) or None

    def curselection(self):
        """Return the indices of currently selected item."""
        return self._getints(self.tk.call(self._w, 'curselection')) or ()

    def delete(self, first, last=None):
        """Delete items from FIRST to LAST (included)."""
        self.tk.call(self._w, 'delete', first, last)

    def get(self, first, last=None):
        """Get list of items from FIRST to LAST (included)."""
        if last is not None:
            return self.tk.splitlist(self.tk.call(
                self._w, 'get', first, last))
        else:
            return self.tk.call(self._w, 'get', first)

    def index(self, index):
        """Return index of item identified with INDEX."""
        i = self.tk.call(self._w, 'index', index)
        if i == 'none': return None
        return self.tk.getint(i)

    def insert(self, index, *elements):
        """Insert ELEMENTS at INDEX."""
        self.tk.call((self._w, 'insert', index) + elements)

    def nearest(self, y):
        """Get index of item which is nearest to y coordinate Y."""
        return self.tk.getint(self.tk.call(
            self._w, 'nearest', y))

    def scan_mark(self, x, y):
        """Remember the current X, Y coordinates."""
        self.tk.call(self._w, 'scan', 'mark', x, y)

    def scan_dragto(self, x, y):
        """Adjust the view of the listbox to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark."""
        self.tk.call(self._w, 'scan', 'dragto', x, y)

    def see(self, index):
        """Scroll such that INDEX is visible."""
        self.tk.call(self._w, 'see', index)

    def selection_anchor(self, index):
        """Set the fixed end oft the selection to INDEX."""
        self.tk.call(self._w, 'selection', 'anchor', index)

    select_anchor = selection_anchor

    def selection_clear(self, first, last=None):
        """Clear the selection from FIRST to LAST (included)."""
        self.tk.call(self._w,
                 'selection', 'clear', first, last)

    select_clear = selection_clear

    def selection_includes(self, index):
        """Return True if INDEX is part of the selection."""
        return self.tk.getboolean(self.tk.call(
            self._w, 'selection', 'includes', index))

    select_includes = selection_includes

    def selection_set(self, first, last=None):
        """Set the selection from FIRST to LAST (included) without
        changing the currently selected elements."""
        self.tk.call(self._w, 'selection', 'set', first, last)

    select_set = selection_set

    def size(self):
        """Return the number of elements in the listbox."""
        return self.tk.getint(self.tk.call(self._w, 'size'))

    def itemcget(self, index, option):
        """Return the resource value for an ITEM and an OPTION."""
        return self.tk.call(
            (self._w, 'itemcget') + (index, '-'+option))

    def itemconfigure(self, index, cnf=None, **kw):
        """Configure resources of an ITEM.

        The values for resources are specified as keyword arguments.
        To get an overview about the allowed keyword arguments
        call the method without arguments.
        Valid resource names: background, bg, foreground, fg,
        selectbackground, selectforeground."""
        return self._configure(('itemconfigure', index), cnf, kw)

    itemconfig = itemconfigure


class Menu(Widget):
    """Menu widget which allows displaying menu bars, pull-down menus and pop-up menus."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct menu widget with the parent MASTER.

        Valid resource names: activebackground, activeborderwidth,
        activeforeground, background, bd, bg, borderwidth, cursor,
        disabledforeground, fg, font, foreground, postcommand, relief,
        selectcolor, takefocus, tearoff, tearoffcommand, title, type."""
        Widget.__init__(self, master, 'menu', cnf, kw)

    def tk_popup(self, x, y, entry=""):
        """Post the menu at position X,Y with entry ENTRY."""
        self.tk.call('tk_popup', self._w, x, y, entry)

    def activate(self, index):
        """Activate entry at INDEX."""
        self.tk.call(self._w, 'activate', index)

    def add(self, itemType, cnf={}, **kw):
        """Internal function."""
        self.tk.call((self._w, 'add', itemType) +
                 self._options(cnf, kw))

    def add_cascade(self, cnf={}, **kw):
        """Add hierarchical menu item."""
        self.add('cascade', cnf or kw)

    def add_checkbutton(self, cnf={}, **kw):
        """Add checkbutton menu item."""
        self.add('checkbutton', cnf or kw)

    def add_command(self, cnf={}, **kw):
        """Add command menu item."""
        self.add('command', cnf or kw)

    def add_radiobutton(self, cnf={}, **kw):
        """Add radio menu item."""
        self.add('radiobutton', cnf or kw)

    def add_separator(self, cnf={}, **kw):
        """Add separator."""
        self.add('separator', cnf or kw)

    def insert(self, index, itemType, cnf={}, **kw):
        """Internal function."""
        self.tk.call((self._w, 'insert', index, itemType) +
                 self._options(cnf, kw))

    def insert_cascade(self, index, cnf={}, **kw):
        """Add hierarchical menu item at INDEX."""
        self.insert(index, 'cascade', cnf or kw)

    def insert_checkbutton(self, index, cnf={}, **kw):
        """Add checkbutton menu item at INDEX."""
        self.insert(index, 'checkbutton', cnf or kw)

    def insert_command(self, index, cnf={}, **kw):
        """Add command menu item at INDEX."""
        self.insert(index, 'command', cnf or kw)

    def insert_radiobutton(self, index, cnf={}, **kw):
        """Add radio menu item at INDEX."""
        self.insert(index, 'radiobutton', cnf or kw)

    def insert_separator(self, index, cnf={}, **kw):
        """Add separator at INDEX."""
        self.insert(index, 'separator', cnf or kw)

    def delete(self, index1, index2=None):
        """Delete menu items between INDEX1 and INDEX2 (included)."""
        if index2 is None:
            index2 = index1

        num_index1, num_index2 = self.index(index1), self.index(index2)
        if (num_index1 is None) or (num_index2 is None):
            num_index1, num_index2 = 0, -1

        for i in range(num_index1, num_index2 + 1):
            if 'command' in self.entryconfig(i):
                c = str(self.entrycget(i, 'command'))
                if c:
                    self.deletecommand(c)
        self.tk.call(self._w, 'delete', index1, index2)

    def entrycget(self, index, option):
        """Return the resource value of a menu item for OPTION at INDEX."""
        return self.tk.call(self._w, 'entrycget', index, '-' + option)

    def entryconfigure(self, index, cnf=None, **kw):
        """Configure a menu item at INDEX."""
        return self._configure(('entryconfigure', index), cnf, kw)

    entryconfig = entryconfigure

    def index(self, index):
        """Return the index of a menu item identified by INDEX."""
        i = self.tk.call(self._w, 'index', index)
        return None if i in ('', 'none') else self.tk.getint(i)  # GH-103685.

    def invoke(self, index):
        """Invoke a menu item identified by INDEX and execute
        the associated command."""
        return self.tk.call(self._w, 'invoke', index)

    def post(self, x, y):
        """Display a menu at position X,Y."""
        self.tk.call(self._w, 'post', x, y)

    def type(self, index):
        """Return the type of the menu item at INDEX."""
        return self.tk.call(self._w, 'type', index)

    def unpost(self):
        """Unmap a menu."""
        self.tk.call(self._w, 'unpost')

    def xposition(self, index): # new in Tk 8.5
        """Return the x-position of the leftmost pixel of the menu item
        at INDEX."""
        return self.tk.getint(self.tk.call(self._w, 'xposition', index))

    def yposition(self, index):
        """Return the y-position of the topmost pixel of the menu item at INDEX."""
        return self.tk.getint(self.tk.call(
            self._w, 'yposition', index))


class Menubutton(Widget):
    """Menubutton widget, obsolete since Tk8.0."""

    def __init__(self, master=None, cnf={}, **kw):
        Widget.__init__(self, master, 'menubutton', cnf, kw)


class Message(Widget):
    """Message widget to display multiline text. Obsolete since Label does it too."""

    def __init__(self, master=None, cnf={}, **kw):
        Widget.__init__(self, master, 'message', cnf, kw)


class Radiobutton(Widget):
    """Radiobutton widget which shows only one of several buttons in on-state."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a radiobutton widget with the parent MASTER.

        Valid resource names: activebackground, activeforeground, anchor,
        background, bd, bg, bitmap, borderwidth, command, cursor,
        disabledforeground, fg, font, foreground, height,
        highlightbackground, highlightcolor, highlightthickness, image,
        indicatoron, justify, padx, pady, relief, selectcolor, selectimage,
        state, takefocus, text, textvariable, underline, value, variable,
        width, wraplength."""
        Widget.__init__(self, master, 'radiobutton', cnf, kw)

    def deselect(self):
        """Put the button in off-state."""

        self.tk.call(self._w, 'deselect')

    def flash(self):
        """Flash the button."""
        self.tk.call(self._w, 'flash')

    def invoke(self):
        """Toggle the button and invoke a command if given as resource."""
        return self.tk.call(self._w, 'invoke')

    def select(self):
        """Put the button in on-state."""
        self.tk.call(self._w, 'select')


class Scale(Widget):
    """Scale widget which can display a numerical scale."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a scale widget with the parent MASTER.

        Valid resource names: activebackground, background, bigincrement, bd,
        bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
        highlightbackground, highlightcolor, highlightthickness, label,
        length, orient, relief, repeatdelay, repeatinterval, resolution,
        showvalue, sliderlength, sliderrelief, state, takefocus,
        tickinterval, to, troughcolor, variable, width."""
        Widget.__init__(self, master, 'scale', cnf, kw)

    def get(self):
        """Get the current value as integer or float."""
        value = self.tk.call(self._w, 'get')
        try:
            return self.tk.getint(value)
        except (ValueError, TypeError, TclError):
            return self.tk.getdouble(value)

    def set(self, value):
        """Set the value to VALUE."""
        self.tk.call(self._w, 'set', value)

    def coords(self, value=None):
        """Return a tuple (X,Y) of the point along the centerline of the
        trough that corresponds to VALUE or the current value if None is
        given."""

        return self._getints(self.tk.call(self._w, 'coords', value))

    def identify(self, x, y):
        """Return where the point X,Y lies. Valid return values are "slider",
        "though1" and "though2"."""
        return self.tk.call(self._w, 'identify', x, y)


class Scrollbar(Widget):
    """Scrollbar widget which displays a slider at a certain position."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a scrollbar widget with the parent MASTER.

        Valid resource names: activebackground, activerelief,
        background, bd, bg, borderwidth, command, cursor,
        elementborderwidth, highlightbackground,
        highlightcolor, highlightthickness, jump, orient,
        relief, repeatdelay, repeatinterval, takefocus,
        troughcolor, width."""
        Widget.__init__(self, master, 'scrollbar', cnf, kw)

    def activate(self, index=None):
        """Marks the element indicated by index as active.
        The only index values understood by this method are "arrow1",
        "slider", or "arrow2".  If any other value is specified then no
        element of the scrollbar will be active.  If index is not specified,
        the method returns the name of the element that is currently active,
        or None if no element is active."""
        return self.tk.call(self._w, 'activate', index) or None

    def delta(self, deltax, deltay):
        """Return the fractional change of the scrollbar setting if it
        would be moved by DELTAX or DELTAY pixels."""
        return self.tk.getdouble(
            self.tk.call(self._w, 'delta', deltax, deltay))

    def fraction(self, x, y):
        """Return the fractional value which corresponds to a slider
        position of X,Y."""
        return self.tk.getdouble(self.tk.call(self._w, 'fraction', x, y))

    def identify(self, x, y):
        """Return the element under position X,Y as one of
        "arrow1","slider","arrow2" or ""."""
        return self.tk.call(self._w, 'identify', x, y)

    def get(self):
        """Return the current fractional values (upper and lower end)
        of the slider position."""
        return self._getdoubles(self.tk.call(self._w, 'get'))

    def set(self, first, last):
        """Set the fractional values of the slider position (upper and
        lower ends as value between 0 and 1)."""
        self.tk.call(self._w, 'set', first, last)


class Text(Widget, XView, YView):
    """Text widget which can display text in various forms."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a text widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor,
            exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, padx, pady,
            relief, selectbackground,
            selectborderwidth, selectforeground,
            setgrid, takefocus,
            xscrollcommand, yscrollcommand,

        WIDGET-SPECIFIC OPTIONS

            autoseparators, height, maxundo,
            spacing1, spacing2, spacing3,
            state, tabs, undo, width, wrap,

        """
        Widget.__init__(self, master, 'text', cnf, kw)

    def bbox(self, index):
        """Return a tuple of (x,y,width,height) which gives the bounding
        box of the visible part of the character at the given index."""
        return self._getints(
                self.tk.call(self._w, 'bbox', index)) or None

    def compare(self, index1, op, index2):
        """Return whether between index INDEX1 and index INDEX2 the
        relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=."""
        return self.tk.getboolean(self.tk.call(
            self._w, 'compare', index1, op, index2))

    def count(self, index1, index2, *args): # new in Tk 8.5
        """Counts the number of relevant things between the two indices.
        If index1 is after index2, the result will be a negative number
        (and this holds for each of the possible options).

        The actual items which are counted depends on the options given by
        args. The result is a list of integers, one for the result of each
        counting option given. Valid counting options are "chars",
        "displaychars", "displayindices", "displaylines", "indices",
        "lines", "xpixels" and "ypixels". There is an additional possible
        option "update", which if given then all subsequent options ensure
        that any possible out of date information is recalculated."""
        args = ['-%s' % arg for arg in args]
        args += [index1, index2]
        res = self.tk.call(self._w, 'count', *args) or None
        if res is not None and len(args) <= 3:
            return (res, )
        else:
            return res

    def debug(self, boolean=None):
        """Turn on the internal consistency checks of the B-Tree inside the text
        widget according to BOOLEAN."""
        if boolean is None:
            return self.tk.getboolean(self.tk.call(self._w, 'debug'))
        self.tk.call(self._w, 'debug', boolean)

    def delete(self, index1, index2=None):
        """Delete the characters between INDEX1 and INDEX2 (not included)."""
        self.tk.call(self._w, 'delete', index1, index2)

    def dlineinfo(self, index):
        """Return tuple (x,y,width,height,baseline) giving the bounding box
        and baseline position of the visible part of the line containing
        the character at INDEX."""
        return self._getints(self.tk.call(self._w, 'dlineinfo', index))

    def dump(self, index1, index2=None, command=None, **kw):
        """Return the contents of the widget between index1 and index2.

        The type of contents returned in filtered based on the keyword
        parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are
        given and true, then the corresponding items are returned. The result
        is a list of triples of the form (key, value, index). If none of the
        keywords are true then 'all' is used by default.

        If the 'command' argument is given, it is called once for each element
        of the list of triples, with the values of each triple serving as the
        arguments to the function. In this case the list is not returned."""
        args = []
        func_name = None
        result = None
        if not command:
            # Never call the dump command without the -command flag, since the
            # output could involve Tcl quoting and would be a pain to parse
            # right. Instead just set the command to build a list of triples
            # as if we had done the parsing.
            result = []
            def append_triple(key, value, index, result=result):
                result.append((key, value, index))
            command = append_triple
        try:
            if not isinstance(command, str):
                func_name = command = self._register(command)
            args += ["-command", command]
            for key in kw:
                if kw[key]: args.append("-" + key)
            args.append(index1)
            if index2:
                args.append(index2)
            self.tk.call(self._w, "dump", *args)
            return result
        finally:
            if func_name:
                self.deletecommand(func_name)

    ## new in tk8.4
    def edit(self, *args):
        """Internal method

        This method controls the undo mechanism and
        the modified flag. The exact behavior of the
        command depends on the option argument that
        follows the edit argument. The following forms
        of the command are currently supported:

        edit_modified, edit_redo, edit_reset, edit_separator
        and edit_undo

        """
        return self.tk.call(self._w, 'edit', *args)

    def edit_modified(self, arg=None):
        """Get or Set the modified flag

        If arg is not specified, returns the modified
        flag of the widget. The insert, delete, edit undo and
        edit redo commands or the user can set or clear the
        modified flag. If boolean is specified, sets the
        modified flag of the widget to arg.
        """
        return self.edit("modified", arg)

    def edit_redo(self):
        """Redo the last undone edit

        When the undo option is true, reapplies the last
        undone edits provided no other edits were done since
        then. Generates an error when the redo stack is empty.
        Does nothing when the undo option is false.
        """
        return self.edit("redo")

    def edit_reset(self):
        """Clears the undo and redo stacks
        """
        return self.edit("reset")

    def edit_separator(self):
        """Inserts a separator (boundary) on the undo stack.

        Does nothing when the undo option is false
        """
        return self.edit("separator")

    def edit_undo(self):
        """Undoes the last edit action

        If the undo option is true. An edit action is defined
        as all the insert and delete commands that are recorded
        on the undo stack in between two separators. Generates
        an error when the undo stack is empty. Does nothing
        when the undo option is false
        """
        return self.edit("undo")

    def get(self, index1, index2=None):
        """Return the text from INDEX1 to INDEX2 (not included)."""
        return self.tk.call(self._w, 'get', index1, index2)
    # (Image commands are new in 8.0)

    def image_cget(self, index, option):
        """Return the value of OPTION of an embedded image at INDEX."""
        if option[:1] != "-":
            option = "-" + option
        if option[-1:] == "_":
            option = option[:-1]
        return self.tk.call(self._w, "image", "cget", index, option)

    def image_configure(self, index, cnf=None, **kw):
        """Configure an embedded image at INDEX."""
        return self._configure(('image', 'configure', index), cnf, kw)

    def image_create(self, index, cnf={}, **kw):
        """Create an embedded image at INDEX."""
        return self.tk.call(
                 self._w, "image", "create", index,
                 *self._options(cnf, kw))

    def image_names(self):
        """Return all names of embedded images in this widget."""
        return self.tk.call(self._w, "image", "names")

    def index(self, index):
        """Return the index in the form line.char for INDEX."""
        return str(self.tk.call(self._w, 'index', index))

    def insert(self, index, chars, *args):
        """Insert CHARS before the characters at INDEX. An additional
        tag can be given in ARGS. Additional CHARS and tags can follow in ARGS."""
        self.tk.call((self._w, 'insert', index, chars) + args)

    def mark_gravity(self, markName, direction=None):
        """Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
        Return the current value if None is given for DIRECTION."""
        return self.tk.call(
            (self._w, 'mark', 'gravity', markName, direction))

    def mark_names(self):
        """Return all mark names."""
        return self.tk.splitlist(self.tk.call(
            self._w, 'mark', 'names'))

    def mark_set(self, markName, index):
        """Set mark MARKNAME before the character at INDEX."""
        self.tk.call(self._w, 'mark', 'set', markName, index)

    def mark_unset(self, *markNames):
        """Delete all marks in MARKNAMES."""
        self.tk.call((self._w, 'mark', 'unset') + markNames)

    def mark_next(self, index):
        """Return the name of the next mark after INDEX."""
        return self.tk.call(self._w, 'mark', 'next', index) or None

    def mark_previous(self, index):
        """Return the name of the previous mark before INDEX."""
        return self.tk.call(self._w, 'mark', 'previous', index) or None

    def peer_create(self, newPathName, cnf={}, **kw): # new in Tk 8.5
        """Creates a peer text widget with the given newPathName, and any
        optional standard configuration options. By default the peer will
        have the same start and end line as the parent widget, but
        these can be overridden with the standard configuration options."""
        self.tk.call(self._w, 'peer', 'create', newPathName,
            *self._options(cnf, kw))

    def peer_names(self): # new in Tk 8.5
        """Returns a list of peers of this widget (this does not include
        the widget itself)."""
        return self.tk.splitlist(self.tk.call(self._w, 'peer', 'names'))

    def replace(self, index1, index2, chars, *args): # new in Tk 8.5
        """Replaces the range of characters between index1 and index2 with
        the given characters and tags specified by args.

        See the method insert for some more information about args, and the
        method delete for information about the indices."""
        self.tk.call(self._w, 'replace', index1, index2, chars, *args)

    def scan_mark(self, x, y):
        """Remember the current X, Y coordinates."""
        self.tk.call(self._w, 'scan', 'mark', x, y)

    def scan_dragto(self, x, y):
        """Adjust the view of the text to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark."""
        self.tk.call(self._w, 'scan', 'dragto', x, y)

    def search(self, pattern, index, stopindex=None,
           forwards=None, backwards=None, exact=None,
           regexp=None, nocase=None, count=None, elide=None):
        """Search PATTERN beginning from INDEX until STOPINDEX.
        Return the index of the first character of a match or an
        empty string."""
        args = [self._w, 'search']
        if forwards: args.append('-forwards')
        if backwards: args.append('-backwards')
        if exact: args.append('-exact')
        if regexp: args.append('-regexp')
        if nocase: args.append('-nocase')
        if elide: args.append('-elide')
        if count: args.append('-count'); args.append(count)
        if pattern and pattern[0] == '-': args.append('--')
        args.append(pattern)
        args.append(index)
        if stopindex: args.append(stopindex)
        return str(self.tk.call(tuple(args)))

    def see(self, index):
        """Scroll such that the character at INDEX is visible."""
        self.tk.call(self._w, 'see', index)

    def tag_add(self, tagName, index1, *args):
        """Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
        Additional pairs of indices may follow in ARGS."""
        self.tk.call(
            (self._w, 'tag', 'add', tagName, index1) + args)

    def tag_unbind(self, tagName, sequence, funcid=None):
        """Unbind for all characters with TAGNAME for event SEQUENCE  the
        function identified with FUNCID."""
        return self._unbind((self._w, 'tag', 'bind', tagName, sequence), funcid)

    def tag_bind(self, tagName, sequence, func, add=None):
        """Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.

        An additional boolean parameter ADD specifies whether FUNC will be
        called additionally to the other bound function or whether it will
        replace the previous function. See bind for the return value."""
        return self._bind((self._w, 'tag', 'bind', tagName),
                  sequence, func, add)

    def _tag_bind(self, tagName, sequence=None, func=None, add=None):
        # For tests only
        return self._bind((self._w, 'tag', 'bind', tagName),
                  sequence, func, add)

    def tag_cget(self, tagName, option):
        """Return the value of OPTION for tag TAGNAME."""
        if option[:1] != '-':
            option = '-' + option
        if option[-1:] == '_':
            option = option[:-1]
        return self.tk.call(self._w, 'tag', 'cget', tagName, option)

    def tag_configure(self, tagName, cnf=None, **kw):
        """Configure a tag TAGNAME."""
        return self._configure(('tag', 'configure', tagName), cnf, kw)

    tag_config = tag_configure

    def tag_delete(self, *tagNames):
        """Delete all tags in TAGNAMES."""
        self.tk.call((self._w, 'tag', 'delete') + tagNames)

    def tag_lower(self, tagName, belowThis=None):
        """Change the priority of tag TAGNAME such that it is lower
        than the priority of BELOWTHIS."""
        self.tk.call(self._w, 'tag', 'lower', tagName, belowThis)

    def tag_names(self, index=None):
        """Return a list of all tag names."""
        return self.tk.splitlist(
            self.tk.call(self._w, 'tag', 'names', index))

    def tag_nextrange(self, tagName, index1, index2=None):
        """Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched forward from INDEX1."""
        return self.tk.splitlist(self.tk.call(
            self._w, 'tag', 'nextrange', tagName, index1, index2))

    def tag_prevrange(self, tagName, index1, index2=None):
        """Return a list of start and end index for the first sequence of
        characters between INDEX1 and INDEX2 which all have tag TAGNAME.
        The text is searched backwards from INDEX1."""
        return self.tk.splitlist(self.tk.call(
            self._w, 'tag', 'prevrange', tagName, index1, index2))

    def tag_raise(self, tagName, aboveThis=None):
        """Change the priority of tag TAGNAME such that it is higher
        than the priority of ABOVETHIS."""
        self.tk.call(
            self._w, 'tag', 'raise', tagName, aboveThis)

    def tag_ranges(self, tagName):
        """Return a list of ranges of text which have tag TAGNAME."""
        return self.tk.splitlist(self.tk.call(
            self._w, 'tag', 'ranges', tagName))

    def tag_remove(self, tagName, index1, index2=None):
        """Remove tag TAGNAME from all characters between INDEX1 and INDEX2."""
        self.tk.call(
            self._w, 'tag', 'remove', tagName, index1, index2)

    def window_cget(self, index, option):
        """Return the value of OPTION of an embedded window at INDEX."""
        if option[:1] != '-':
            option = '-' + option
        if option[-1:] == '_':
            option = option[:-1]
        return self.tk.call(self._w, 'window', 'cget', index, option)

    def window_configure(self, index, cnf=None, **kw):
        """Configure an embedded window at INDEX."""
        return self._configure(('window', 'configure', index), cnf, kw)

    window_config = window_configure

    def window_create(self, index, cnf={}, **kw):
        """Create a window at INDEX."""
        self.tk.call(
              (self._w, 'window', 'create', index)
              + self._options(cnf, kw))

    def window_names(self):
        """Return all names of embedded windows in this widget."""
        return self.tk.splitlist(
            self.tk.call(self._w, 'window', 'names'))

    def yview_pickplace(self, *what):
        """Obsolete function, use see."""
        self.tk.call((self._w, 'yview', '-pickplace') + what)


class _setit:
    """Internal class. It wraps the command in the widget OptionMenu."""

    def __init__(self, var, value, callback=None):
        self.__value = value
        self.__var = var
        self.__callback = callback

    def __call__(self, *args):
        self.__var.set(self.__value)
        if self.__callback is not None:
            self.__callback(self.__value, *args)


class OptionMenu(Menubutton):
    """OptionMenu which allows the user to select a value from a menu."""

    def __init__(self, master, variable, value, *values, **kwargs):
        """Construct an optionmenu widget with the parent MASTER, with
        the resource textvariable set to VARIABLE, the initially selected
        value VALUE, the other menu values VALUES and an additional
        keyword argument command."""
        kw = {"borderwidth": 2, "textvariable": variable,
              "indicatoron": 1, "relief": RAISED, "anchor": "c",
              "highlightthickness": 2}
        Widget.__init__(self, master, "menubutton", kw)
        self.widgetName = 'tk_optionMenu'
        menu = self.__menu = Menu(self, name="menu", tearoff=0)
        self.menuname = menu._w
        # 'command' is the only supported keyword
        callback = kwargs.get('command')
        if 'command' in kwargs:
            del kwargs['command']
        if kwargs:
            raise TclError('unknown option -'+next(iter(kwargs)))
        menu.add_command(label=value,
                 command=_setit(variable, value, callback))
        for v in values:
            menu.add_command(label=v,
                     command=_setit(variable, v, callback))
        self["menu"] = menu

    def __getitem__(self, name):
        if name == 'menu':
            return self.__menu
        return Widget.__getitem__(self, name)

    def destroy(self):
        """Destroy this widget and the associated menu."""
        Menubutton.destroy(self)
        self.__menu = None


class Image:
    """Base class for images."""
    _last_id = 0

    def __init__(self, imgtype, name=None, cnf={}, master=None, **kw):
        self.name = None
        if master is None:
            master = _get_default_root('create image')
        self.tk = getattr(master, 'tk', master)
        if not name:
            Image._last_id += 1
            name = "pyimage%r" % (Image._last_id,) # tk itself would use image<x>
        if kw and cnf: cnf = _cnfmerge((cnf, kw))
        elif kw: cnf = kw
        options = ()
        for k, v in cnf.items():
            options = options + ('-'+k, v)
        self.tk.call(('image', 'create', imgtype, name,) + options)
        self.name = name

    def __str__(self): return self.name

    def __del__(self):
        if self.name:
            try:
                self.tk.call('image', 'delete', self.name)
            except TclError:
                # May happen if the root was destroyed
                pass

    def __setitem__(self, key, value):
        self.tk.call(self.name, 'configure', '-'+key, value)

    def __getitem__(self, key):
        return self.tk.call(self.name, 'configure', '-'+key)

    def configure(self, **kw):
        """Configure the image."""
        res = ()
        for k, v in _cnfmerge(kw).items():
            if v is not None:
                if k[-1] == '_': k = k[:-1]
                res = res + ('-'+k, v)
        self.tk.call((self.name, 'config') + res)

    config = configure

    def height(self):
        """Return the height of the image."""
        return self.tk.getint(
            self.tk.call('image', 'height', self.name))

    def type(self):
        """Return the type of the image, e.g. "photo" or "bitmap"."""
        return self.tk.call('image', 'type', self.name)

    def width(self):
        """Return the width of the image."""
        return self.tk.getint(
            self.tk.call('image', 'width', self.name))


class PhotoImage(Image):
    """Widget which can display images in PGM, PPM, GIF, PNG format."""

    def __init__(self, name=None, cnf={}, master=None, **kw):
        """Create an image with NAME.

        Valid resource names: data, format, file, gamma, height, palette,
        width."""
        Image.__init__(self, 'photo', name, cnf, master, **kw)

    def blank(self):
        """Display a transparent image."""
        self.tk.call(self.name, 'blank')

    def cget(self, option):
        """Return the value of OPTION."""
        return self.tk.call(self.name, 'cget', '-' + option)
    # XXX config

    def __getitem__(self, key):
        return self.tk.call(self.name, 'cget', '-' + key)
    # XXX copy -from, -to, ...?

    def copy(self):
        """Return a new PhotoImage with the same image as this widget."""
        destImage = PhotoImage(master=self.tk)
        self.tk.call(destImage, 'copy', self.name)
        return destImage

    def zoom(self, x, y=''):
        """Return a new PhotoImage with the same image as this widget
        but zoom it with a factor of x in the X direction and y in the Y
        direction.  If y is not given, the default value is the same as x.
        """
        destImage = PhotoImage(master=self.tk)
        if y=='': y=x
        self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)
        return destImage

    def subsample(self, x, y=''):
        """Return a new PhotoImage based on the same image as this widget
        but use only every Xth or Yth pixel.  If y is not given, the
        default value is the same as x.
        """
        destImage = PhotoImage(master=self.tk)
        if y=='': y=x
        self.tk.call(destImage, 'copy', self.name, '-subsample',x,y)
        return destImage

    def get(self, x, y):
        """Return the color (red, green, blue) of the pixel at X,Y."""
        return self.tk.call(self.name, 'get', x, y)

    def put(self, data, to=None):
        """Put row formatted colors to image starting from
        position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))"""
        args = (self.name, 'put', data)
        if to:
            if to[0] == '-to':
                to = to[1:]
            args = args + ('-to',) + tuple(to)
        self.tk.call(args)
    # XXX read

    def write(self, filename, format=None, from_coords=None):
        """Write image to file FILENAME in FORMAT starting from
        position FROM_COORDS."""
        args = (self.name, 'write', filename)
        if format:
            args = args + ('-format', format)
        if from_coords:
            args = args + ('-from',) + tuple(from_coords)
        self.tk.call(args)

    def transparency_get(self, x, y):
        """Return True if the pixel at x,y is transparent."""
        return self.tk.getboolean(self.tk.call(
            self.name, 'transparency', 'get', x, y))

    def transparency_set(self, x, y, boolean):
        """Set the transparency of the pixel at x,y."""
        self.tk.call(self.name, 'transparency', 'set', x, y, boolean)


class BitmapImage(Image):
    """Widget which can display images in XBM format."""

    def __init__(self, name=None, cnf={}, master=None, **kw):
        """Create a bitmap with NAME.

        Valid resource names: background, data, file, foreground, maskdata, maskfile."""
        Image.__init__(self, 'bitmap', name, cnf, master, **kw)


def image_names():
    tk = _get_default_root('use image_names()').tk
    return tk.splitlist(tk.call('image', 'names'))


def image_types():
    tk = _get_default_root('use image_types()').tk
    return tk.splitlist(tk.call('image', 'types'))


class Spinbox(Widget, XView):
    """spinbox widget."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a spinbox widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, background, borderwidth,
            cursor, exportselection, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, insertbackground,
            insertborderwidth, insertofftime,
            insertontime, insertwidth, justify, relief,
            repeatdelay, repeatinterval,
            selectbackground, selectborderwidth
            selectforeground, takefocus, textvariable
            xscrollcommand.

        WIDGET-SPECIFIC OPTIONS

            buttonbackground, buttoncursor,
            buttondownrelief, buttonuprelief,
            command, disabledbackground,
            disabledforeground, format, from,
            invalidcommand, increment,
            readonlybackground, state, to,
            validate, validatecommand values,
            width, wrap,
        """
        Widget.__init__(self, master, 'spinbox', cnf, kw)

    def bbox(self, index):
        """Return a tuple of X1,Y1,X2,Y2 coordinates for a
        rectangle which encloses the character given by index.

        The first two elements of the list give the x and y
        coordinates of the upper-left corner of the screen
        area covered by the character (in pixels relative
        to the widget) and the last two elements give the
        width and height of the character, in pixels. The
        bounding box may refer to a region outside the
        visible area of the window.
        """
        return self._getints(self.tk.call(self._w, 'bbox', index)) or None

    def delete(self, first, last=None):
        """Delete one or more elements of the spinbox.

        First is the index of the first character to delete,
        and last is the index of the character just after
        the last one to delete. If last isn't specified it
        defaults to first+1, i.e. a single character is
        deleted.  This command returns an empty string.
        """
        return self.tk.call(self._w, 'delete', first, last)

    def get(self):
        """Returns the spinbox's string"""
        return self.tk.call(self._w, 'get')

    def icursor(self, index):
        """Alter the position of the insertion cursor.

        The insertion cursor will be displayed just before
        the character given by index. Returns an empty string
        """
        return self.tk.call(self._w, 'icursor', index)

    def identify(self, x, y):
        """Returns the name of the widget at position x, y

        Return value is one of: none, buttondown, buttonup, entry
        """
        return self.tk.call(self._w, 'identify', x, y)

    def index(self, index):
        """Returns the numerical index corresponding to index
        """
        return self.tk.call(self._w, 'index', index)

    def insert(self, index, s):
        """Insert string s at index

         Returns an empty string.
        """
        return self.tk.call(self._w, 'insert', index, s)

    def invoke(self, element):
        """Causes the specified element to be invoked

        The element could be buttondown or buttonup
        triggering the action associated with it.
        """
        return self.tk.call(self._w, 'invoke', element)

    def scan(self, *args):
        """Internal function."""
        return self._getints(
            self.tk.call((self._w, 'scan') + args)) or ()

    def scan_mark(self, x):
        """Records x and the current view in the spinbox window;

        used in conjunction with later scan dragto commands.
        Typically this command is associated with a mouse button
        press in the widget. It returns an empty string.
        """
        return self.scan("mark", x)

    def scan_dragto(self, x):
        """Compute the difference between the given x argument
        and the x argument to the last scan mark command

        It then adjusts the view left or right by 10 times the
        difference in x-coordinates. This command is typically
        associated with mouse motion events in the widget, to
        produce the effect of dragging the spinbox at high speed
        through the window. The return value is an empty string.
        """
        return self.scan("dragto", x)

    def selection(self, *args):
        """Internal function."""
        return self._getints(
            self.tk.call((self._w, 'selection') + args)) or ()

    def selection_adjust(self, index):
        """Locate the end of the selection nearest to the character
        given by index,

        Then adjust that end of the selection to be at index
        (i.e including but not going beyond index). The other
        end of the selection is made the anchor point for future
        select to commands. If the selection isn't currently in
        the spinbox, then a new selection is created to include
        the characters between index and the most recent selection
        anchor point, inclusive.
        """
        return self.selection("adjust", index)

    def selection_clear(self):
        """Clear the selection

        If the selection isn't in this widget then the
        command has no effect.
        """
        return self.selection("clear")

    def selection_element(self, element=None):
        """Sets or gets the currently selected element.

        If a spinbutton element is specified, it will be
        displayed depressed.
        """
        return self.tk.call(self._w, 'selection', 'element', element)

    def selection_from(self, index):
        """Set the fixed end of a selection to INDEX."""
        self.selection('from', index)

    def selection_present(self):
        """Return True if there are characters selected in the spinbox, False
        otherwise."""
        return self.tk.getboolean(
            self.tk.call(self._w, 'selection', 'present'))

    def selection_range(self, start, end):
        """Set the selection from START to END (not included)."""
        self.selection('range', start, end)

    def selection_to(self, index):
        """Set the variable end of a selection to INDEX."""
        self.selection('to', index)

###########################################################################


class LabelFrame(Widget):
    """labelframe widget."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a labelframe widget with the parent MASTER.

        STANDARD OPTIONS

            borderwidth, cursor, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, padx, pady, relief,
            takefocus, text

        WIDGET-SPECIFIC OPTIONS

            background, class, colormap, container,
            height, labelanchor, labelwidget,
            visual, width
        """
        Widget.__init__(self, master, 'labelframe', cnf, kw)

########################################################################


class PanedWindow(Widget):
    """panedwindow widget."""

    def __init__(self, master=None, cnf={}, **kw):
        """Construct a panedwindow widget with the parent MASTER.

        STANDARD OPTIONS

            background, borderwidth, cursor, height,
            orient, relief, width

        WIDGET-SPECIFIC OPTIONS

            handlepad, handlesize, opaqueresize,
            sashcursor, sashpad, sashrelief,
            sashwidth, showhandle,
        """
        Widget.__init__(self, master, 'panedwindow', cnf, kw)

    def add(self, child, **kw):
        """Add a child widget to the panedwindow in a new pane.

        The child argument is the name of the child widget
        followed by pairs of arguments that specify how to
        manage the windows. The possible options and values
        are the ones accepted by the paneconfigure method.
        """
        self.tk.call((self._w, 'add', child) + self._options(kw))

    def remove(self, child):
        """Remove the pane containing child from the panedwindow

        All geometry management options for child will be forgotten.
        """
        self.tk.call(self._w, 'forget', child)

    forget = remove

    def identify(self, x, y):
        """Identify the panedwindow component at point x, y

        If the point is over a sash or a sash handle, the result
        is a two element list containing the index of the sash or
        handle, and a word indicating whether it is over a sash
        or a handle, such as {0 sash} or {2 handle}. If the point
        is over any other part of the panedwindow, the result is
        an empty list.
        """
        return self.tk.call(self._w, 'identify', x, y)

    def proxy(self, *args):
        """Internal function."""
        return self._getints(
            self.tk.call((self._w, 'proxy') + args)) or ()

    def proxy_coord(self):
        """Return the x and y pair of the most recent proxy location
        """
        return self.proxy("coord")

    def proxy_forget(self):
        """Remove the proxy from the display.
        """
        return self.proxy("forget")

    def proxy_place(self, x, y):
        """Place the proxy at the given x and y coordinates.
        """
        return self.proxy("place", x, y)

    def sash(self, *args):
        """Internal function."""
        return self._getints(
            self.tk.call((self._w, 'sash') + args)) or ()

    def sash_coord(self, index):
        """Return the current x and y pair for the sash given by index.

        Index must be an integer between 0 and 1 less than the
        number of panes in the panedwindow. The coordinates given are
        those of the top left corner of the region containing the sash.
        pathName sash dragto index x y This command computes the
        difference between the given coordinates and the coordinates
        given to the last sash coord command for the given sash. It then
        moves that sash the computed difference. The return value is the
        empty string.
        """
        return self.sash("coord", index)

    def sash_mark(self, index):
        """Records x and y for the sash given by index;

        Used in conjunction with later dragto commands to move the sash.
        """
        return self.sash("mark", index)

    def sash_place(self, index, x, y):
        """Place the sash given by index at the given coordinates
        """
        return self.sash("place", index, x, y)

    def panecget(self, child, option):
        """Query a management option for window.

        Option may be any value allowed by the paneconfigure subcommand
        """
        return self.tk.call(
            (self._w, 'panecget') + (child, '-'+option))

    def paneconfigure(self, tagOrId, cnf=None, **kw):
        """Query or modify the management options for window.

        If no option is specified, returns a list describing all
        of the available options for pathName.  If option is
        specified with no value, then the command returns a list
        describing the one named option (this list will be identical
        to the corresponding sublist of the value returned if no
        option is specified). If one or more option-value pairs are
        specified, then the command modifies the given widget
        option(s) to have the given value(s); in this case the
        command returns an empty string. The following options
        are supported:

        after window
            Insert the window after the window specified. window
            should be the name of a window already managed by pathName.
        before window
            Insert the window before the window specified. window
            should be the name of a window already managed by pathName.
        height size
            Specify a height for the window. The height will be the
            outer dimension of the window including its border, if
            any. If size is an empty string, or if -height is not
            specified, then the height requested internally by the
            window will be used initially; the height may later be
            adjusted by the movement of sashes in the panedwindow.
            Size may be any value accepted by Tk_GetPixels.
        minsize n
            Specifies that the size of the window cannot be made
            less than n. This constraint only affects the size of
            the widget in the paned dimension -- the x dimension
            for horizontal panedwindows, the y dimension for
            vertical panedwindows. May be any value accepted by
            Tk_GetPixels.
        padx n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the X-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        pady n
            Specifies a non-negative value indicating how much
            extra space to leave on each side of the window in
            the Y-direction. The value may have any of the forms
            accepted by Tk_GetPixels.
        sticky style
            If a window's pane is larger than the requested
            dimensions of the window, this option may be used
            to position (or stretch) the window within its pane.
            Style is a string that contains zero or more of the
            characters n, s, e or w. The string can optionally
            contains spaces or commas, but they are ignored. Each
            letter refers to a side (north, south, east, or west)
            that the window will "stick" to. If both n and s
            (or e and w) are specified, the window will be
            stretched to fill the entire height (or width) of
            its cavity.
        width size
            Specify a width for the window. The width will be
            the outer dimension of the window including its
            border, if any. If size is an empty string, or
            if -width is not specified, then the width requested
            internally by the window will be used initially; the
            width may later be adjusted by the movement of sashes
            in the panedwindow. Size may be any value accepted by
            Tk_GetPixels.

        """
        if cnf is None and not kw:
            return self._getconfigure(self._w, 'paneconfigure', tagOrId)
        if isinstance(cnf, str) and not kw:
            return self._getconfigure1(
                self._w, 'paneconfigure', tagOrId, '-'+cnf)
        self.tk.call((self._w, 'paneconfigure', tagOrId) +
                 self._options(cnf, kw))

    paneconfig = paneconfigure

    def panes(self):
        """Returns an ordered list of the child panes."""
        return self.tk.splitlist(self.tk.call(self._w, 'panes'))

# Test:


def _test():
    root = Tk()
    text = "This is Tcl/Tk %s" % root.globalgetvar('tk_patchLevel')
    text += "\nThis should be a cedilla: \xe7"
    label = Label(root, text=text)
    label.pack()
    test = Button(root, text="Click me!",
              command=lambda root=root: root.test.configure(
                  text="[%s]" % root.test['text']))
    test.pack()
    root.test = test
    quit = Button(root, text="QUIT", command=root.destroy)
    quit.pack()
    # The following three commands are needed so the window pops
    # up on top on Windows...
    root.iconify()
    root.update()
    root.deiconify()
    root.mainloop()


__all__ = [name for name, obj in globals().items()
           if not name.startswith('_') and not isinstance(obj, types.ModuleType)
           and name not in {'wantobjects'}]

if __name__ == '__main__':
    _test()
__main__.py000064400000000224151710635150006640 0ustar00"""Main entry point"""

import sys
if sys.argv[0].endswith("__main__.py"):
    sys.argv[0] = "python -m tkinter"
from . import _test as main
main()
colorchooser.py000064400000005144151710635150007627 0ustar00# tk common color chooser dialogue
#
# this module provides an interface to the native color dialogue
# available in Tk 4.2 and newer.
#
# written by Fredrik Lundh, May 1997
#
# fixed initialcolor handling in August 1998
#


from tkinter.commondialog import Dialog

__all__ = ["Chooser", "askcolor"]


class Chooser(Dialog):
    """Create a dialog for the tk_chooseColor command.

    Args:
        master: The master widget for this dialog.  If not provided,
            defaults to options['parent'] (if defined).
        options: Dictionary of options for the tk_chooseColor call.
            initialcolor: Specifies the selected color when the
                dialog is first displayed.  This can be a tk color
                string or a 3-tuple of ints in the range (0, 255)
                for an RGB triplet.
            parent: The parent window of the color dialog.  The
                color dialog is displayed on top of this.
            title: A string for the title of the dialog box.
    """

    command = "tk_chooseColor"

    def _fixoptions(self):
        """Ensure initialcolor is a tk color string.

        Convert initialcolor from a RGB triplet to a color string.
        """
        try:
            color = self.options["initialcolor"]
            if isinstance(color, tuple):
                # Assume an RGB triplet.
                self.options["initialcolor"] = "#%02x%02x%02x" % color
        except KeyError:
            pass

    def _fixresult(self, widget, result):
        """Adjust result returned from call to tk_chooseColor.

        Return both an RGB tuple of ints in the range (0, 255) and the
        tk color string in the form #rrggbb.
        """
        # Result can be many things: an empty tuple, an empty string, or
        # a _tkinter.Tcl_Obj, so this somewhat weird check handles that.
        if not result or not str(result):
            return None, None  # canceled

        # To simplify application code, the color chooser returns
        # an RGB tuple together with the Tk color string.
        r, g, b = widget.winfo_rgb(result)
        return (r//256, g//256, b//256), str(result)


#
# convenience stuff

def askcolor(color=None, **options):
    """Display dialog window for selection of a color.

    Convenience wrapper for the Chooser class.  Displays the color
    chooser dialog with color as the initial value.
    """

    if color:
        options = options.copy()
        options["initialcolor"] = color

    return Chooser(**options).show()


# --------------------------------------------------------------------
# test stuff

if __name__ == "__main__":
    print("color", askcolor())
commondialog.py000064400000002411151710635150007570 0ustar00# base class for tk common dialogues
#
# this module provides a base class for accessing the common
# dialogues available in Tk 4.2 and newer.  use filedialog,
# colorchooser, and messagebox to access the individual
# dialogs.
#
# written by Fredrik Lundh, May 1997
#

__all__ = ["Dialog"]

from tkinter import _get_temp_root, _destroy_temp_root


class Dialog:

    command = None

    def __init__(self, master=None, **options):
        if master is None:
            master = options.get('parent')
        self.master = master
        self.options = options

    def _fixoptions(self):
        pass # hook

    def _fixresult(self, widget, result):
        return result # hook

    def show(self, **options):

        # update instance options
        for k, v in options.items():
            self.options[k] = v

        self._fixoptions()

        master = self.master
        if master is None:
            master = _get_temp_root()
        try:
            self._test_callback(master)  # The function below is replaced for some tests.
            s = master.tk.call(self.command, *master._options(self.options))
            s = self._fixresult(master, s)
        finally:
            _destroy_temp_root(master)

        return s

    def _test_callback(self, master):
        pass
constants.py000064400000002725151710635150007144 0ustar00# Symbolic constants for Tk

# Booleans
NO=FALSE=OFF=0
YES=TRUE=ON=1

# -anchor and -sticky
N='n'
S='s'
W='w'
E='e'
NW='nw'
SW='sw'
NE='ne'
SE='se'
NS='ns'
EW='ew'
NSEW='nsew'
CENTER='center'

# -fill
NONE='none'
X='x'
Y='y'
BOTH='both'

# -side
LEFT='left'
TOP='top'
RIGHT='right'
BOTTOM='bottom'

# -relief
RAISED='raised'
SUNKEN='sunken'
FLAT='flat'
RIDGE='ridge'
GROOVE='groove'
SOLID = 'solid'

# -orient
HORIZONTAL='horizontal'
VERTICAL='vertical'

# -tabs
NUMERIC='numeric'

# -wrap
CHAR='char'
WORD='word'

# -align
BASELINE='baseline'

# -bordermode
INSIDE='inside'
OUTSIDE='outside'

# Special tags, marks and insert positions
SEL='sel'
SEL_FIRST='sel.first'
SEL_LAST='sel.last'
END='end'
INSERT='insert'
CURRENT='current'
ANCHOR='anchor'
ALL='all' # e.g. Canvas.delete(ALL)

# Text widget and button states
NORMAL='normal'
DISABLED='disabled'
ACTIVE='active'
# Canvas state
HIDDEN='hidden'

# Menu item types
CASCADE='cascade'
CHECKBUTTON='checkbutton'
COMMAND='command'
RADIOBUTTON='radiobutton'
SEPARATOR='separator'

# Selection modes for list boxes
SINGLE='single'
BROWSE='browse'
MULTIPLE='multiple'
EXTENDED='extended'

# Activestyle for list boxes
# NONE='none' is also valid
DOTBOX='dotbox'
UNDERLINE='underline'

# Various canvas styles
PIESLICE='pieslice'
CHORD='chord'
ARC='arc'
FIRST='first'
LAST='last'
BUTT='butt'
PROJECTING='projecting'
ROUND='round'
BEVEL='bevel'
MITER='miter'

# Arguments to xview/yview
MOVETO='moveto'
SCROLL='scroll'
UNITS='units'
PAGES='pages'
dialog.py000064400000002777151710635150006376 0ustar00# dialog.py -- Tkinter interface to the tk_dialog script.

from tkinter import _cnfmerge, Widget, TclError, Button, Pack

__all__ = ["Dialog"]

DIALOG_ICON = 'questhead'


class Dialog(Widget):
    def __init__(self, master=None, cnf={}, **kw):
        cnf = _cnfmerge((cnf, kw))
        self.widgetName = '__dialog__'
        self._setup(master, cnf)
        self.num = self.tk.getint(
                self.tk.call(
                      'tk_dialog', self._w,
                      cnf['title'], cnf['text'],
                      cnf['bitmap'], cnf['default'],
                      *cnf['strings']))
        try: Widget.destroy(self)
        except TclError: pass

    def destroy(self): pass


def _test():
    d = Dialog(None, {'title': 'File Modified',
                      'text':
                      'File "Python.h" has been modified'
                      ' since the last time it was saved.'
                      ' Do you want to save it before'
                      ' exiting the application.',
                      'bitmap': DIALOG_ICON,
                      'default': 0,
                      'strings': ('Save File',
                                  'Discard Changes',
                                  'Return to Editor')})
    print(d.num)


if __name__ == '__main__':
    t = Button(None, {'text': 'Test',
                      'command': _test,
                      Pack: {}})
    q = Button(None, {'text': 'Quit',
                      'command': t.quit,
                      Pack: {}})
    t.mainloop()
dnd.py000064400000026574151710635150005705 0ustar00"""Drag-and-drop support for Tkinter.

This is very preliminary.  I currently only support dnd *within* one
application, between different windows (or within the same window).

I am trying to make this as generic as possible -- not dependent on
the use of a particular widget or icon type, etc.  I also hope that
this will work with Pmw.

To enable an object to be dragged, you must create an event binding
for it that starts the drag-and-drop process. Typically, you should
bind <ButtonPress> to a callback function that you write. The function
should call Tkdnd.dnd_start(source, event), where 'source' is the
object to be dragged, and 'event' is the event that invoked the call
(the argument to your callback function).  Even though this is a class
instantiation, the returned instance should not be stored -- it will
be kept alive automatically for the duration of the drag-and-drop.

When a drag-and-drop is already in process for the Tk interpreter, the
call is *ignored*; this normally averts starting multiple simultaneous
dnd processes, e.g. because different button callbacks all
dnd_start().

The object is *not* necessarily a widget -- it can be any
application-specific object that is meaningful to potential
drag-and-drop targets.

Potential drag-and-drop targets are discovered as follows.  Whenever
the mouse moves, and at the start and end of a drag-and-drop move, the
Tk widget directly under the mouse is inspected.  This is the target
widget (not to be confused with the target object, yet to be
determined).  If there is no target widget, there is no dnd target
object.  If there is a target widget, and it has an attribute
dnd_accept, this should be a function (or any callable object).  The
function is called as dnd_accept(source, event), where 'source' is the
object being dragged (the object passed to dnd_start() above), and
'event' is the most recent event object (generally a <Motion> event;
it can also be <ButtonPress> or <ButtonRelease>).  If the dnd_accept()
function returns something other than None, this is the new dnd target
object.  If dnd_accept() returns None, or if the target widget has no
dnd_accept attribute, the target widget's parent is considered as the
target widget, and the search for a target object is repeated from
there.  If necessary, the search is repeated all the way up to the
root widget.  If none of the target widgets can produce a target
object, there is no target object (the target object is None).

The target object thus produced, if any, is called the new target
object.  It is compared with the old target object (or None, if there
was no old target widget).  There are several cases ('source' is the
source object, and 'event' is the most recent event object):

- Both the old and new target objects are None.  Nothing happens.

- The old and new target objects are the same object.  Its method
dnd_motion(source, event) is called.

- The old target object was None, and the new target object is not
None.  The new target object's method dnd_enter(source, event) is
called.

- The new target object is None, and the old target object is not
None.  The old target object's method dnd_leave(source, event) is
called.

- The old and new target objects differ and neither is None.  The old
target object's method dnd_leave(source, event), and then the new
target object's method dnd_enter(source, event) is called.

Once this is done, the new target object replaces the old one, and the
Tk mainloop proceeds.  The return value of the methods mentioned above
is ignored; if they raise an exception, the normal exception handling
mechanisms take over.

The drag-and-drop processes can end in two ways: a final target object
is selected, or no final target object is selected.  When a final
target object is selected, it will always have been notified of the
potential drop by a call to its dnd_enter() method, as described
above, and possibly one or more calls to its dnd_motion() method; its
dnd_leave() method has not been called since the last call to
dnd_enter().  The target is notified of the drop by a call to its
method dnd_commit(source, event).

If no final target object is selected, and there was an old target
object, its dnd_leave(source, event) method is called to complete the
dnd sequence.

Finally, the source object is notified that the drag-and-drop process
is over, by a call to source.dnd_end(target, event), specifying either
the selected target object, or None if no target object was selected.
The source object can use this to implement the commit action; this is
sometimes simpler than to do it in the target's dnd_commit().  The
target's dnd_commit() method could then simply be aliased to
dnd_leave().

At any time during a dnd sequence, the application can cancel the
sequence by calling the cancel() method on the object returned by
dnd_start().  This will call dnd_leave() if a target is currently
active; it will never call dnd_commit().

"""

import tkinter

__all__ = ["dnd_start", "DndHandler"]


# The factory function

def dnd_start(source, event):
    h = DndHandler(source, event)
    if h.root is not None:
        return h
    else:
        return None


# The class that does the work

class DndHandler:

    root = None

    def __init__(self, source, event):
        if event.num > 5:
            return
        root = event.widget._root()
        try:
            root.__dnd
            return # Don't start recursive dnd
        except AttributeError:
            root.__dnd = self
            self.root = root
        self.source = source
        self.target = None
        self.initial_button = button = event.num
        self.initial_widget = widget = event.widget
        self.release_pattern = "<B%d-ButtonRelease-%d>" % (button, button)
        self.save_cursor = widget['cursor'] or ""
        widget.bind(self.release_pattern, self.on_release)
        widget.bind("<Motion>", self.on_motion)
        widget['cursor'] = "hand2"

    def __del__(self):
        root = self.root
        self.root = None
        if root is not None:
            try:
                del root.__dnd
            except AttributeError:
                pass

    def on_motion(self, event):
        x, y = event.x_root, event.y_root
        target_widget = self.initial_widget.winfo_containing(x, y)
        source = self.source
        new_target = None
        while target_widget is not None:
            try:
                attr = target_widget.dnd_accept
            except AttributeError:
                pass
            else:
                new_target = attr(source, event)
                if new_target is not None:
                    break
            target_widget = target_widget.master
        old_target = self.target
        if old_target is new_target:
            if old_target is not None:
                old_target.dnd_motion(source, event)
        else:
            if old_target is not None:
                self.target = None
                old_target.dnd_leave(source, event)
            if new_target is not None:
                new_target.dnd_enter(source, event)
                self.target = new_target

    def on_release(self, event):
        self.finish(event, 1)

    def cancel(self, event=None):
        self.finish(event, 0)

    def finish(self, event, commit=0):
        target = self.target
        source = self.source
        widget = self.initial_widget
        root = self.root
        try:
            del root.__dnd
            self.initial_widget.unbind(self.release_pattern)
            self.initial_widget.unbind("<Motion>")
            widget['cursor'] = self.save_cursor
            self.target = self.source = self.initial_widget = self.root = None
            if target is not None:
                if commit:
                    target.dnd_commit(source, event)
                else:
                    target.dnd_leave(source, event)
        finally:
            source.dnd_end(target, event)


# ----------------------------------------------------------------------
# The rest is here for testing and demonstration purposes only!

class Icon:

    def __init__(self, name):
        self.name = name
        self.canvas = self.label = self.id = None

    def attach(self, canvas, x=10, y=10):
        if canvas is self.canvas:
            self.canvas.coords(self.id, x, y)
            return
        if self.canvas is not None:
            self.detach()
        if canvas is None:
            return
        label = tkinter.Label(canvas, text=self.name,
                              borderwidth=2, relief="raised")
        id = canvas.create_window(x, y, window=label, anchor="nw")
        self.canvas = canvas
        self.label = label
        self.id = id
        label.bind("<ButtonPress>", self.press)

    def detach(self):
        canvas = self.canvas
        if canvas is None:
            return
        id = self.id
        label = self.label
        self.canvas = self.label = self.id = None
        canvas.delete(id)
        label.destroy()

    def press(self, event):
        if dnd_start(self, event):
            # where the pointer is relative to the label widget:
            self.x_off = event.x
            self.y_off = event.y
            # where the widget is relative to the canvas:
            self.x_orig, self.y_orig = self.canvas.coords(self.id)

    def move(self, event):
        x, y = self.where(self.canvas, event)
        self.canvas.coords(self.id, x, y)

    def putback(self):
        self.canvas.coords(self.id, self.x_orig, self.y_orig)

    def where(self, canvas, event):
        # where the corner of the canvas is relative to the screen:
        x_org = canvas.winfo_rootx()
        y_org = canvas.winfo_rooty()
        # where the pointer is relative to the canvas widget:
        x = event.x_root - x_org
        y = event.y_root - y_org
        # compensate for initial pointer offset
        return x - self.x_off, y - self.y_off

    def dnd_end(self, target, event):
        pass


class Tester:

    def __init__(self, root):
        self.top = tkinter.Toplevel(root)
        self.canvas = tkinter.Canvas(self.top, width=100, height=100)
        self.canvas.pack(fill="both", expand=1)
        self.canvas.dnd_accept = self.dnd_accept

    def dnd_accept(self, source, event):
        return self

    def dnd_enter(self, source, event):
        self.canvas.focus_set() # Show highlight border
        x, y = source.where(self.canvas, event)
        x1, y1, x2, y2 = source.canvas.bbox(source.id)
        dx, dy = x2-x1, y2-y1
        self.dndid = self.canvas.create_rectangle(x, y, x+dx, y+dy)
        self.dnd_motion(source, event)

    def dnd_motion(self, source, event):
        x, y = source.where(self.canvas, event)
        x1, y1, x2, y2 = self.canvas.bbox(self.dndid)
        self.canvas.move(self.dndid, x-x1, y-y1)

    def dnd_leave(self, source, event):
        self.top.focus_set() # Hide highlight border
        self.canvas.delete(self.dndid)
        self.dndid = None

    def dnd_commit(self, source, event):
        self.dnd_leave(source, event)
        x, y = source.where(self.canvas, event)
        source.attach(self.canvas, x, y)


def test():
    root = tkinter.Tk()
    root.geometry("+1+1")
    tkinter.Button(command=root.quit, text="Quit").pack()
    t1 = Tester(root)
    t1.top.geometry("+1+60")
    t2 = Tester(root)
    t2.top.geometry("+120+60")
    t3 = Tester(root)
    t3.top.geometry("+240+60")
    i1 = Icon("ICON1")
    i2 = Icon("ICON2")
    i3 = Icon("ICON3")
    i1.attach(t1.canvas)
    i2.attach(t2.canvas)
    i3.attach(t3.canvas)
    root.mainloop()


if __name__ == '__main__':
    test()
filedialog.py000064400000035133151710635150007226 0ustar00"""File selection dialog classes.

Classes:

- FileDialog
- LoadFileDialog
- SaveFileDialog

This module also presents tk common file dialogues, it provides interfaces
to the native file dialogues available in Tk 4.2 and newer, and the
directory dialogue available in Tk 8.3 and newer.
These interfaces were written by Fredrik Lundh, May 1997.
"""
__all__ = ["FileDialog", "LoadFileDialog", "SaveFileDialog",
           "Open", "SaveAs", "Directory",
           "askopenfilename", "asksaveasfilename", "askopenfilenames",
           "askopenfile", "askopenfiles", "asksaveasfile", "askdirectory"]

import fnmatch
import os
from tkinter import (
    Frame, LEFT, YES, BOTTOM, Entry, TOP, Button, Tk, X,
    Toplevel, RIGHT, Y, END, Listbox, BOTH, Scrollbar,
)
from tkinter.dialog import Dialog
from tkinter import commondialog
from tkinter.simpledialog import _setup_dialog


dialogstates = {}


class FileDialog:

    """Standard file selection dialog -- no checks on selected file.

    Usage:

        d = FileDialog(master)
        fname = d.go(dir_or_file, pattern, default, key)
        if fname is None: ...canceled...
        else: ...open file...

    All arguments to go() are optional.

    The 'key' argument specifies a key in the global dictionary
    'dialogstates', which keeps track of the values for the directory
    and pattern arguments, overriding the values passed in (it does
    not keep track of the default argument!).  If no key is specified,
    the dialog keeps no memory of previous state.  Note that memory is
    kept even when the dialog is canceled.  (All this emulates the
    behavior of the Macintosh file selection dialogs.)

    """

    title = "File Selection Dialog"

    def __init__(self, master, title=None):
        if title is None: title = self.title
        self.master = master
        self.directory = None

        self.top = Toplevel(master)
        self.top.title(title)
        self.top.iconname(title)
        _setup_dialog(self.top)

        self.botframe = Frame(self.top)
        self.botframe.pack(side=BOTTOM, fill=X)

        self.selection = Entry(self.top)
        self.selection.pack(side=BOTTOM, fill=X)
        self.selection.bind('<Return>', self.ok_event)

        self.filter = Entry(self.top)
        self.filter.pack(side=TOP, fill=X)
        self.filter.bind('<Return>', self.filter_command)

        self.midframe = Frame(self.top)
        self.midframe.pack(expand=YES, fill=BOTH)

        self.filesbar = Scrollbar(self.midframe)
        self.filesbar.pack(side=RIGHT, fill=Y)
        self.files = Listbox(self.midframe, exportselection=0,
                             yscrollcommand=(self.filesbar, 'set'))
        self.files.pack(side=RIGHT, expand=YES, fill=BOTH)
        btags = self.files.bindtags()
        self.files.bindtags(btags[1:] + btags[:1])
        self.files.bind('<ButtonRelease-1>', self.files_select_event)
        self.files.bind('<Double-ButtonRelease-1>', self.files_double_event)
        self.filesbar.config(command=(self.files, 'yview'))

        self.dirsbar = Scrollbar(self.midframe)
        self.dirsbar.pack(side=LEFT, fill=Y)
        self.dirs = Listbox(self.midframe, exportselection=0,
                            yscrollcommand=(self.dirsbar, 'set'))
        self.dirs.pack(side=LEFT, expand=YES, fill=BOTH)
        self.dirsbar.config(command=(self.dirs, 'yview'))
        btags = self.dirs.bindtags()
        self.dirs.bindtags(btags[1:] + btags[:1])
        self.dirs.bind('<ButtonRelease-1>', self.dirs_select_event)
        self.dirs.bind('<Double-ButtonRelease-1>', self.dirs_double_event)

        self.ok_button = Button(self.botframe,
                                 text="OK",
                                 command=self.ok_command)
        self.ok_button.pack(side=LEFT)
        self.filter_button = Button(self.botframe,
                                    text="Filter",
                                    command=self.filter_command)
        self.filter_button.pack(side=LEFT, expand=YES)
        self.cancel_button = Button(self.botframe,
                                    text="Cancel",
                                    command=self.cancel_command)
        self.cancel_button.pack(side=RIGHT)

        self.top.protocol('WM_DELETE_WINDOW', self.cancel_command)
        # XXX Are the following okay for a general audience?
        self.top.bind('<Alt-w>', self.cancel_command)
        self.top.bind('<Alt-W>', self.cancel_command)

    def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None):
        if key and key in dialogstates:
            self.directory, pattern = dialogstates[key]
        else:
            dir_or_file = os.path.expanduser(dir_or_file)
            if os.path.isdir(dir_or_file):
                self.directory = dir_or_file
            else:
                self.directory, default = os.path.split(dir_or_file)
        self.set_filter(self.directory, pattern)
        self.set_selection(default)
        self.filter_command()
        self.selection.focus_set()
        self.top.wait_visibility() # window needs to be visible for the grab
        self.top.grab_set()
        self.how = None
        self.master.mainloop()          # Exited by self.quit(how)
        if key:
            directory, pattern = self.get_filter()
            if self.how:
                directory = os.path.dirname(self.how)
            dialogstates[key] = directory, pattern
        self.top.destroy()
        return self.how

    def quit(self, how=None):
        self.how = how
        self.master.quit()              # Exit mainloop()

    def dirs_double_event(self, event):
        self.filter_command()

    def dirs_select_event(self, event):
        dir, pat = self.get_filter()
        subdir = self.dirs.get('active')
        dir = os.path.normpath(os.path.join(self.directory, subdir))
        self.set_filter(dir, pat)

    def files_double_event(self, event):
        self.ok_command()

    def files_select_event(self, event):
        file = self.files.get('active')
        self.set_selection(file)

    def ok_event(self, event):
        self.ok_command()

    def ok_command(self):
        self.quit(self.get_selection())

    def filter_command(self, event=None):
        dir, pat = self.get_filter()
        try:
            names = os.listdir(dir)
        except OSError:
            self.master.bell()
            return
        self.directory = dir
        self.set_filter(dir, pat)
        names.sort()
        subdirs = [os.pardir]
        matchingfiles = []
        for name in names:
            fullname = os.path.join(dir, name)
            if os.path.isdir(fullname):
                subdirs.append(name)
            elif fnmatch.fnmatch(name, pat):
                matchingfiles.append(name)
        self.dirs.delete(0, END)
        for name in subdirs:
            self.dirs.insert(END, name)
        self.files.delete(0, END)
        for name in matchingfiles:
            self.files.insert(END, name)
        head, tail = os.path.split(self.get_selection())
        if tail == os.curdir: tail = ''
        self.set_selection(tail)

    def get_filter(self):
        filter = self.filter.get()
        filter = os.path.expanduser(filter)
        if filter[-1:] == os.sep or os.path.isdir(filter):
            filter = os.path.join(filter, "*")
        return os.path.split(filter)

    def get_selection(self):
        file = self.selection.get()
        file = os.path.expanduser(file)
        return file

    def cancel_command(self, event=None):
        self.quit()

    def set_filter(self, dir, pat):
        if not os.path.isabs(dir):
            try:
                pwd = os.getcwd()
            except OSError:
                pwd = None
            if pwd:
                dir = os.path.join(pwd, dir)
                dir = os.path.normpath(dir)
        self.filter.delete(0, END)
        self.filter.insert(END, os.path.join(dir or os.curdir, pat or "*"))

    def set_selection(self, file):
        self.selection.delete(0, END)
        self.selection.insert(END, os.path.join(self.directory, file))


class LoadFileDialog(FileDialog):

    """File selection dialog which checks that the file exists."""

    title = "Load File Selection Dialog"

    def ok_command(self):
        file = self.get_selection()
        if not os.path.isfile(file):
            self.master.bell()
        else:
            self.quit(file)


class SaveFileDialog(FileDialog):

    """File selection dialog which checks that the file may be created."""

    title = "Save File Selection Dialog"

    def ok_command(self):
        file = self.get_selection()
        if os.path.exists(file):
            if os.path.isdir(file):
                self.master.bell()
                return
            d = Dialog(self.top,
                       title="Overwrite Existing File Question",
                       text="Overwrite existing file %r?" % (file,),
                       bitmap='questhead',
                       default=1,
                       strings=("Yes", "Cancel"))
            if d.num != 0:
                return
        else:
            head, tail = os.path.split(file)
            if not os.path.isdir(head):
                self.master.bell()
                return
        self.quit(file)


# For the following classes and modules:
#
# options (all have default values):
#
# - defaultextension: added to filename if not explicitly given
#
# - filetypes: sequence of (label, pattern) tuples.  the same pattern
#   may occur with several patterns.  use "*" as pattern to indicate
#   all files.
#
# - initialdir: initial directory.  preserved by dialog instance.
#
# - initialfile: initial file (ignored by the open dialog).  preserved
#   by dialog instance.
#
# - parent: which window to place the dialog on top of
#
# - title: dialog title
#
# - multiple: if true user may select more than one file
#
# options for the directory chooser:
#
# - initialdir, parent, title: see above
#
# - mustexist: if true, user must pick an existing directory
#


class _Dialog(commondialog.Dialog):

    def _fixoptions(self):
        try:
            # make sure "filetypes" is a tuple
            self.options["filetypes"] = tuple(self.options["filetypes"])
        except KeyError:
            pass

    def _fixresult(self, widget, result):
        if result:
            # keep directory and filename until next time
            # convert Tcl path objects to strings
            try:
                result = result.string
            except AttributeError:
                # it already is a string
                pass
            path, file = os.path.split(result)
            self.options["initialdir"] = path
            self.options["initialfile"] = file
        self.filename = result # compatibility
        return result


#
# file dialogs

class Open(_Dialog):
    "Ask for a filename to open"

    command = "tk_getOpenFile"

    def _fixresult(self, widget, result):
        if isinstance(result, tuple):
            # multiple results:
            result = tuple([getattr(r, "string", r) for r in result])
            if result:
                path, file = os.path.split(result[0])
                self.options["initialdir"] = path
                # don't set initialfile or filename, as we have multiple of these
            return result
        if not widget.tk.wantobjects() and "multiple" in self.options:
            # Need to split result explicitly
            return self._fixresult(widget, widget.tk.splitlist(result))
        return _Dialog._fixresult(self, widget, result)


class SaveAs(_Dialog):
    "Ask for a filename to save as"

    command = "tk_getSaveFile"


# the directory dialog has its own _fix routines.
class Directory(commondialog.Dialog):
    "Ask for a directory"

    command = "tk_chooseDirectory"

    def _fixresult(self, widget, result):
        if result:
            # convert Tcl path objects to strings
            try:
                result = result.string
            except AttributeError:
                # it already is a string
                pass
            # keep directory until next time
            self.options["initialdir"] = result
        self.directory = result # compatibility
        return result

#
# convenience stuff


def askopenfilename(**options):
    "Ask for a filename to open"

    return Open(**options).show()


def asksaveasfilename(**options):
    "Ask for a filename to save as"

    return SaveAs(**options).show()


def askopenfilenames(**options):
    """Ask for multiple filenames to open

    Returns a list of filenames or empty list if
    cancel button selected
    """
    options["multiple"]=1
    return Open(**options).show()

# FIXME: are the following  perhaps a bit too convenient?


def askopenfile(mode = "r", **options):
    "Ask for a filename to open, and returned the opened file"

    filename = Open(**options).show()
    if filename:
        return open(filename, mode)
    return None


def askopenfiles(mode = "r", **options):
    """Ask for multiple filenames and return the open file
    objects

    returns a list of open file objects or an empty list if
    cancel selected
    """

    files = askopenfilenames(**options)
    if files:
        ofiles=[]
        for filename in files:
            ofiles.append(open(filename, mode))
        files=ofiles
    return files


def asksaveasfile(mode = "w", **options):
    "Ask for a filename to save as, and returned the opened file"

    filename = SaveAs(**options).show()
    if filename:
        return open(filename, mode)
    return None


def askdirectory (**options):
    "Ask for a directory, and return the file name"
    return Directory(**options).show()


# --------------------------------------------------------------------
# test stuff

def test():
    """Simple test program."""
    root = Tk()
    root.withdraw()
    fd = LoadFileDialog(root)
    loadfile = fd.go(key="test")
    fd = SaveFileDialog(root)
    savefile = fd.go(key="test")
    print(loadfile, savefile)

    # Since the file name may contain non-ASCII characters, we need
    # to find an encoding that likely supports the file name, and
    # displays correctly on the terminal.

    # Start off with UTF-8
    enc = "utf-8"

    # See whether CODESET is defined
    try:
        import locale
        locale.setlocale(locale.LC_ALL,'')
        enc = locale.nl_langinfo(locale.CODESET)
    except (ImportError, AttributeError):
        pass

    # dialog for opening files

    openfilename=askopenfilename(filetypes=[("all files", "*")])
    try:
        fp=open(openfilename,"r")
        fp.close()
    except BaseException as exc:
        print("Could not open File: ")
        print(exc)

    print("open", openfilename.encode(enc))

    # dialog for saving files

    saveasfilename=asksaveasfilename()
    print("saveas", saveasfilename.encode(enc))


if __name__ == '__main__':
    test()
font.py000064400000015530151710635150006074 0ustar00# Tkinter font wrapper
#
# written by Fredrik Lundh, February 1998
#

import itertools
import tkinter

__version__ = "0.9"
__all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC",
           "nametofont", "Font", "families", "names"]

# weight/slant
NORMAL = "normal"
ROMAN = "roman"
BOLD   = "bold"
ITALIC = "italic"


def nametofont(name, root=None):
    """Given the name of a tk named font, returns a Font representation.
    """
    return Font(name=name, exists=True, root=root)


class Font:
    """Represents a named font.

    Constructor options are:

    font -- font specifier (name, system font, or (family, size, style)-tuple)
    name -- name to use for this font configuration (defaults to a unique name)
    exists -- does a named font by this name already exist?
       Creates a new named font if False, points to the existing font if True.
       Raises _tkinter.TclError if the assertion is false.

       the following are ignored if font is specified:

    family -- font 'family', e.g. Courier, Times, Helvetica
    size -- font size in points
    weight -- font thickness: NORMAL, BOLD
    slant -- font slant: ROMAN, ITALIC
    underline -- font underlining: false (0), true (1)
    overstrike -- font strikeout: false (0), true (1)

    """

    counter = itertools.count(1)

    def _set(self, kw):
        options = []
        for k, v in kw.items():
            options.append("-"+k)
            options.append(str(v))
        return tuple(options)

    def _get(self, args):
        options = []
        for k in args:
            options.append("-"+k)
        return tuple(options)

    def _mkdict(self, args):
        options = {}
        for i in range(0, len(args), 2):
            options[args[i][1:]] = args[i+1]
        return options

    def __init__(self, root=None, font=None, name=None, exists=False,
                 **options):
        if root is None:
            root = tkinter._get_default_root('use font')
        tk = getattr(root, 'tk', root)
        if font:
            # get actual settings corresponding to the given font
            font = tk.splitlist(tk.call("font", "actual", font))
        else:
            font = self._set(options)
        if not name:
            name = "font" + str(next(self.counter))
        self.name = name

        if exists:
            self.delete_font = False
            # confirm font exists
            if self.name not in tk.splitlist(tk.call("font", "names")):
                raise tkinter._tkinter.TclError(
                    "named font %s does not already exist" % (self.name,))
            # if font config info supplied, apply it
            if font:
                tk.call("font", "configure", self.name, *font)
        else:
            # create new font (raises TclError if the font exists)
            tk.call("font", "create", self.name, *font)
            self.delete_font = True
        self._tk = tk
        self._split = tk.splitlist
        self._call  = tk.call

    def __str__(self):
        return self.name

    def __repr__(self):
        return f"<{self.__class__.__module__}.{self.__class__.__qualname__}" \
               f" object {self.name!r}>"

    def __eq__(self, other):
        if not isinstance(other, Font):
            return NotImplemented
        return self.name == other.name and self._tk == other._tk

    def __getitem__(self, key):
        return self.cget(key)

    def __setitem__(self, key, value):
        self.configure(**{key: value})

    def __del__(self):
        try:
            if self.delete_font:
                self._call("font", "delete", self.name)
        except Exception:
            pass

    def copy(self):
        "Return a distinct copy of the current font"
        return Font(self._tk, **self.actual())

    def actual(self, option=None, displayof=None):
        "Return actual font attributes"
        args = ()
        if displayof:
            args = ('-displayof', displayof)
        if option:
            args = args + ('-' + option, )
            return self._call("font", "actual", self.name, *args)
        else:
            return self._mkdict(
                self._split(self._call("font", "actual", self.name, *args)))

    def cget(self, option):
        "Get font attribute"
        return self._call("font", "config", self.name, "-"+option)

    def config(self, **options):
        "Modify font attributes"
        if options:
            self._call("font", "config", self.name,
                  *self._set(options))
        else:
            return self._mkdict(
                self._split(self._call("font", "config", self.name)))

    configure = config

    def measure(self, text, displayof=None):
        "Return text width"
        args = (text,)
        if displayof:
            args = ('-displayof', displayof, text)
        return self._tk.getint(self._call("font", "measure", self.name, *args))

    def metrics(self, *options, **kw):
        """Return font metrics.

        For best performance, create a dummy widget
        using this font before calling this method."""
        args = ()
        displayof = kw.pop('displayof', None)
        if displayof:
            args = ('-displayof', displayof)
        if options:
            args = args + self._get(options)
            return self._tk.getint(
                self._call("font", "metrics", self.name, *args))
        else:
            res = self._split(self._call("font", "metrics", self.name, *args))
            options = {}
            for i in range(0, len(res), 2):
                options[res[i][1:]] = self._tk.getint(res[i+1])
            return options


def families(root=None, displayof=None):
    "Get font families (as a tuple)"
    if root is None:
        root = tkinter._get_default_root('use font.families()')
    args = ()
    if displayof:
        args = ('-displayof', displayof)
    return root.tk.splitlist(root.tk.call("font", "families", *args))


def names(root=None):
    "Get names of defined fonts (as a tuple)"
    if root is None:
        root = tkinter._get_default_root('use font.names()')
    return root.tk.splitlist(root.tk.call("font", "names"))


# --------------------------------------------------------------------
# test stuff

if __name__ == "__main__":

    root = tkinter.Tk()

    # create a font
    f = Font(family="times", size=30, weight=NORMAL)

    print(f.actual())
    print(f.actual("family"))
    print(f.actual("weight"))

    print(f.config())
    print(f.cget("family"))
    print(f.cget("weight"))

    print(names())

    print(f.measure("hello"), f.metrics("linespace"))

    print(f.metrics(displayof=root))

    f = Font(font=("Courier", 20, "bold"))
    print(f.measure("hello"), f.metrics("linespace", displayof=root))

    w = tkinter.Label(root, text="Hello, world", font=f)
    w.pack()

    w = tkinter.Button(root, text="Quit!", command=root.destroy)
    w.pack()

    fb = Font(font=w["font"]).copy()
    fb.config(weight=BOLD)

    w.config(font=fb)

    tkinter.mainloop()
messagebox.py000064400000007425151710635150007267 0ustar00# tk common message boxes
#
# this module provides an interface to the native message boxes
# available in Tk 4.2 and newer.
#
# written by Fredrik Lundh, May 1997
#

#
# options (all have default values):
#
# - default: which button to make default (one of the reply codes)
#
# - icon: which icon to display (see below)
#
# - message: the message to display
#
# - parent: which window to place the dialog on top of
#
# - title: dialog title
#
# - type: dialog type; that is, which buttons to display (see below)
#

from tkinter.commondialog import Dialog

__all__ = ["showinfo", "showwarning", "showerror",
           "askquestion", "askokcancel", "askyesno",
           "askyesnocancel", "askretrycancel"]

#
# constants

# icons
ERROR = "error"
INFO = "info"
QUESTION = "question"
WARNING = "warning"

# types
ABORTRETRYIGNORE = "abortretryignore"
OK = "ok"
OKCANCEL = "okcancel"
RETRYCANCEL = "retrycancel"
YESNO = "yesno"
YESNOCANCEL = "yesnocancel"

# replies
ABORT = "abort"
RETRY = "retry"
IGNORE = "ignore"
OK = "ok"
CANCEL = "cancel"
YES = "yes"
NO = "no"


#
# message dialog class

class Message(Dialog):
    "A message box"

    command  = "tk_messageBox"


#
# convenience stuff

# Rename _icon and _type options to allow overriding them in options
def _show(title=None, message=None, _icon=None, _type=None, **options):
    if _icon and "icon" not in options:    options["icon"] = _icon
    if _type and "type" not in options:    options["type"] = _type
    if title:   options["title"] = title
    if message: options["message"] = message
    res = Message(**options).show()
    # In some Tcl installations, yes/no is converted into a boolean.
    if isinstance(res, bool):
        if res:
            return YES
        return NO
    # In others we get a Tcl_Obj.
    return str(res)


def showinfo(title=None, message=None, **options):
    "Show an info message"
    return _show(title, message, INFO, OK, **options)


def showwarning(title=None, message=None, **options):
    "Show a warning message"
    return _show(title, message, WARNING, OK, **options)


def showerror(title=None, message=None, **options):
    "Show an error message"
    return _show(title, message, ERROR, OK, **options)


def askquestion(title=None, message=None, **options):
    "Ask a question"
    return _show(title, message, QUESTION, YESNO, **options)


def askokcancel(title=None, message=None, **options):
    "Ask if operation should proceed; return true if the answer is ok"
    s = _show(title, message, QUESTION, OKCANCEL, **options)
    return s == OK


def askyesno(title=None, message=None, **options):
    "Ask a question; return true if the answer is yes"
    s = _show(title, message, QUESTION, YESNO, **options)
    return s == YES


def askyesnocancel(title=None, message=None, **options):
    "Ask a question; return true if the answer is yes, None if cancelled."
    s = _show(title, message, QUESTION, YESNOCANCEL, **options)
    # s might be a Tcl index object, so convert it to a string
    s = str(s)
    if s == CANCEL:
        return None
    return s == YES


def askretrycancel(title=None, message=None, **options):
    "Ask if operation should be retried; return true if the answer is yes"
    s = _show(title, message, WARNING, RETRYCANCEL, **options)
    return s == RETRY


# --------------------------------------------------------------------
# test stuff

if __name__ == "__main__":

    print("info", showinfo("Spam", "Egg Information"))
    print("warning", showwarning("Spam", "Egg Warning"))
    print("error", showerror("Spam", "Egg Alert"))
    print("question", askquestion("Spam", "Question?"))
    print("proceed", askokcancel("Spam", "Proceed?"))
    print("yes/no", askyesno("Spam", "Got it?"))
    print("yes/no/cancel", askyesnocancel("Spam", "Want it?"))
    print("try again", askretrycancel("Spam", "Try again?"))
scrolledtext.py000064400000003430151710635150007636 0ustar00"""A ScrolledText widget feels like a text widget but also has a
vertical scroll bar on its right.  (Later, options may be added to
add a horizontal bar as well, to make the bars disappear
automatically when not needed, to move them to the other side of the
window, etc.)

Configuration options are passed to the Text widget.
A Frame widget is inserted between the master and the text, to hold
the Scrollbar widget.
Most methods calls are inherited from the Text widget; Pack, Grid and
Place methods are redirected to the Frame widget however.
"""

from tkinter import Frame, Text, Scrollbar, Pack, Grid, Place
from tkinter.constants import RIGHT, LEFT, Y, BOTH

__all__ = ['ScrolledText']


class ScrolledText(Text):
    def __init__(self, master=None, **kw):
        self.frame = Frame(master)
        self.vbar = Scrollbar(self.frame)
        self.vbar.pack(side=RIGHT, fill=Y)

        kw.update({'yscrollcommand': self.vbar.set})
        Text.__init__(self, self.frame, **kw)
        self.pack(side=LEFT, fill=BOTH, expand=True)
        self.vbar['command'] = self.yview

        # Copy geometry methods of self.frame without overriding Text
        # methods -- hack!
        text_meths = vars(Text).keys()
        methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys()
        methods = methods.difference(text_meths)

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))

    def __str__(self):
        return str(self.frame)


def example():
    from tkinter.constants import END

    stext = ScrolledText(bg='white', height=10)
    stext.insert(END, __doc__)
    stext.pack(fill=BOTH, side=LEFT, expand=True)
    stext.focus_set()
    stext.mainloop()


if __name__ == "__main__":
    example()
simpledialog.py000064400000026751151710635150007606 0ustar00#
# An Introduction to Tkinter
#
# Copyright (c) 1997 by Fredrik Lundh
#
# This copyright applies to Dialog, askinteger, askfloat and asktring
#
# fredrik@pythonware.com
# http://www.pythonware.com
#
"""This modules handles dialog boxes.

It contains the following public symbols:

SimpleDialog -- A simple but flexible modal dialog box

Dialog -- a base class for dialogs

askinteger -- get an integer from the user

askfloat -- get a float from the user

askstring -- get a string from the user
"""

from tkinter import *
from tkinter import _get_temp_root, _destroy_temp_root
from tkinter import messagebox


class SimpleDialog:

    def __init__(self, master,
                 text='', buttons=[], default=None, cancel=None,
                 title=None, class_=None):
        if class_:
            self.root = Toplevel(master, class_=class_)
        else:
            self.root = Toplevel(master)
        if title:
            self.root.title(title)
            self.root.iconname(title)

        _setup_dialog(self.root)

        self.message = Message(self.root, text=text, aspect=400)
        self.message.pack(expand=1, fill=BOTH)
        self.frame = Frame(self.root)
        self.frame.pack()
        self.num = default
        self.cancel = cancel
        self.default = default
        self.root.bind('<Return>', self.return_event)
        for num in range(len(buttons)):
            s = buttons[num]
            b = Button(self.frame, text=s,
                       command=(lambda self=self, num=num: self.done(num)))
            if num == default:
                b.config(relief=RIDGE, borderwidth=8)
            b.pack(side=LEFT, fill=BOTH, expand=1)
        self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window)
        self.root.transient(master)
        _place_window(self.root, master)

    def go(self):
        self.root.wait_visibility()
        self.root.grab_set()
        self.root.mainloop()
        self.root.destroy()
        return self.num

    def return_event(self, event):
        if self.default is None:
            self.root.bell()
        else:
            self.done(self.default)

    def wm_delete_window(self):
        if self.cancel is None:
            self.root.bell()
        else:
            self.done(self.cancel)

    def done(self, num):
        self.num = num
        self.root.quit()


class Dialog(Toplevel):

    '''Class to open dialogs.

    This class is intended as a base class for custom dialogs
    '''

    def __init__(self, parent, title = None):
        '''Initialize a dialog.

        Arguments:

            parent -- a parent window (the application window)

            title -- the dialog title
        '''
        master = parent
        if master is None:
            master = _get_temp_root()

        Toplevel.__init__(self, master)

        self.withdraw() # remain invisible for now
        # If the parent is not viewable, don't
        # make the child transient, or else it
        # would be opened withdrawn
        if parent is not None and parent.winfo_viewable():
            self.transient(parent)

        if title:
            self.title(title)

        _setup_dialog(self)

        self.parent = parent

        self.result = None

        body = Frame(self)
        self.initial_focus = self.body(body)
        body.pack(padx=5, pady=5)

        self.buttonbox()

        if self.initial_focus is None:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)

        _place_window(self, parent)

        self.initial_focus.focus_set()

        # wait for window to appear on screen before calling grab_set
        self.wait_visibility()
        self.grab_set()
        self.wait_window(self)

    def destroy(self):
        '''Destroy the window'''
        self.initial_focus = None
        Toplevel.destroy(self)
        _destroy_temp_root(self.master)

    #
    # construction hooks

    def body(self, master):
        '''create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        '''
        pass

    def buttonbox(self):
        '''add standard button box.

        override if you do not want the standard buttons
        '''

        box = Frame(self)

        w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE)
        w.pack(side=LEFT, padx=5, pady=5)
        w = Button(box, text="Cancel", width=10, command=self.cancel)
        w.pack(side=LEFT, padx=5, pady=5)

        self.bind("<Return>", self.ok)
        self.bind("<Escape>", self.cancel)

        box.pack()

    #
    # standard button semantics

    def ok(self, event=None):

        if not self.validate():
            self.initial_focus.focus_set() # put focus back
            return

        self.withdraw()
        self.update_idletasks()

        try:
            self.apply()
        finally:
            self.cancel()

    def cancel(self, event=None):

        # put focus back to the parent window
        if self.parent is not None:
            self.parent.focus_set()
        self.destroy()

    #
    # command hooks

    def validate(self):
        '''validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        '''

        return 1 # override

    def apply(self):
        '''process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        '''

        pass # override


# Place a toplevel window at the center of parent or screen
# It is a Python implementation of ::tk::PlaceWindow.
def _place_window(w, parent=None):
    w.wm_withdraw() # Remain invisible while we figure out the geometry
    w.update_idletasks() # Actualize geometry information

    minwidth = w.winfo_reqwidth()
    minheight = w.winfo_reqheight()
    maxwidth = w.winfo_vrootwidth()
    maxheight = w.winfo_vrootheight()
    if parent is not None and parent.winfo_ismapped():
        x = parent.winfo_rootx() + (parent.winfo_width() - minwidth) // 2
        y = parent.winfo_rooty() + (parent.winfo_height() - minheight) // 2
        vrootx = w.winfo_vrootx()
        vrooty = w.winfo_vrooty()
        x = min(x, vrootx + maxwidth - minwidth)
        x = max(x, vrootx)
        y = min(y, vrooty + maxheight - minheight)
        y = max(y, vrooty)
        if w._windowingsystem == 'aqua':
            # Avoid the native menu bar which sits on top of everything.
            y = max(y, 22)
    else:
        x = (w.winfo_screenwidth() - minwidth) // 2
        y = (w.winfo_screenheight() - minheight) // 2

    w.wm_maxsize(maxwidth, maxheight)
    w.wm_geometry('+%d+%d' % (x, y))
    w.wm_deiconify() # Become visible at the desired location


def _setup_dialog(w):
    if w._windowingsystem == "aqua":
        w.tk.call("::tk::unsupported::MacWindowStyle", "style",
                  w, "moveableModal", "")
    elif w._windowingsystem == "x11":
        w.wm_attributes("-type", "dialog")

# --------------------------------------------------------------------
# convenience dialogues

class _QueryDialog(Dialog):

    def __init__(self, title, prompt,
                 initialvalue=None,
                 minvalue = None, maxvalue = None,
                 parent = None):

        self.prompt   = prompt
        self.minvalue = minvalue
        self.maxvalue = maxvalue

        self.initialvalue = initialvalue

        Dialog.__init__(self, parent, title)

    def destroy(self):
        self.entry = None
        Dialog.destroy(self)

    def body(self, master):

        w = Label(master, text=self.prompt, justify=LEFT)
        w.grid(row=0, padx=5, sticky=W)

        self.entry = Entry(master, name="entry")
        self.entry.grid(row=1, padx=5, sticky=W+E)

        if self.initialvalue is not None:
            self.entry.insert(0, self.initialvalue)
            self.entry.select_range(0, END)

        return self.entry

    def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1


class _QueryInteger(_QueryDialog):
    errormessage = "Not an integer."

    def getresult(self):
        return self.getint(self.entry.get())


def askinteger(title, prompt, **kw):
    '''get an integer from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is an integer
    '''
    d = _QueryInteger(title, prompt, **kw)
    return d.result


class _QueryFloat(_QueryDialog):
    errormessage = "Not a floating-point value."

    def getresult(self):
        return self.getdouble(self.entry.get())


def askfloat(title, prompt, **kw):
    '''get a float from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a float
    '''
    d = _QueryFloat(title, prompt, **kw)
    return d.result


class _QueryString(_QueryDialog):
    def __init__(self, *args, **kw):
        if "show" in kw:
            self.__show = kw["show"]
            del kw["show"]
        else:
            self.__show = None
        _QueryDialog.__init__(self, *args, **kw)

    def body(self, master):
        entry = _QueryDialog.body(self, master)
        if self.__show is not None:
            entry.configure(show=self.__show)
        return entry

    def getresult(self):
        return self.entry.get()


def askstring(title, prompt, **kw):
    '''get a string from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a string
    '''
    d = _QueryString(title, prompt, **kw)
    return d.result


if __name__ == '__main__':

    def test():
        root = Tk()
        def doit(root=root):
            d = SimpleDialog(root,
                         text="This is a test dialog.  "
                              "Would this have been an actual dialog, "
                              "the buttons below would have been glowing "
                              "in soft pink light.\n"
                              "Do you believe this?",
                         buttons=["Yes", "No", "Cancel"],
                         default=0,
                         cancel=2,
                         title="Test Dialog")
            print(d.go())
            print(askinteger("Spam", "Egg count", initialvalue=12*12))
            print(askfloat("Spam", "Egg weight\n(in tons)", minvalue=1,
                           maxvalue=100))
            print(askstring("Spam", "Egg label"))
        t = Button(root, text='Test', command=doit)
        t.pack()
        q = Button(root, text='Quit', command=t.quit)
        q.pack()
        t.mainloop()

    test()
tix.py000064400000226350151710635150005736 0ustar00# Tix.py -- Tix widget wrappers.
#
#       For Tix, see http://tix.sourceforge.net
#
#       - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
#         based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
#
# NOTE: In order to minimize changes to Tkinter.py, some of the code here
#       (TixWidget.__init__) has been taken from Tkinter (Widget.__init__)
#       and will break if there are major changes in Tkinter.
#
# The Tix widgets are represented by a class hierarchy in python with proper
# inheritance of base classes.
#
# As a result after creating a 'w = StdButtonBox', I can write
#              w.ok['text'] = 'Who Cares'
#    or              w.ok['bg'] = w['bg']
# or even       w.ok.invoke()
# etc.
#
# Compare the demo tixwidgets.py to the original Tcl program and you will
# appreciate the advantages.
#
# NOTE: This module is deprecated since Python 3.6.

import os
import warnings
import tkinter
from tkinter import *
from tkinter import _cnfmerge

warnings.warn(
    'The Tix Tk extension is unmaintained, and the tkinter.tix wrapper module'
    ' is deprecated in favor of tkinter.ttk',
    DeprecationWarning,
    stacklevel=2,
    )

# Some more constants (for consistency with Tkinter)
WINDOW = 'window'
TEXT = 'text'
STATUS = 'status'
IMMEDIATE = 'immediate'
IMAGE = 'image'
IMAGETEXT = 'imagetext'
BALLOON = 'balloon'
AUTO = 'auto'
ACROSSTOP = 'acrosstop'

# A few useful constants for the Grid widget
ASCII = 'ascii'
CELL = 'cell'
COLUMN = 'column'
DECREASING = 'decreasing'
INCREASING = 'increasing'
INTEGER = 'integer'
MAIN = 'main'
MAX = 'max'
REAL = 'real'
ROW = 'row'
S_REGION = 's-region'
X_REGION = 'x-region'
Y_REGION = 'y-region'

# Some constants used by Tkinter dooneevent()
TCL_DONT_WAIT     = 1 << 1
TCL_WINDOW_EVENTS = 1 << 2
TCL_FILE_EVENTS   = 1 << 3
TCL_TIMER_EVENTS  = 1 << 4
TCL_IDLE_EVENTS   = 1 << 5
TCL_ALL_EVENTS    = 0

# BEWARE - this is implemented by copying some code from the Widget class
#          in Tkinter (to override Widget initialization) and is therefore
#          liable to break.

# Could probably add this to Tkinter.Misc
class tixCommand:
    """The tix commands provide access to miscellaneous  elements
    of  Tix's  internal state and the Tix application context.
    Most of the information manipulated by these  commands pertains
    to  the  application  as a whole, or to a screen or
    display, rather than to a particular window.

    This is a mixin class, assumed to be mixed to Tkinter.Tk
    that supports the self.tk.call method.
    """

    def tix_addbitmapdir(self, directory):
        """Tix maintains a list of directories under which
        the  tix_getimage  and tix_getbitmap commands will
        search for image files. The standard bitmap  directory
        is $TIX_LIBRARY/bitmaps. The addbitmapdir command
        adds directory into this list. By  using  this
        command, the  image  files  of an applications can
        also be located using the tix_getimage or tix_getbitmap
        command.
        """
        return self.tk.call('tix', 'addbitmapdir', directory)

    def tix_cget(self, option):
        """Returns  the  current  value  of the configuration
        option given by option. Option may be  any  of  the
        options described in the CONFIGURATION OPTIONS section.
        """
        return self.tk.call('tix', 'cget', option)

    def tix_configure(self, cnf=None, **kw):
        """Query or modify the configuration options of the Tix application
        context. If no option is specified, returns a dictionary all of the
        available options.  If option is specified with no value, then the
        command returns a list describing the one named option (this list
        will be identical to the corresponding sublist of the value
        returned if no option is specified).  If one or more option-value
        pairs are specified, then the command modifies the given option(s)
        to have the given value(s); in this case the command returns an
        empty string. Option may be any of the configuration options.
        """
        # Copied from Tkinter.py
        if kw:
            cnf = _cnfmerge((cnf, kw))
        elif cnf:
            cnf = _cnfmerge(cnf)
        if cnf is None:
            return self._getconfigure('tix', 'configure')
        if isinstance(cnf, str):
            return self._getconfigure1('tix', 'configure', '-'+cnf)
        return self.tk.call(('tix', 'configure') + self._options(cnf))

    def tix_filedialog(self, dlgclass=None):
        """Returns the file selection dialog that may be shared among
        different calls from this application.  This command will create a
        file selection dialog widget when it is called the first time. This
        dialog will be returned by all subsequent calls to tix_filedialog.
        An optional dlgclass parameter can be passed to specified what type
        of file selection dialog widget is desired. Possible options are
        tix FileSelectDialog or tixExFileSelectDialog.
        """
        if dlgclass is not None:
            return self.tk.call('tix', 'filedialog', dlgclass)
        else:
            return self.tk.call('tix', 'filedialog')

    def tix_getbitmap(self, name):
        """Locates a bitmap file of the name name.xpm or name in one of the
        bitmap directories (see the tix_addbitmapdir command above).  By
        using tix_getbitmap, you can avoid hard coding the pathnames of the
        bitmap files in your application. When successful, it returns the
        complete pathname of the bitmap file, prefixed with the character
        '@'.  The returned value can be used to configure the -bitmap
        option of the TK and Tix widgets.
        """
        return self.tk.call('tix', 'getbitmap', name)

    def tix_getimage(self, name):
        """Locates an image file of the name name.xpm, name.xbm or name.ppm
        in one of the bitmap directories (see the addbitmapdir command
        above). If more than one file with the same name (but different
        extensions) exist, then the image type is chosen according to the
        depth of the X display: xbm images are chosen on monochrome
        displays and color images are chosen on color displays. By using
        tix_ getimage, you can avoid hard coding the pathnames of the
        image files in your application. When successful, this command
        returns the name of the newly created image, which can be used to
        configure the -image option of the Tk and Tix widgets.
        """
        return self.tk.call('tix', 'getimage', name)

    def tix_option_get(self, name):
        """Gets  the options  maintained  by  the  Tix
        scheme mechanism. Available options include:

            active_bg       active_fg      bg
            bold_font       dark1_bg       dark1_fg
            dark2_bg        dark2_fg       disabled_fg
            fg              fixed_font     font
            inactive_bg     inactive_fg    input1_bg
            input2_bg       italic_font    light1_bg
            light1_fg       light2_bg      light2_fg
            menu_font       output1_bg     output2_bg
            select_bg       select_fg      selector
            """
        # could use self.tk.globalgetvar('tixOption', name)
        return self.tk.call('tix', 'option', 'get', name)

    def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
        """Resets the scheme and fontset of the Tix application to
        newScheme and newFontSet, respectively.  This affects only those
        widgets created after this call. Therefore, it is best to call the
        resetoptions command before the creation of any widgets in a Tix
        application.

        The optional parameter newScmPrio can be given to reset the
        priority level of the Tk options set by the Tix schemes.

        Because of the way Tk handles the X option database, after Tix has
        been has imported and inited, it is not possible to reset the color
        schemes and font sets using the tix config command.  Instead, the
        tix_resetoptions command must be used.
        """
        if newScmPrio is not None:
            return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio)
        else:
            return self.tk.call('tix', 'resetoptions', newScheme, newFontSet)

class Tk(tkinter.Tk, tixCommand):
    """Toplevel widget of Tix which represents mostly the main window
    of an application. It has an associated Tcl interpreter."""
    def __init__(self, screenName=None, baseName=None, className='Tix'):
        tkinter.Tk.__init__(self, screenName, baseName, className)
        tixlib = os.environ.get('TIX_LIBRARY')
        self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]')
        if tixlib is not None:
            self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
            self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
        # Load Tix - this should work dynamically or statically
        # If it's static, tcl/tix8.1/pkgIndex.tcl should have
        #               'load {} Tix'
        # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have
        #               'load libtix8.1.8.3.so Tix'
        self.tk.eval('package require Tix')

    def destroy(self):
        # For safety, remove the delete_window binding before destroy
        self.protocol("WM_DELETE_WINDOW", "")
        tkinter.Tk.destroy(self)

# The Tix 'tixForm' geometry manager
class Form:
    """The Tix Form geometry manager

    Widgets can be arranged by specifying attachments to other widgets.
    See Tix documentation for complete details"""

    def config(self, cnf={}, **kw):
        self.tk.call('tixForm', self._w, *self._options(cnf, kw))

    form = config

    def __setitem__(self, key, value):
        Form.form(self, {key: value})

    def check(self):
        return self.tk.call('tixForm', 'check', self._w)

    def forget(self):
        self.tk.call('tixForm', 'forget', self._w)

    def grid(self, xsize=0, ysize=0):
        if (not xsize) and (not ysize):
            x = self.tk.call('tixForm', 'grid', self._w)
            y = self.tk.splitlist(x)
            z = ()
            for x in y:
                z = z + (self.tk.getint(x),)
            return z
        return self.tk.call('tixForm', 'grid', self._w, xsize, ysize)

    def info(self, option=None):
        if not option:
            return self.tk.call('tixForm', 'info', self._w)
        if option[0] != '-':
            option = '-' + option
        return self.tk.call('tixForm', 'info', self._w, option)

    def slaves(self):
        return [self._nametowidget(x) for x in
                self.tk.splitlist(
                       self.tk.call(
                       'tixForm', 'slaves', self._w))]



tkinter.Widget.__bases__ = tkinter.Widget.__bases__ + (Form,)

class TixWidget(tkinter.Widget):
    """A TixWidget class is used to package all (or most) Tix widgets.

    Widget initialization is extended in two ways:
       1) It is possible to give a list of options which must be part of
       the creation command (so called Tix 'static' options). These cannot be
       given as a 'config' command later.
       2) It is possible to give the name of an existing TK widget. These are
       child widgets created automatically by a Tix mega-widget. The Tk call
       to create these widgets is therefore bypassed in TixWidget.__init__

    Both options are for use by subclasses only.
    """
    def __init__ (self, master=None, widgetName=None,
                static_options=None, cnf={}, kw={}):
        # Merge keywords and dictionary arguments
        if kw:
            cnf = _cnfmerge((cnf, kw))
        else:
            cnf = _cnfmerge(cnf)

        # Move static options into extra. static_options must be
        # a list of keywords (or None).
        extra=()

        # 'options' is always a static option
        if static_options:
            static_options.append('options')
        else:
            static_options = ['options']

        for k,v in list(cnf.items()):
            if k in static_options:
                extra = extra + ('-' + k, v)
                del cnf[k]

        self.widgetName = widgetName
        self._setup(master, cnf)

        # If widgetName is None, this is a dummy creation call where the
        # corresponding Tk widget has already been created by Tix
        if widgetName:
            self.tk.call(widgetName, self._w, *extra)

        # Non-static options - to be done via a 'config' command
        if cnf:
            Widget.config(self, cnf)

        # Dictionary to hold subwidget names for easier access. We can't
        # use the children list because the public Tix names may not be the
        # same as the pathname component
        self.subwidget_list = {}

    # We set up an attribute access function so that it is possible to
    # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
    # when w is a StdButtonBox.
    # We can even do w.ok.invoke() because w.ok is subclassed from the
    # Button class if you go through the proper constructors
    def __getattr__(self, name):
        if name in self.subwidget_list:
            return self.subwidget_list[name]
        raise AttributeError(name)

    def set_silent(self, value):
        """Set a variable without calling its action routine"""
        self.tk.call('tixSetSilent', self._w, value)

    def subwidget(self, name):
        """Return the named subwidget (which must have been created by
        the sub-class)."""
        n = self._subwidget_name(name)
        if not n:
            raise TclError("Subwidget " + name + " not child of " + self._name)
        # Remove header of name and leading dot
        n = n[len(self._w)+1:]
        return self._nametowidget(n)

    def subwidgets_all(self):
        """Return all subwidgets."""
        names = self._subwidget_names()
        if not names:
            return []
        retlist = []
        for name in names:
            name = name[len(self._w)+1:]
            try:
                retlist.append(self._nametowidget(name))
            except:
                # some of the widgets are unknown e.g. border in LabelFrame
                pass
        return retlist

    def _subwidget_name(self,name):
        """Get a subwidget name (returns a String, not a Widget !)"""
        try:
            return self.tk.call(self._w, 'subwidget', name)
        except TclError:
            return None

    def _subwidget_names(self):
        """Return the name of all subwidgets."""
        try:
            x = self.tk.call(self._w, 'subwidgets', '-all')
            return self.tk.splitlist(x)
        except TclError:
            return None

    def config_all(self, option, value):
        """Set configuration options for all subwidgets (and self)."""
        if option == '':
            return
        elif not isinstance(option, str):
            option = repr(option)
        if not isinstance(value, str):
            value = repr(value)
        names = self._subwidget_names()
        for name in names:
            self.tk.call(name, 'configure', '-' + option, value)
    # These are missing from Tkinter
    def image_create(self, imgtype, cnf={}, master=None, **kw):
        if master is None:
            master = self
        if kw and cnf: cnf = _cnfmerge((cnf, kw))
        elif kw: cnf = kw
        options = ()
        for k, v in cnf.items():
            if callable(v):
                v = self._register(v)
            options = options + ('-'+k, v)
        return master.tk.call(('image', 'create', imgtype,) + options)
    def image_delete(self, imgname):
        try:
            self.tk.call('image', 'delete', imgname)
        except TclError:
            # May happen if the root was destroyed
            pass

# Subwidgets are child widgets created automatically by mega-widgets.
# In python, we have to create these subwidgets manually to mirror their
# existence in Tk/Tix.
class TixSubWidget(TixWidget):
    """Subwidget class.

    This is used to mirror child widgets automatically created
    by Tix/Tk as part of a mega-widget in Python (which is not informed
    of this)"""

    def __init__(self, master, name,
               destroy_physically=1, check_intermediate=1):
        if check_intermediate:
            path = master._subwidget_name(name)
            try:
                path = path[len(master._w)+1:]
                plist = path.split('.')
            except:
                plist = []

        if not check_intermediate:
            # immediate descendant
            TixWidget.__init__(self, master, None, None, {'name' : name})
        else:
            # Ensure that the intermediate widgets exist
            parent = master
            for i in range(len(plist) - 1):
                n = '.'.join(plist[:i+1])
                try:
                    w = master._nametowidget(n)
                    parent = w
                except KeyError:
                    # Create the intermediate widget
                    parent = TixSubWidget(parent, plist[i],
                                          destroy_physically=0,
                                          check_intermediate=0)
            # The Tk widget name is in plist, not in name
            if plist:
                name = plist[-1]
            TixWidget.__init__(self, parent, None, None, {'name' : name})
        self.destroy_physically = destroy_physically

    def destroy(self):
        # For some widgets e.g., a NoteBook, when we call destructors,
        # we must be careful not to destroy the frame widget since this
        # also destroys the parent NoteBook thus leading to an exception
        # in Tkinter when it finally calls Tcl to destroy the NoteBook
        for c in list(self.children.values()): c.destroy()
        if self._name in self.master.children:
            del self.master.children[self._name]
        if self._name in self.master.subwidget_list:
            del self.master.subwidget_list[self._name]
        if self.destroy_physically:
            # This is bypassed only for a few widgets
            self.tk.call('destroy', self._w)


# Useful class to create a display style - later shared by many items.
# Contributed by Steffen Kremser
class DisplayStyle:
    """DisplayStyle - handle configuration options shared by
    (multiple) Display Items"""

    def __init__(self, itemtype, cnf={}, *, master=None, **kw):
        if master is None:
            if 'refwindow' in kw:
                master = kw['refwindow']
            elif 'refwindow' in cnf:
                master = cnf['refwindow']
            else:
                master = tkinter._get_default_root('create display style')
        self.tk = master.tk
        self.stylename = self.tk.call('tixDisplayStyle', itemtype,
                            *self._options(cnf,kw) )

    def __str__(self):
        return self.stylename

    def _options(self, cnf, kw):
        if kw and cnf:
            cnf = _cnfmerge((cnf, kw))
        elif kw:
            cnf = kw
        opts = ()
        for k, v in cnf.items():
            opts = opts + ('-'+k, v)
        return opts

    def delete(self):
        self.tk.call(self.stylename, 'delete')

    def __setitem__(self,key,value):
        self.tk.call(self.stylename, 'configure', '-%s'%key, value)

    def config(self, cnf={}, **kw):
        return self._getconfigure(
            self.stylename, 'configure', *self._options(cnf,kw))

    def __getitem__(self,key):
        return self.tk.call(self.stylename, 'cget', '-%s'%key)


######################################################
### The Tix Widget classes - in alphabetical order ###
######################################################

class Balloon(TixWidget):
    """Balloon help widget.

    Subwidget       Class
    ---------       -----
    label           Label
    message         Message"""

    # FIXME: It should inherit -superclass tixShell
    def __init__(self, master=None, cnf={}, **kw):
        # static seem to be -installcolormap -initwait -statusbar -cursor
        static = ['options', 'installcolormap', 'initwait', 'statusbar',
                  'cursor']
        TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
        self.subwidget_list['label'] = _dummyLabel(self, 'label',
                                                   destroy_physically=0)
        self.subwidget_list['message'] = _dummyLabel(self, 'message',
                                                     destroy_physically=0)

    def bind_widget(self, widget, cnf={}, **kw):
        """Bind balloon widget to another.
        One balloon widget may be bound to several widgets at the same time"""
        self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw))

    def unbind_widget(self, widget):
        self.tk.call(self._w, 'unbind', widget._w)

class ButtonBox(TixWidget):
    """ButtonBox - A container for pushbuttons.
    Subwidgets are the buttons added with the add method.
    """
    def __init__(self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixButtonBox',
                           ['orientation', 'options'], cnf, kw)

    def add(self, name, cnf={}, **kw):
        """Add a button with given name to box."""

        btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
        self.subwidget_list[name] = _dummyButton(self, name)
        return btn

    def invoke(self, name):
        if name in self.subwidget_list:
            self.tk.call(self._w, 'invoke', name)

class ComboBox(TixWidget):
    """ComboBox - an Entry field with a dropdown menu. The user can select a
    choice by either typing in the entry subwidget or selecting from the
    listbox subwidget.

    Subwidget       Class
    ---------       -----
    entry       Entry
    arrow       Button
    slistbox    ScrolledListBox
    tick        Button
    cross       Button : present if created with the fancy option"""

    # FIXME: It should inherit -superclass tixLabelWidget
    def __init__ (self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixComboBox',
                           ['editable', 'dropdown', 'fancy', 'options'],
                           cnf, kw)
        self.subwidget_list['label'] = _dummyLabel(self, 'label')
        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
                                                                'slistbox')
        try:
            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
        except TypeError:
            # unavailable when -fancy not specified
            pass

    # align

    def add_history(self, str):
        self.tk.call(self._w, 'addhistory', str)

    def append_history(self, str):
        self.tk.call(self._w, 'appendhistory', str)

    def insert(self, index, str):
        self.tk.call(self._w, 'insert', index, str)

    def pick(self, index):
        self.tk.call(self._w, 'pick', index)

class Control(TixWidget):
    """Control - An entry field with value change arrows.  The user can
    adjust the value by pressing the two arrow buttons or by entering
    the value directly into the entry. The new value will be checked
    against the user-defined upper and lower limits.

    Subwidget       Class
    ---------       -----
    incr       Button
    decr       Button
    entry       Entry
    label       Label"""

    # FIXME: It should inherit -superclass tixLabelWidget
    def __init__ (self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
        self.subwidget_list['incr'] = _dummyButton(self, 'incr')
        self.subwidget_list['decr'] = _dummyButton(self, 'decr')
        self.subwidget_list['label'] = _dummyLabel(self, 'label')
        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')

    def decrement(self):
        self.tk.call(self._w, 'decr')

    def increment(self):
        self.tk.call(self._w, 'incr')

    def invoke(self):
        self.tk.call(self._w, 'invoke')

    def update(self):
        self.tk.call(self._w, 'update')

class DirList(TixWidget):
    """DirList - displays a list view of a directory, its previous
    directories and its sub-directories. The user can choose one of
    the directories displayed in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist       HList
    hsb              Scrollbar
    vsb              Scrollbar"""

    # FIXME: It should inherit -superclass tixScrolledHList
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

    def chdir(self, dir):
        self.tk.call(self._w, 'chdir', dir)

class DirTree(TixWidget):
    """DirTree - Directory Listing in a hierarchical view.
    Displays a tree view of a directory, its previous directories and its
    sub-directories. The user can choose one of the directories displayed
    in the list or change to another directory.

    Subwidget       Class
    ---------       -----
    hlist           HList
    hsb             Scrollbar
    vsb             Scrollbar"""

    # FIXME: It should inherit -superclass tixScrolledHList
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

    def chdir(self, dir):
        self.tk.call(self._w, 'chdir', dir)

class DirSelectBox(TixWidget):
    """DirSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBox"""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')

class ExFileSelectBox(TixWidget):
    """ExFileSelectBox - MS Windows style file select box.
    It provides a convenient method for the user to select files.

    Subwidget       Class
    ---------       -----
    cancel       Button
    ok              Button
    hidden       Checkbutton
    types       ComboBox
    dir              ComboBox
    file       ComboBox
    dirlist       ScrolledListBox
    filelist       ScrolledListBox"""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')

    def filter(self):
        self.tk.call(self._w, 'filter')

    def invoke(self):
        self.tk.call(self._w, 'invoke')


# Should inherit from a Dialog class
class DirSelectDialog(TixWidget):
    """The DirSelectDialog widget presents the directories in the file
    system in a dialog window. The user can use this dialog window to
    navigate through the file system to select the desired directory.

    Subwidgets       Class
    ----------       -----
    dirbox       DirSelectDialog"""

    # FIXME: It should inherit -superclass tixDialogShell
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixDirSelectDialog',
                           ['options'], cnf, kw)
        self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
        # cancel and ok buttons are missing

    def popup(self):
        self.tk.call(self._w, 'popup')

    def popdown(self):
        self.tk.call(self._w, 'popdown')


# Should inherit from a Dialog class
class ExFileSelectDialog(TixWidget):
    """ExFileSelectDialog - MS Windows style file select dialog.
    It provides a convenient method for the user to select files.

    Subwidgets       Class
    ----------       -----
    fsbox       ExFileSelectBox"""

    # FIXME: It should inherit -superclass tixDialogShell
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixExFileSelectDialog',
                           ['options'], cnf, kw)
        self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')

    def popup(self):
        self.tk.call(self._w, 'popup')

    def popdown(self):
        self.tk.call(self._w, 'popdown')

class FileSelectBox(TixWidget):
    """ExFileSelectBox - Motif style file select box.
    It is generally used for
    the user to choose a file. FileSelectBox stores the files mostly
    recently selected into a ComboBox widget so that they can be quickly
    selected again.

    Subwidget       Class
    ---------       -----
    selection       ComboBox
    filter          ComboBox
    dirlist         ScrolledListBox
    filelist        ScrolledListBox"""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')

    def apply_filter(self):              # name of subwidget is same as command
        self.tk.call(self._w, 'filter')

    def invoke(self):
        self.tk.call(self._w, 'invoke')

# Should inherit from a Dialog class
class FileSelectDialog(TixWidget):
    """FileSelectDialog - Motif style file select dialog.

    Subwidgets       Class
    ----------       -----
    btns       StdButtonBox
    fsbox       FileSelectBox"""

    # FIXME: It should inherit -superclass tixStdDialogShell
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixFileSelectDialog',
                           ['options'], cnf, kw)
        self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
        self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')

    def popup(self):
        self.tk.call(self._w, 'popup')

    def popdown(self):
        self.tk.call(self._w, 'popdown')

class FileEntry(TixWidget):
    """FileEntry - Entry field with button that invokes a FileSelectDialog.
    The user can type in the filename manually. Alternatively, the user can
    press the button widget that sits next to the entry, which will bring
    up a file selection dialog.

    Subwidgets       Class
    ----------       -----
    button       Button
    entry       Entry"""

    # FIXME: It should inherit -superclass tixLabelWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixFileEntry',
                           ['dialogtype', 'options'], cnf, kw)
        self.subwidget_list['button'] = _dummyButton(self, 'button')
        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')

    def invoke(self):
        self.tk.call(self._w, 'invoke')

    def file_dialog(self):
        # FIXME: return python object
        pass

class HList(TixWidget, XView, YView):
    """HList - Hierarchy display  widget can be used to display any data
    that have a hierarchical structure, for example, file system directory
    trees. The list entries are indented and connected by branch lines
    according to their places in the hierarchy.

    Subwidgets - None"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixHList',
                           ['columns', 'options'], cnf, kw)

    def add(self, entry, cnf={}, **kw):
        return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw))

    def add_child(self, parent=None, cnf={}, **kw):
        if parent is None:
            parent = ''
        return self.tk.call(
                     self._w, 'addchild', parent, *self._options(cnf, kw))

    def anchor_set(self, entry):
        self.tk.call(self._w, 'anchor', 'set', entry)

    def anchor_clear(self):
        self.tk.call(self._w, 'anchor', 'clear')

    def column_width(self, col=0, width=None, chars=None):
        if not chars:
            return self.tk.call(self._w, 'column', 'width', col, width)
        else:
            return self.tk.call(self._w, 'column', 'width', col,
                                '-char', chars)

    def delete_all(self):
        self.tk.call(self._w, 'delete', 'all')

    def delete_entry(self, entry):
        self.tk.call(self._w, 'delete', 'entry', entry)

    def delete_offsprings(self, entry):
        self.tk.call(self._w, 'delete', 'offsprings', entry)

    def delete_siblings(self, entry):
        self.tk.call(self._w, 'delete', 'siblings', entry)

    def dragsite_set(self, index):
        self.tk.call(self._w, 'dragsite', 'set', index)

    def dragsite_clear(self):
        self.tk.call(self._w, 'dragsite', 'clear')

    def dropsite_set(self, index):
        self.tk.call(self._w, 'dropsite', 'set', index)

    def dropsite_clear(self):
        self.tk.call(self._w, 'dropsite', 'clear')

    def header_create(self, col, cnf={}, **kw):
        self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw))

    def header_configure(self, col, cnf={}, **kw):
        if cnf is None:
            return self._getconfigure(self._w, 'header', 'configure', col)
        self.tk.call(self._w, 'header', 'configure', col,
                     *self._options(cnf, kw))

    def header_cget(self,  col, opt):
        return self.tk.call(self._w, 'header', 'cget', col, opt)

    def header_exists(self,  col):
        # A workaround to Tix library bug (issue #25464).
        # The documented command is "exists", but only erroneous "exist" is
        # accepted.
        return self.tk.getboolean(self.tk.call(self._w, 'header', 'exist', col))
    header_exist = header_exists

    def header_delete(self, col):
        self.tk.call(self._w, 'header', 'delete', col)

    def header_size(self, col):
        return self.tk.call(self._w, 'header', 'size', col)

    def hide_entry(self, entry):
        self.tk.call(self._w, 'hide', 'entry', entry)

    def indicator_create(self, entry, cnf={}, **kw):
        self.tk.call(
              self._w, 'indicator', 'create', entry, *self._options(cnf, kw))

    def indicator_configure(self, entry, cnf={}, **kw):
        if cnf is None:
            return self._getconfigure(
                self._w, 'indicator', 'configure', entry)
        self.tk.call(
              self._w, 'indicator', 'configure', entry, *self._options(cnf, kw))

    def indicator_cget(self,  entry, opt):
        return self.tk.call(self._w, 'indicator', 'cget', entry, opt)

    def indicator_exists(self,  entry):
        return self.tk.call (self._w, 'indicator', 'exists', entry)

    def indicator_delete(self, entry):
        self.tk.call(self._w, 'indicator', 'delete', entry)

    def indicator_size(self, entry):
        return self.tk.call(self._w, 'indicator', 'size', entry)

    def info_anchor(self):
        return self.tk.call(self._w, 'info', 'anchor')

    def info_bbox(self, entry):
        return self._getints(
                self.tk.call(self._w, 'info', 'bbox', entry)) or None

    def info_children(self, entry=None):
        c = self.tk.call(self._w, 'info', 'children', entry)
        return self.tk.splitlist(c)

    def info_data(self, entry):
        return self.tk.call(self._w, 'info', 'data', entry)

    def info_dragsite(self):
        return self.tk.call(self._w, 'info', 'dragsite')

    def info_dropsite(self):
        return self.tk.call(self._w, 'info', 'dropsite')

    def info_exists(self, entry):
        return self.tk.call(self._w, 'info', 'exists', entry)

    def info_hidden(self, entry):
        return self.tk.call(self._w, 'info', 'hidden', entry)

    def info_next(self, entry):
        return self.tk.call(self._w, 'info', 'next', entry)

    def info_parent(self, entry):
        return self.tk.call(self._w, 'info', 'parent', entry)

    def info_prev(self, entry):
        return self.tk.call(self._w, 'info', 'prev', entry)

    def info_selection(self):
        c = self.tk.call(self._w, 'info', 'selection')
        return self.tk.splitlist(c)

    def item_cget(self, entry, col, opt):
        return self.tk.call(self._w, 'item', 'cget', entry, col, opt)

    def item_configure(self, entry, col, cnf={}, **kw):
        if cnf is None:
            return self._getconfigure(self._w, 'item', 'configure', entry, col)
        self.tk.call(self._w, 'item', 'configure', entry, col,
              *self._options(cnf, kw))

    def item_create(self, entry, col, cnf={}, **kw):
        self.tk.call(
              self._w, 'item', 'create', entry, col, *self._options(cnf, kw))

    def item_exists(self, entry, col):
        return self.tk.call(self._w, 'item', 'exists', entry, col)

    def item_delete(self, entry, col):
        self.tk.call(self._w, 'item', 'delete', entry, col)

    def entrycget(self, entry, opt):
        return self.tk.call(self._w, 'entrycget', entry, opt)

    def entryconfigure(self, entry, cnf={}, **kw):
        if cnf is None:
            return self._getconfigure(self._w, 'entryconfigure', entry)
        self.tk.call(self._w, 'entryconfigure', entry,
              *self._options(cnf, kw))

    def nearest(self, y):
        return self.tk.call(self._w, 'nearest', y)

    def see(self, entry):
        self.tk.call(self._w, 'see', entry)

    def selection_clear(self, cnf={}, **kw):
        self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))

    def selection_includes(self, entry):
        return self.tk.call(self._w, 'selection', 'includes', entry)

    def selection_set(self, first, last=None):
        self.tk.call(self._w, 'selection', 'set', first, last)

    def show_entry(self, entry):
        return self.tk.call(self._w, 'show', 'entry', entry)

class InputOnly(TixWidget):
    """InputOnly - Invisible widget. Unix only.

    Subwidgets - None"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)

class LabelEntry(TixWidget):
    """LabelEntry - Entry field with label. Packages an entry widget
    and a label into one mega widget. It can be used to simplify the creation
    of ``entry-form'' type of interface.

    Subwidgets       Class
    ----------       -----
    label       Label
    entry       Entry"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixLabelEntry',
                           ['labelside','options'], cnf, kw)
        self.subwidget_list['label'] = _dummyLabel(self, 'label')
        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')

class LabelFrame(TixWidget):
    """LabelFrame - Labelled Frame container. Packages a frame widget
    and a label into one mega widget. To create widgets inside a
    LabelFrame widget, one creates the new widgets relative to the
    frame subwidget and manage them inside the frame subwidget.

    Subwidgets       Class
    ----------       -----
    label       Label
    frame       Frame"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixLabelFrame',
                           ['labelside','options'], cnf, kw)
        self.subwidget_list['label'] = _dummyLabel(self, 'label')
        self.subwidget_list['frame'] = _dummyFrame(self, 'frame')


class ListNoteBook(TixWidget):
    """A ListNoteBook widget is very similar to the TixNoteBook widget:
    it can be used to display many windows in a limited space using a
    notebook metaphor. The notebook is divided into a stack of pages
    (windows). At one time only one of these pages can be shown.
    The user can navigate through these pages by
    choosing the name of the desired page in the hlist subwidget."""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw)
        # Is this necessary? It's not an exposed subwidget in Tix.
        self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane',
                                                        destroy_physically=0)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist')

    def add(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
        self.subwidget_list[name] = TixSubWidget(self, name)
        return self.subwidget_list[name]

    def page(self, name):
        return self.subwidget(name)

    def pages(self):
        # Can't call subwidgets_all directly because we don't want .nbframe
        names = self.tk.splitlist(self.tk.call(self._w, 'pages'))
        ret = []
        for x in names:
            ret.append(self.subwidget(x))
        return ret

    def raise_page(self, name):              # raise is a python keyword
        self.tk.call(self._w, 'raise', name)

class Meter(TixWidget):
    """The Meter widget can be used to show the progress of a background
    job which may take a long time to execute.
    """

    def __init__(self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixMeter',
                           ['options'], cnf, kw)

class NoteBook(TixWidget):
    """NoteBook - Multi-page container widget (tabbed notebook metaphor).

    Subwidgets       Class
    ----------       -----
    nbframe       NoteBookFrame
    <pages>       page widgets added dynamically with the add method"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
        self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
                                                      destroy_physically=0)

    def add(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
        self.subwidget_list[name] = TixSubWidget(self, name)
        return self.subwidget_list[name]

    def delete(self, name):
        self.tk.call(self._w, 'delete', name)
        self.subwidget_list[name].destroy()
        del self.subwidget_list[name]

    def page(self, name):
        return self.subwidget(name)

    def pages(self):
        # Can't call subwidgets_all directly because we don't want .nbframe
        names = self.tk.splitlist(self.tk.call(self._w, 'pages'))
        ret = []
        for x in names:
            ret.append(self.subwidget(x))
        return ret

    def raise_page(self, name):              # raise is a python keyword
        self.tk.call(self._w, 'raise', name)

    def raised(self):
        return self.tk.call(self._w, 'raised')

class NoteBookFrame(TixWidget):
    # FIXME: This is dangerous to expose to be called on its own.
    pass

class OptionMenu(TixWidget):
    """OptionMenu - creates a menu button of options.

    Subwidget       Class
    ---------       -----
    menubutton      Menubutton
    menu            Menu"""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw)
        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')

    def add_command(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw))

    def add_separator(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw))

    def delete(self, name):
        self.tk.call(self._w, 'delete', name)

    def disable(self, name):
        self.tk.call(self._w, 'disable', name)

    def enable(self, name):
        self.tk.call(self._w, 'enable', name)

class PanedWindow(TixWidget):
    """PanedWindow - Multi-pane container widget
    allows the user to interactively manipulate the sizes of several
    panes. The panes can be arranged either vertically or horizontally.The
    user changes the sizes of the panes by dragging the resize handle
    between two panes.

    Subwidgets       Class
    ----------       -----
    <panes>       g/p widgets added dynamically with the add method."""

    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)

    # add delete forget panecget paneconfigure panes setsize
    def add(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
        self.subwidget_list[name] = TixSubWidget(self, name,
                                                 check_intermediate=0)
        return self.subwidget_list[name]

    def delete(self, name):
        self.tk.call(self._w, 'delete', name)
        self.subwidget_list[name].destroy()
        del self.subwidget_list[name]

    def forget(self, name):
        self.tk.call(self._w, 'forget', name)

    def panecget(self,  entry, opt):
        return self.tk.call(self._w, 'panecget', entry, opt)

    def paneconfigure(self, entry, cnf={}, **kw):
        if cnf is None:
            return self._getconfigure(self._w, 'paneconfigure', entry)
        self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw))

    def panes(self):
        names = self.tk.splitlist(self.tk.call(self._w, 'panes'))
        return [self.subwidget(x) for x in names]

class PopupMenu(TixWidget):
    """PopupMenu widget can be used as a replacement of the tk_popup command.
    The advantage of the Tix PopupMenu widget is it requires less application
    code to manipulate.


    Subwidgets       Class
    ----------       -----
    menubutton       Menubutton
    menu       Menu"""

    # FIXME: It should inherit -superclass tixShell
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')

    def bind_widget(self, widget):
        self.tk.call(self._w, 'bind', widget._w)

    def unbind_widget(self, widget):
        self.tk.call(self._w, 'unbind', widget._w)

    def post_widget(self, widget, x, y):
        self.tk.call(self._w, 'post', widget._w, x, y)

class ResizeHandle(TixWidget):
    """Internal widget to draw resize handles on Scrolled widgets."""
    def __init__(self, master, cnf={}, **kw):
        # There seems to be a Tix bug rejecting the configure method
        # Let's try making the flags -static
        flags = ['options', 'command', 'cursorfg', 'cursorbg',
                 'handlesize', 'hintcolor', 'hintwidth',
                 'x', 'y']
        # In fact, x y height width are configurable
        TixWidget.__init__(self, master, 'tixResizeHandle',
                           flags, cnf, kw)

    def attach_widget(self, widget):
        self.tk.call(self._w, 'attachwidget', widget._w)

    def detach_widget(self, widget):
        self.tk.call(self._w, 'detachwidget', widget._w)

    def hide(self, widget):
        self.tk.call(self._w, 'hide', widget._w)

    def show(self, widget):
        self.tk.call(self._w, 'show', widget._w)

class ScrolledHList(TixWidget):
    """ScrolledHList - HList with automatic scrollbars."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
                           cnf, kw)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class ScrolledListBox(TixWidget):
    """ScrolledListBox - Listbox with automatic scrollbars."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class ScrolledText(TixWidget):
    """ScrolledText - Text with automatic scrollbars."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
        self.subwidget_list['text'] = _dummyText(self, 'text')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class ScrolledTList(TixWidget):
    """ScrolledTList - TList with automatic scrollbars."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
                           cnf, kw)
        self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class ScrolledWindow(TixWidget):
    """ScrolledWindow - Window with automatic scrollbars."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
        self.subwidget_list['window'] = _dummyFrame(self, 'window')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class Select(TixWidget):
    """Select - Container of button subwidgets. It can be used to provide
    radio-box or check-box style of selection options for the user.

    Subwidgets are buttons added dynamically using the add method."""

    # FIXME: It should inherit -superclass tixLabelWidget
    def __init__(self, master, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixSelect',
                           ['allowzero', 'radio', 'orientation', 'labelside',
                            'options'],
                           cnf, kw)
        self.subwidget_list['label'] = _dummyLabel(self, 'label')

    def add(self, name, cnf={}, **kw):
        self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
        self.subwidget_list[name] = _dummyButton(self, name)
        return self.subwidget_list[name]

    def invoke(self, name):
        self.tk.call(self._w, 'invoke', name)

class Shell(TixWidget):
    """Toplevel window.

    Subwidgets - None"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw)

class DialogShell(TixWidget):
    """Toplevel window, with popup popdown and center methods.
    It tells the window manager that it is a dialog window and should be
    treated specially. The exact treatment depends on the treatment of
    the window manager.

    Subwidgets - None"""

    # FIXME: It should inherit from  Shell
    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master,
                           'tixDialogShell',
                           ['options', 'title', 'mapped',
                            'minheight', 'minwidth',
                            'parent', 'transient'], cnf, kw)

    def popdown(self):
        self.tk.call(self._w, 'popdown')

    def popup(self):
        self.tk.call(self._w, 'popup')

    def center(self):
        self.tk.call(self._w, 'center')

class StdButtonBox(TixWidget):
    """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """

    def __init__(self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixStdButtonBox',
                           ['orientation', 'options'], cnf, kw)
        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
        self.subwidget_list['help'] = _dummyButton(self, 'help')

    def invoke(self, name):
        if name in self.subwidget_list:
            self.tk.call(self._w, 'invoke', name)

class TList(TixWidget, XView, YView):
    """TList - Hierarchy display widget which can be
    used to display data in a tabular format. The list entries of a TList
    widget are similar to the entries in the Tk listbox widget. The main
    differences are (1) the TList widget can display the list entries in a
    two dimensional format and (2) you can use graphical images as well as
    multiple colors and fonts for the list entries.

    Subwidgets - None"""

    def __init__ (self,master=None,cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)

    def active_set(self, index):
        self.tk.call(self._w, 'active', 'set', index)

    def active_clear(self):
        self.tk.call(self._w, 'active', 'clear')

    def anchor_set(self, index):
        self.tk.call(self._w, 'anchor', 'set', index)

    def anchor_clear(self):
        self.tk.call(self._w, 'anchor', 'clear')

    def delete(self, from_, to=None):
        self.tk.call(self._w, 'delete', from_, to)

    def dragsite_set(self, index):
        self.tk.call(self._w, 'dragsite', 'set', index)

    def dragsite_clear(self):
        self.tk.call(self._w, 'dragsite', 'clear')

    def dropsite_set(self, index):
        self.tk.call(self._w, 'dropsite', 'set', index)

    def dropsite_clear(self):
        self.tk.call(self._w, 'dropsite', 'clear')

    def insert(self, index, cnf={}, **kw):
        self.tk.call(self._w, 'insert', index, *self._options(cnf, kw))

    def info_active(self):
        return self.tk.call(self._w, 'info', 'active')

    def info_anchor(self):
        return self.tk.call(self._w, 'info', 'anchor')

    def info_down(self, index):
        return self.tk.call(self._w, 'info', 'down', index)

    def info_left(self, index):
        return self.tk.call(self._w, 'info', 'left', index)

    def info_right(self, index):
        return self.tk.call(self._w, 'info', 'right', index)

    def info_selection(self):
        c = self.tk.call(self._w, 'info', 'selection')
        return self.tk.splitlist(c)

    def info_size(self):
        return self.tk.call(self._w, 'info', 'size')

    def info_up(self, index):
        return self.tk.call(self._w, 'info', 'up', index)

    def nearest(self, x, y):
        return self.tk.call(self._w, 'nearest', x, y)

    def see(self, index):
        self.tk.call(self._w, 'see', index)

    def selection_clear(self, cnf={}, **kw):
        self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))

    def selection_includes(self, index):
        return self.tk.call(self._w, 'selection', 'includes', index)

    def selection_set(self, first, last=None):
        self.tk.call(self._w, 'selection', 'set', first, last)

class Tree(TixWidget):
    """Tree - The tixTree widget can be used to display hierarchical
    data in a tree form. The user can adjust
    the view of the tree by opening or closing parts of the tree."""

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixTree',
                           ['options'], cnf, kw)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

    def autosetmode(self):
        '''This command calls the setmode method for all the entries in this
     Tree widget: if an entry has no child entries, its mode is set to
     none. Otherwise, if the entry has any hidden child entries, its mode is
     set to open; otherwise its mode is set to close.'''
        self.tk.call(self._w, 'autosetmode')

    def close(self, entrypath):
        '''Close the entry given by entryPath if its mode is close.'''
        self.tk.call(self._w, 'close', entrypath)

    def getmode(self, entrypath):
        '''Returns the current mode of the entry given by entryPath.'''
        return self.tk.call(self._w, 'getmode', entrypath)

    def open(self, entrypath):
        '''Open the entry given by entryPath if its mode is open.'''
        self.tk.call(self._w, 'open', entrypath)

    def setmode(self, entrypath, mode='none'):
        '''This command is used to indicate whether the entry given by
     entryPath has children entries and whether the children are visible. mode
     must be one of open, close or none. If mode is set to open, a (+)
     indicator is drawn next the entry. If mode is set to close, a (-)
     indicator is drawn next the entry. If mode is set to none, no
     indicators will be drawn for this entry. The default mode is none. The
     open mode indicates the entry has hidden children and this entry can be
     opened by the user. The close mode indicates that all the children of the
     entry are now visible and the entry can be closed by the user.'''
        self.tk.call(self._w, 'setmode', entrypath, mode)


# Could try subclassing Tree for CheckList - would need another arg to init
class CheckList(TixWidget):
    """The CheckList widget
    displays a list of items to be selected by the user. CheckList acts
    similarly to the Tk checkbutton or radiobutton widgets, except it is
    capable of handling many more items than checkbuttons or radiobuttons.
    """
    # FIXME: It should inherit -superclass tixTree
    def __init__(self, master=None, cnf={}, **kw):
        TixWidget.__init__(self, master, 'tixCheckList',
                           ['options', 'radio'], cnf, kw)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

    def autosetmode(self):
        '''This command calls the setmode method for all the entries in this
     Tree widget: if an entry has no child entries, its mode is set to
     none. Otherwise, if the entry has any hidden child entries, its mode is
     set to open; otherwise its mode is set to close.'''
        self.tk.call(self._w, 'autosetmode')

    def close(self, entrypath):
        '''Close the entry given by entryPath if its mode is close.'''
        self.tk.call(self._w, 'close', entrypath)

    def getmode(self, entrypath):
        '''Returns the current mode of the entry given by entryPath.'''
        return self.tk.call(self._w, 'getmode', entrypath)

    def open(self, entrypath):
        '''Open the entry given by entryPath if its mode is open.'''
        self.tk.call(self._w, 'open', entrypath)

    def getselection(self, mode='on'):
        '''Returns a list of items whose status matches status. If status is
     not specified, the list of items in the "on" status will be returned.
     Mode can be on, off, default'''
        return self.tk.splitlist(self.tk.call(self._w, 'getselection', mode))

    def getstatus(self, entrypath):
        '''Returns the current status of entryPath.'''
        return self.tk.call(self._w, 'getstatus', entrypath)

    def setstatus(self, entrypath, mode='on'):
        '''Sets the status of entryPath to be status. A bitmap will be
     displayed next to the entry its status is on, off or default.'''
        self.tk.call(self._w, 'setstatus', entrypath, mode)


###########################################################################
### The subclassing below is used to instantiate the subwidgets in each ###
### mega widget. This allows us to access their methods directly.       ###
###########################################################################

class _dummyButton(Button, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyCheckbutton(Checkbutton, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyEntry(Entry, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyFrame(Frame, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyLabel(Label, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyListbox(Listbox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyMenu(Menu, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyMenubutton(Menubutton, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyScrollbar(Scrollbar, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyText(Text, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class _dummyHList(HList, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyScrolledHList(ScrolledHList, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class _dummyTList(TList, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyComboBox(ComboBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically])
        self.subwidget_list['label'] = _dummyLabel(self, 'label')
        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')

        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
                                                                'slistbox')
        try:
            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
            #cross Button : present if created with the fancy option
            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
        except TypeError:
            # unavailable when -fancy not specified
            pass

class _dummyDirList(DirList, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')

class _dummyDirSelectBox(DirSelectBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')

class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')

class _dummyFileSelectBox(FileSelectBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')

class _dummyFileComboBox(ComboBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')

class _dummyStdButtonBox(StdButtonBox, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)
        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
        self.subwidget_list['help'] = _dummyButton(self, 'help')

class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget):
    def __init__(self, master, name, destroy_physically=0):
        TixSubWidget.__init__(self, master, name, destroy_physically)

class _dummyPanedWindow(PanedWindow, TixSubWidget):
    def __init__(self, master, name, destroy_physically=1):
        TixSubWidget.__init__(self, master, name, destroy_physically)

########################
### Utility Routines ###
########################

#mike Should tixDestroy be exposed as a wrapper? - but not for widgets.

def OptionName(widget):
    '''Returns the qualified path name for the widget. Normally used to set
    default options for subwidgets. See tixwidgets.py'''
    return widget.tk.call('tixOptionName', widget._w)

# Called with a dictionary argument of the form
# {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'}
# returns a string which can be used to configure the fsbox file types
# in an ExFileSelectBox. i.e.,
# '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}'
def FileTypeList(dict):
    s = ''
    for type in dict.keys():
        s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
    return s

# Still to be done:
# tixIconView
class CObjView(TixWidget):
    """This file implements the Canvas Object View widget. This is a base
    class of IconView. It implements automatic placement/adjustment of the
    scrollbars according to the canvas objects inside the canvas subwidget.
    The scrollbars are adjusted so that the canvas is just large enough
    to see all the objects.
    """
    # FIXME: It should inherit -superclass tixScrolledWidget
    pass


class Grid(TixWidget, XView, YView):
    '''The Tix Grid command creates a new window  and makes it into a
    tixGrid widget. Additional options, may be specified on the command
    line or in the option database to configure aspects such as its cursor
    and relief.

    A Grid widget displays its contents in a two dimensional grid of cells.
    Each cell may contain one Tix display item, which may be in text,
    graphics or other formats. See the DisplayStyle class for more information
    about Tix display items. Individual cells, or groups of cells, can be
    formatted with a wide range of attributes, such as its color, relief and
    border.

    Subwidgets - None'''
    # valid specific resources as of Tk 8.4
    # editdonecmd, editnotifycmd, floatingcols, floatingrows, formatcmd,
    # highlightbackground, highlightcolor, leftmargin, itemtype, selectmode,
    # selectunit, topmargin,
    def __init__(self, master=None, cnf={}, **kw):
        static= []
        self.cnf= cnf
        TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw)

    # valid options as of Tk 8.4
    # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget,
    # edit, entryconfigure, format, geometryinfo, info, index, move, nearest,
    # selection, set, size, unset, xview, yview
    def anchor_clear(self):
        """Removes the selection anchor."""
        self.tk.call(self, 'anchor', 'clear')

    def anchor_get(self):
        "Get the (x,y) coordinate of the current anchor cell"
        return self._getints(self.tk.call(self, 'anchor', 'get'))

    def anchor_set(self, x, y):
        """Set the selection anchor to the cell at (x, y)."""
        self.tk.call(self, 'anchor', 'set', x, y)

    def delete_row(self, from_, to=None):
        """Delete rows between from_ and to inclusive.
        If to is not provided,  delete only row at from_"""
        if to is None:
            self.tk.call(self, 'delete', 'row', from_)
        else:
            self.tk.call(self, 'delete', 'row', from_, to)

    def delete_column(self, from_, to=None):
        """Delete columns between from_ and to inclusive.
        If to is not provided,  delete only column at from_"""
        if to is None:
            self.tk.call(self, 'delete', 'column', from_)
        else:
            self.tk.call(self, 'delete', 'column', from_, to)

    def edit_apply(self):
        """If any cell is being edited, de-highlight the cell  and  applies
        the changes."""
        self.tk.call(self, 'edit', 'apply')

    def edit_set(self, x, y):
        """Highlights  the  cell  at  (x, y) for editing, if the -editnotify
        command returns True for this cell."""
        self.tk.call(self, 'edit', 'set', x, y)

    def entrycget(self, x, y, option):
        "Get the option value for cell at (x,y)"
        if option and option[0] != '-':
            option = '-' + option
        return self.tk.call(self, 'entrycget', x, y, option)

    def entryconfigure(self, x, y, cnf=None, **kw):
        return self._configure(('entryconfigure', x, y), cnf, kw)

    # def format
    # def index

    def info_exists(self, x, y):
        "Return True if display item exists at (x,y)"
        return self._getboolean(self.tk.call(self, 'info', 'exists', x, y))

    def info_bbox(self, x, y):
        # This seems to always return '', at least for 'text' displayitems
        return self.tk.call(self, 'info', 'bbox', x, y)

    def move_column(self, from_, to, offset):
        """Moves the range of columns from position FROM through TO by
        the distance indicated by OFFSET. For example, move_column(2, 4, 1)
        moves the columns 2,3,4 to columns 3,4,5."""
        self.tk.call(self, 'move', 'column', from_, to, offset)

    def move_row(self, from_, to, offset):
        """Moves the range of rows from position FROM through TO by
        the distance indicated by OFFSET.
        For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5."""
        self.tk.call(self, 'move', 'row', from_, to, offset)

    def nearest(self, x, y):
        "Return coordinate of cell nearest pixel coordinate (x,y)"
        return self._getints(self.tk.call(self, 'nearest', x, y))

    # def selection adjust
    # def selection clear
    # def selection includes
    # def selection set
    # def selection toggle

    def set(self, x, y, itemtype=None, **kw):
        args= self._options(self.cnf, kw)
        if itemtype is not None:
            args= ('-itemtype', itemtype) + args
        self.tk.call(self, 'set', x, y, *args)

    def size_column(self, index, **kw):
        """Queries or sets the size of the column given by
        INDEX.  INDEX may be any non-negative
        integer that gives the position of a given column.
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all columns.
        When no option-value pair is given, this command returns a tuple
        containing the current size setting of the given column.  When
        option-value pairs are given, the corresponding options of the
        size setting of the given column are changed. Options may be one
        of the following:
              pad0 pixels
                     Specifies the paddings to the left of a column.
              pad1 pixels
                     Specifies the paddings to the right of a column.
              size val
                     Specifies the width of a column.  Val may be:
                     "auto" -- the width of the column is set to the
                     width of the widest cell in the column;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the width of the column to the
                     given number of characters."""
        return self.tk.splitlist(self.tk.call(self._w, 'size', 'column', index,
                             *self._options({}, kw)))

    def size_row(self, index, **kw):
        """Queries or sets the size of the row given by
        INDEX. INDEX may be any non-negative
        integer that gives the position of a given row .
        INDEX can also be the string "default"; in this case, this command
        queries or sets the default size of all rows.
        When no option-value pair is given, this command returns a list con-
        taining the current size setting of the given row . When option-value
        pairs are given, the corresponding options of the size setting of the
        given row are changed. Options may be one of the following:
              pad0 pixels
                     Specifies the paddings to the top of a row.
              pad1 pixels
                     Specifies the paddings to the bottom of a row.
              size val
                     Specifies the height of a row.  Val may be:
                     "auto" -- the height of the row is set to the
                     height of the highest cell in the row;
                     a valid Tk screen distance unit;
                     or a real number following by the word chars
                     (e.g. 3.4chars) that sets the height of the row to the
                     given number of characters."""
        return self.tk.splitlist(self.tk.call(
                    self, 'size', 'row', index, *self._options({}, kw)))

    def unset(self, x, y):
        """Clears the cell at (x, y) by removing its display item."""
        self.tk.call(self._w, 'unset', x, y)


class ScrolledGrid(Grid):
    '''Scrolled Grid widgets'''

    # FIXME: It should inherit -superclass tixScrolledWidget
    def __init__(self, master=None, cnf={}, **kw):
        static= []
        self.cnf= cnf
        TixWidget.__init__(self, master, 'tixScrolledGrid', static, cnf, kw)
ttk.py000064400000155776151710635150005751 0ustar00"""Ttk wrapper.

This module provides classes to allow using Tk themed widget set.

Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.

Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
appearance. Widget class bindings are primarily responsible for
maintaining the widget state and invoking callbacks, all aspects
of the widgets appearance lies at Themes.
"""

__version__ = "0.3.1"

__author__ = "Guilherme Polo <ggpolo@gmail.com>"

__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
           "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow",
           "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar",
           "Separator", "Sizegrip", "Spinbox", "Style", "Treeview",
           # Extensions
           "LabeledScale", "OptionMenu",
           # functions
           "tclobjs_to_py", "setup_master"]

import tkinter
from tkinter import _flatten, _join, _stringify, _splitdict


def _format_optvalue(value, script=False):
    """Internal function."""
    if script:
        # if caller passes a Tcl script to tk.call, all the values need to
        # be grouped into words (arguments to a command in Tcl dialect)
        value = _stringify(value)
    elif isinstance(value, (list, tuple)):
        value = _join(value)
    return value

def _format_optdict(optdict, script=False, ignore=None):
    """Formats optdict to a tuple to pass it to tk.call.

    E.g. (script=False):
      {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
      ('-foreground', 'blue', '-padding', '1 2 3 4')"""

    opts = []
    for opt, value in optdict.items():
        if not ignore or opt not in ignore:
            opts.append("-%s" % opt)
            if value is not None:
                opts.append(_format_optvalue(value, script))

    return _flatten(opts)

def _mapdict_values(items):
    # each value in mapdict is expected to be a sequence, where each item
    # is another sequence containing a state (or several) and a value
    # E.g. (script=False):
    #   [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]
    #   returns:
    #   ['active selected', 'grey', 'focus', [1, 2, 3, 4]]
    opt_val = []
    for *state, val in items:
        if len(state) == 1:
            # if it is empty (something that evaluates to False), then
            # format it to Tcl code to denote the "normal" state
            state = state[0] or ''
        else:
            # group multiple states
            state = ' '.join(state) # raise TypeError if not str
        opt_val.append(state)
        if val is not None:
            opt_val.append(val)
    return opt_val

def _format_mapdict(mapdict, script=False):
    """Formats mapdict to pass it to tk.call.

    E.g. (script=False):
      {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]}

      returns:

      ('-expand', '{active selected} grey focus {1, 2, 3, 4}')"""

    opts = []
    for opt, value in mapdict.items():
        opts.extend(("-%s" % opt,
                     _format_optvalue(_mapdict_values(value), script)))

    return _flatten(opts)

def _format_elemcreate(etype, script=False, *args, **kw):
    """Formats args and kw according to the given element factory etype."""
    spec = None
    opts = ()
    if etype in ("image", "vsapi"):
        if etype == "image": # define an element based on an image
            # first arg should be the default image name
            iname = args[0]
            # next args, if any, are statespec/value pairs which is almost
            # a mapdict, but we just need the value
            imagespec = _join(_mapdict_values(args[1:]))
            spec = "%s %s" % (iname, imagespec)

        else:
            # define an element whose visual appearance is drawn using the
            # Microsoft Visual Styles API which is responsible for the
            # themed styles on Windows XP and Vista.
            # Availability: Tk 8.6, Windows XP and Vista.
            class_name, part_id = args[:2]
            statemap = _join(_mapdict_values(args[2:]))
            spec = "%s %s %s" % (class_name, part_id, statemap)

        opts = _format_optdict(kw, script)

    elif etype == "from": # clone an element
        # it expects a themename and optionally an element to clone from,
        # otherwise it will clone {} (empty element)
        spec = args[0] # theme name
        if len(args) > 1: # elementfrom specified
            opts = (_format_optvalue(args[1], script),)

    if script:
        spec = '{%s}' % spec
        opts = ' '.join(opts)

    return spec, opts

def _format_layoutlist(layout, indent=0, indent_size=2):
    """Formats a layout list so we can pass the result to ttk::style
    layout and ttk::style settings. Note that the layout doesn't have to
    be a list necessarily.

    E.g.:
      [("Menubutton.background", None),
       ("Menubutton.button", {"children":
           [("Menubutton.focus", {"children":
               [("Menubutton.padding", {"children":
                [("Menubutton.label", {"side": "left", "expand": 1})]
               })]
           })]
       }),
       ("Menubutton.indicator", {"side": "right"})
      ]

      returns:

      Menubutton.background
      Menubutton.button -children {
        Menubutton.focus -children {
          Menubutton.padding -children {
            Menubutton.label -side left -expand 1
          }
        }
      }
      Menubutton.indicator -side right"""
    script = []

    for layout_elem in layout:
        elem, opts = layout_elem
        opts = opts or {}
        fopts = ' '.join(_format_optdict(opts, True, ("children",)))
        head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '')

        if "children" in opts:
            script.append(head + " -children {")
            indent += indent_size
            newscript, indent = _format_layoutlist(opts['children'], indent,
                indent_size)
            script.append(newscript)
            indent -= indent_size
            script.append('%s}' % (' ' * indent))
        else:
            script.append(head)

    return '\n'.join(script), indent

def _script_from_settings(settings):
    """Returns an appropriate script, based on settings, according to
    theme_settings definition to be used by theme_settings and
    theme_create."""
    script = []
    # a script will be generated according to settings passed, which
    # will then be evaluated by Tcl
    for name, opts in settings.items():
        # will format specific keys according to Tcl code
        if opts.get('configure'): # format 'configure'
            s = ' '.join(_format_optdict(opts['configure'], True))
            script.append("ttk::style configure %s %s;" % (name, s))

        if opts.get('map'): # format 'map'
            s = ' '.join(_format_mapdict(opts['map'], True))
            script.append("ttk::style map %s %s;" % (name, s))

        if 'layout' in opts: # format 'layout' which may be empty
            if not opts['layout']:
                s = 'null' # could be any other word, but this one makes sense
            else:
                s, _ = _format_layoutlist(opts['layout'])
            script.append("ttk::style layout %s {\n%s\n}" % (name, s))

        if opts.get('element create'): # format 'element create'
            eopts = opts['element create']
            etype = eopts[0]

            # find where args end, and where kwargs start
            argc = 1 # etype was the first one
            while argc < len(eopts) and not hasattr(eopts[argc], 'items'):
                argc += 1

            elemargs = eopts[1:argc]
            elemkw = eopts[argc] if argc < len(eopts) and eopts[argc] else {}
            spec, opts = _format_elemcreate(etype, True, *elemargs, **elemkw)

            script.append("ttk::style element create %s %s %s %s" % (
                name, etype, spec, opts))

    return '\n'.join(script)

def _list_from_statespec(stuple):
    """Construct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict."""
    if isinstance(stuple, str):
        return stuple
    result = []
    it = iter(stuple)
    for state, val in zip(it, it):
        if hasattr(state, 'typename'):  # this is a Tcl object
            state = str(state).split()
        elif isinstance(state, str):
            state = state.split()
        elif not isinstance(state, (tuple, list)):
            state = (state,)
        if hasattr(val, 'typename'):
            val = str(val)
        result.append((*state, val))

    return result

def _list_from_layouttuple(tk, ltuple):
    """Construct a list from the tuple returned by ttk::layout, this is
    somewhat the reverse of _format_layoutlist."""
    ltuple = tk.splitlist(ltuple)
    res = []

    indx = 0
    while indx < len(ltuple):
        name = ltuple[indx]
        opts = {}
        res.append((name, opts))
        indx += 1

        while indx < len(ltuple): # grab name's options
            opt, val = ltuple[indx:indx + 2]
            if not opt.startswith('-'): # found next name
                break

            opt = opt[1:] # remove the '-' from the option
            indx += 2

            if opt == 'children':
                val = _list_from_layouttuple(tk, val)

            opts[opt] = val

    return res

def _val_or_dict(tk, options, *args):
    """Format options then call Tk command with args and options and return
    the appropriate result.

    If no option is specified, a dict is returned. If an option is
    specified with the None value, the value for that option is returned.
    Otherwise, the function just sets the passed options and the caller
    shouldn't be expecting a return value anyway."""
    options = _format_optdict(options)
    res = tk.call(*(args + options))

    if len(options) % 2: # option specified without a value, return its value
        return res

    return _splitdict(tk, res, conv=_tclobj_to_py)

def _convert_stringval(value):
    """Converts a value to, hopefully, a more appropriate Python object."""
    value = str(value)
    try:
        value = int(value)
    except (ValueError, TypeError):
        pass

    return value

def _to_number(x):
    if isinstance(x, str):
        if '.' in x:
            x = float(x)
        else:
            x = int(x)
    return x

def _tclobj_to_py(val):
    """Return value converted from Tcl object to Python object."""
    if val and hasattr(val, '__len__') and not isinstance(val, str):
        if getattr(val[0], 'typename', None) == 'StateSpec':
            val = _list_from_statespec(val)
        else:
            val = list(map(_convert_stringval, val))

    elif hasattr(val, 'typename'): # some other (single) Tcl object
        val = _convert_stringval(val)

    return val

def tclobjs_to_py(adict):
    """Returns adict with its values converted from Tcl objects to Python
    objects."""
    for opt, val in adict.items():
        adict[opt] = _tclobj_to_py(val)

    return adict

def setup_master(master=None):
    """If master is not None, itself is returned. If master is None,
    the default master is returned if there is one, otherwise a new
    master is created and returned.

    If it is not allowed to use the default root and master is None,
    RuntimeError is raised."""
    if master is None:
        master = tkinter._get_default_root()
    return master


class Style(object):
    """Manipulate style database."""

    _name = "ttk::style"

    def __init__(self, master=None):
        master = setup_master(master)
        self.master = master
        self.tk = self.master.tk


    def configure(self, style, query_opt=None, **kw):
        """Query or sets the default value of the specified option(s) in
        style.

        Each key in kw is an option and each value is either a string or
        a sequence identifying the value for that option."""
        if query_opt is not None:
            kw[query_opt] = None
        result = _val_or_dict(self.tk, kw, self._name, "configure", style)
        if result or query_opt:
            return result


    def map(self, style, query_opt=None, **kw):
        """Query or sets dynamic values of the specified option(s) in
        style.

        Each key in kw is an option and each value should be a list or a
        tuple (usually) containing statespecs grouped in tuples, or list,
        or something else of your preference. A statespec is compound of
        one or more states and then a value."""
        if query_opt is not None:
            result = self.tk.call(self._name, "map", style, '-%s' % query_opt)
            return _list_from_statespec(self.tk.splitlist(result))

        result = self.tk.call(self._name, "map", style, *_format_mapdict(kw))
        return {k: _list_from_statespec(self.tk.splitlist(v))
                for k, v in _splitdict(self.tk, result).items()}


    def lookup(self, style, option, state=None, default=None):
        """Returns the value specified for option in style.

        If state is specified it is expected to be a sequence of one
        or more states. If the default argument is set, it is used as
        a fallback value in case no specification for option is found."""
        state = ' '.join(state) if state else ''

        return self.tk.call(self._name, "lookup", style, '-%s' % option,
            state, default)


    def layout(self, style, layoutspec=None):
        """Define the widget layout for given style. If layoutspec is
        omitted, return the layout specification for given style.

        layoutspec is expected to be a list or an object different than
        None that evaluates to False if you want to "turn off" that style.
        If it is a list (or tuple, or something else), each item should be
        a tuple where the first item is the layout name and the second item
        should have the format described below:

        LAYOUTS

            A layout can contain the value None, if takes no options, or
            a dict of options specifying how to arrange the element.
            The layout mechanism uses a simplified version of the pack
            geometry manager: given an initial cavity, each element is
            allocated a parcel. Valid options/values are:

                side: whichside
                    Specifies which side of the cavity to place the
                    element; one of top, right, bottom or left. If
                    omitted, the element occupies the entire cavity.

                sticky: nswe
                    Specifies where the element is placed inside its
                    allocated parcel.

                children: [sublayout... ]
                    Specifies a list of elements to place inside the
                    element. Each element is a tuple (or other sequence)
                    where the first item is the layout name, and the other
                    is a LAYOUT."""
        lspec = None
        if layoutspec:
            lspec = _format_layoutlist(layoutspec)[0]
        elif layoutspec is not None: # will disable the layout ({}, '', etc)
            lspec = "null" # could be any other word, but this may make sense
                           # when calling layout(style) later

        return _list_from_layouttuple(self.tk,
            self.tk.call(self._name, "layout", style, lspec))


    def element_create(self, elementname, etype, *args, **kw):
        """Create a new element in the current theme of given etype."""
        spec, opts = _format_elemcreate(etype, False, *args, **kw)
        self.tk.call(self._name, "element", "create", elementname, etype,
            spec, *opts)


    def element_names(self):
        """Returns the list of elements defined in the current theme."""
        return tuple(n.lstrip('-') for n in self.tk.splitlist(
            self.tk.call(self._name, "element", "names")))


    def element_options(self, elementname):
        """Return the list of elementname's options."""
        return tuple(o.lstrip('-') for o in self.tk.splitlist(
            self.tk.call(self._name, "element", "options", elementname)))


    def theme_create(self, themename, parent=None, settings=None):
        """Creates a new theme.

        It is an error if themename already exists. If parent is
        specified, the new theme will inherit styles, elements and
        layouts from the specified parent theme. If settings are present,
        they are expected to have the same syntax used for theme_settings."""
        script = _script_from_settings(settings) if settings else ''

        if parent:
            self.tk.call(self._name, "theme", "create", themename,
                "-parent", parent, "-settings", script)
        else:
            self.tk.call(self._name, "theme", "create", themename,
                "-settings", script)


    def theme_settings(self, themename, settings):
        """Temporarily sets the current theme to themename, apply specified
        settings and then restore the previous theme.

        Each key in settings is a style and each value may contain the
        keys 'configure', 'map', 'layout' and 'element create' and they
        are expected to have the same format as specified by the methods
        configure, map, layout and element_create respectively."""
        script = _script_from_settings(settings)
        self.tk.call(self._name, "theme", "settings", themename, script)


    def theme_names(self):
        """Returns a list of all known themes."""
        return self.tk.splitlist(self.tk.call(self._name, "theme", "names"))


    def theme_use(self, themename=None):
        """If themename is None, returns the theme in use, otherwise, set
        the current theme to themename, refreshes all widgets and emits
        a <<ThemeChanged>> event."""
        if themename is None:
            # Starting on Tk 8.6, checking this global is no longer needed
            # since it allows doing self.tk.call(self._name, "theme", "use")
            return self.tk.eval("return $ttk::currentTheme")

        # using "ttk::setTheme" instead of "ttk::style theme use" causes
        # the variable currentTheme to be updated, also, ttk::setTheme calls
        # "ttk::style theme use" in order to change theme.
        self.tk.call("ttk::setTheme", themename)


class Widget(tkinter.Widget):
    """Base class for Tk themed widgets."""

    def __init__(self, master, widgetname, kw=None):
        """Constructs a Ttk Widget with the parent master.

        STANDARD OPTIONS

            class, cursor, takefocus, style

        SCROLLABLE WIDGET OPTIONS

            xscrollcommand, yscrollcommand

        LABEL WIDGET OPTIONS

            text, textvariable, underline, image, compound, width

        WIDGET STATES

            active, disabled, focus, pressed, selected, background,
            readonly, alternate, invalid
        """
        master = setup_master(master)
        tkinter.Widget.__init__(self, master, widgetname, kw=kw)


    def identify(self, x, y):
        """Returns the name of the element at position x, y, or the empty
        string if the point does not lie within any element.

        x and y are pixel coordinates relative to the widget."""
        return self.tk.call(self._w, "identify", x, y)


    def instate(self, statespec, callback=None, *args, **kw):
        """Test the widget's state.

        If callback is not specified, returns True if the widget state
        matches statespec and False otherwise. If callback is specified,
        then it will be invoked with *args, **kw if the widget state
        matches statespec. statespec is expected to be a sequence."""
        ret = self.tk.getboolean(
                self.tk.call(self._w, "instate", ' '.join(statespec)))
        if ret and callback is not None:
            return callback(*args, **kw)

        return ret


    def state(self, statespec=None):
        """Modify or inquire widget state.

        Widget state is returned if statespec is None, otherwise it is
        set according to the statespec flags and then a new state spec
        is returned indicating which flags were changed. statespec is
        expected to be a sequence."""
        if statespec is not None:
            statespec = ' '.join(statespec)

        return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec)))


class Button(Widget):
    """Ttk Button widget, displays a textual label and/or image, and
    evaluates a command when pressed."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Button widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, default, width
        """
        Widget.__init__(self, master, "ttk::button", kw)


    def invoke(self):
        """Invokes the command associated with the button."""
        return self.tk.call(self._w, "invoke")


class Checkbutton(Widget):
    """Ttk Checkbutton widget which is either in on- or off-state."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Checkbutton widget with the parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, offvalue, onvalue, variable
        """
        Widget.__init__(self, master, "ttk::checkbutton", kw)


    def invoke(self):
        """Toggles between the selected and deselected states and
        invokes the associated command. If the widget is currently
        selected, sets the option variable to the offvalue option
        and deselects the widget; otherwise, sets the option variable
        to the option onvalue.

        Returns the result of the associated command."""
        return self.tk.call(self._w, "invoke")


class Entry(Widget, tkinter.Entry):
    """Ttk Entry widget displays a one-line text string and allows that
    string to be edited by the user."""

    def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw)


    def bbox(self, index):
        """Return a tuple of (x, y, width, height) which describes the
        bounding box of the character given by index."""
        return self._getints(self.tk.call(self._w, "bbox", index))


    def identify(self, x, y):
        """Returns the name of the element at position x, y, or the
        empty string if the coordinates are outside the window."""
        return self.tk.call(self._w, "identify", x, y)


    def validate(self):
        """Force revalidation, independent of the conditions specified
        by the validate option. Returns False if validation fails, True
        if it succeeds. Sets or clears the invalid state accordingly."""
        return self.tk.getboolean(self.tk.call(self._w, "validate"))


class Combobox(Entry):
    """Ttk Combobox widget combines a text field with a pop-down list of
    values."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Combobox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            exportselection, justify, height, postcommand, state,
            textvariable, values, width
        """
        Entry.__init__(self, master, "ttk::combobox", **kw)


    def current(self, newindex=None):
        """If newindex is supplied, sets the combobox value to the
        element at position newindex in the list of values. Otherwise,
        returns the index of the current value in the list of values
        or -1 if the current value does not appear in the list."""
        if newindex is None:
            res = self.tk.call(self._w, "current")
            if res == '':
                return -1
            return self.tk.getint(res)
        return self.tk.call(self._w, "current", newindex)


    def set(self, value):
        """Sets the value of the combobox to value."""
        self.tk.call(self._w, "set", value)


class Frame(Widget):
    """Ttk Frame widget is a container, used to group other widgets
    together."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Frame with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            borderwidth, relief, padding, width, height
        """
        Widget.__init__(self, master, "ttk::frame", kw)


class Label(Widget):
    """Ttk Label widget displays a textual label and/or image."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Label with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, style, takefocus, text,
            textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            anchor, background, font, foreground, justify, padding,
            relief, text, wraplength
        """
        Widget.__init__(self, master, "ttk::label", kw)


class Labelframe(Widget):
    """Ttk Labelframe widget is a container used to group other widgets
    together. It has an optional label, which may be a plain text string
    or another widget."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Labelframe with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS
            labelanchor, text, underline, padding, labelwidget, width,
            height
        """
        Widget.__init__(self, master, "ttk::labelframe", kw)

LabelFrame = Labelframe # tkinter name compatibility


class Menubutton(Widget):
    """Ttk Menubutton widget displays a textual label and/or image, and
    displays a menu when pressed."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Menubutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            direction, menu
        """
        Widget.__init__(self, master, "ttk::menubutton", kw)


class Notebook(Widget):
    """Ttk Notebook widget manages a collection of windows and displays
    a single one at a time. Each child window is associated with a tab,
    which the user may select to change the currently-displayed window."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Notebook with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            height, padding, width

        TAB OPTIONS

            state, sticky, padding, text, image, compound, underline

        TAB IDENTIFIERS (tab_id)

            The tab_id argument found in several methods may take any of
            the following forms:

                * An integer between zero and the number of tabs
                * The name of a child window
                * A positional specification of the form "@x,y", which
                  defines the tab
                * The string "current", which identifies the
                  currently-selected tab
                * The string "end", which returns the number of tabs (only
                  valid for method index)
        """
        Widget.__init__(self, master, "ttk::notebook", kw)


    def add(self, child, **kw):
        """Adds a new tab to the notebook.

        If window is currently managed by the notebook but hidden, it is
        restored to its previous position."""
        self.tk.call(self._w, "add", child, *(_format_optdict(kw)))


    def forget(self, tab_id):
        """Removes the tab specified by tab_id, unmaps and unmanages the
        associated window."""
        self.tk.call(self._w, "forget", tab_id)


    def hide(self, tab_id):
        """Hides the tab specified by tab_id.

        The tab will not be displayed, but the associated window remains
        managed by the notebook and its configuration remembered. Hidden
        tabs may be restored with the add command."""
        self.tk.call(self._w, "hide", tab_id)


    def identify(self, x, y):
        """Returns the name of the tab element at position x, y, or the
        empty string if none."""
        return self.tk.call(self._w, "identify", x, y)


    def index(self, tab_id):
        """Returns the numeric index of the tab specified by tab_id, or
        the total number of tabs if tab_id is the string "end"."""
        return self.tk.getint(self.tk.call(self._w, "index", tab_id))


    def insert(self, pos, child, **kw):
        """Inserts a pane at the specified position.

        pos is either the string end, an integer index, or the name of
        a managed child. If child is already managed by the notebook,
        moves it to the specified position."""
        self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))


    def select(self, tab_id=None):
        """Selects the specified tab.

        The associated child window will be displayed, and the
        previously-selected window (if different) is unmapped. If tab_id
        is omitted, returns the widget name of the currently selected
        pane."""
        return self.tk.call(self._w, "select", tab_id)


    def tab(self, tab_id, option=None, **kw):
        """Query or modify the options of the specific tab_id.

        If kw is not given, returns a dict of the tab option values. If option
        is specified, returns the value of that option. Otherwise, sets the
        options to the corresponding values."""
        if option is not None:
            kw[option] = None
        return _val_or_dict(self.tk, kw, self._w, "tab", tab_id)


    def tabs(self):
        """Returns a list of windows managed by the notebook."""
        return self.tk.splitlist(self.tk.call(self._w, "tabs") or ())


    def enable_traversal(self):
        """Enable keyboard traversal for a toplevel window containing
        this notebook.

        This will extend the bindings for the toplevel window containing
        this notebook as follows:

            Control-Tab: selects the tab following the currently selected
                         one

            Shift-Control-Tab: selects the tab preceding the currently
                               selected one

            Alt-K: where K is the mnemonic (underlined) character of any
                   tab, will select that tab.

        Multiple notebooks in a single toplevel may be enabled for
        traversal, including nested notebooks. However, notebook traversal
        only works properly if all panes are direct children of the
        notebook."""
        # The only, and good, difference I see is about mnemonics, which works
        # after calling this method. Control-Tab and Shift-Control-Tab always
        # works (here at least).
        self.tk.call("ttk::notebook::enableTraversal", self._w)


class Panedwindow(Widget, tkinter.PanedWindow):
    """Ttk Panedwindow widget displays a number of subwindows, stacked
    either vertically or horizontally."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Panedwindow with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, width, height

        PANE OPTIONS

            weight
        """
        Widget.__init__(self, master, "ttk::panedwindow", kw)


    forget = tkinter.PanedWindow.forget # overrides Pack.forget


    def insert(self, pos, child, **kw):
        """Inserts a pane at the specified positions.

        pos is either the string end, and integer index, or the name
        of a child. If child is already managed by the paned window,
        moves it to the specified position."""
        self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))


    def pane(self, pane, option=None, **kw):
        """Query or modify the options of the specified pane.

        pane is either an integer index or the name of a managed subwindow.
        If kw is not given, returns a dict of the pane option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values."""
        if option is not None:
            kw[option] = None
        return _val_or_dict(self.tk, kw, self._w, "pane", pane)


    def sashpos(self, index, newpos=None):
        """If newpos is specified, sets the position of sash number index.

        May adjust the positions of adjacent sashes to ensure that
        positions are monotonically increasing. Sash positions are further
        constrained to be between 0 and the total size of the widget.

        Returns the new position of sash number index."""
        return self.tk.getint(self.tk.call(self._w, "sashpos", index, newpos))

PanedWindow = Panedwindow # tkinter name compatibility


class Progressbar(Widget):
    """Ttk Progressbar widget shows the status of a long-running
    operation. They can operate in two modes: determinate mode shows the
    amount completed relative to the total amount of work to be done, and
    indeterminate mode provides an animated display to let the user know
    that something is happening."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Progressbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient, length, mode, maximum, value, variable, phase
        """
        Widget.__init__(self, master, "ttk::progressbar", kw)


    def start(self, interval=None):
        """Begin autoincrement mode: schedules a recurring timer event
        that calls method step every interval milliseconds.

        interval defaults to 50 milliseconds (20 steps/second) if omitted."""
        self.tk.call(self._w, "start", interval)


    def step(self, amount=None):
        """Increments the value option by amount.

        amount defaults to 1.0 if omitted."""
        self.tk.call(self._w, "step", amount)


    def stop(self):
        """Stop autoincrement mode: cancels any recurring timer event
        initiated by start."""
        self.tk.call(self._w, "stop")


class Radiobutton(Widget):
    """Ttk Radiobutton widgets are used in groups to show or change a
    set of mutually-exclusive options."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Radiobutton with parent master.

        STANDARD OPTIONS

            class, compound, cursor, image, state, style, takefocus,
            text, textvariable, underline, width

        WIDGET-SPECIFIC OPTIONS

            command, value, variable
        """
        Widget.__init__(self, master, "ttk::radiobutton", kw)


    def invoke(self):
        """Sets the option variable to the option value, selects the
        widget, and invokes the associated command.

        Returns the result of the command, or an empty string if
        no command is specified."""
        return self.tk.call(self._w, "invoke")


class Scale(Widget, tkinter.Scale):
    """Ttk Scale widget is typically used to control the numeric value of
    a linked variable that varies uniformly over some range."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Scale with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, from, length, orient, to, value, variable
        """
        Widget.__init__(self, master, "ttk::scale", kw)


    def configure(self, cnf=None, **kw):
        """Modify or query scale options.

        Setting a value for any of the "from", "from_" or "to" options
        generates a <<RangeChanged>> event."""
        retval = Widget.configure(self, cnf, **kw)
        if not isinstance(cnf, (type(None), str)):
            kw.update(cnf)
        if any(['from' in kw, 'from_' in kw, 'to' in kw]):
            self.event_generate('<<RangeChanged>>')
        return retval


    def get(self, x=None, y=None):
        """Get the current value of the value option, or the value
        corresponding to the coordinates x, y if they are specified.

        x and y are pixel coordinates relative to the scale widget
        origin."""
        return self.tk.call(self._w, 'get', x, y)


class Scrollbar(Widget, tkinter.Scrollbar):
    """Ttk Scrollbar controls the viewport of a scrollable widget."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Scrollbar with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, orient
        """
        Widget.__init__(self, master, "ttk::scrollbar", kw)


class Separator(Widget):
    """Ttk Separator widget displays a horizontal or vertical separator
    bar."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Separator with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            orient
        """
        Widget.__init__(self, master, "ttk::separator", kw)


class Sizegrip(Widget):
    """Ttk Sizegrip allows the user to resize the containing toplevel
    window by pressing and dragging the grip."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Sizegrip with parent master.

        STANDARD OPTIONS

            class, cursor, state, style, takefocus
        """
        Widget.__init__(self, master, "ttk::sizegrip", kw)


class Spinbox(Entry):
    """Ttk Spinbox is an Entry with increment and decrement arrows

    It is commonly used for number entry or to select from a list of
    string values.
    """

    def __init__(self, master=None, **kw):
        """Construct a Ttk Spinbox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, validate,
            validatecommand, xscrollcommand, invalidcommand

        WIDGET-SPECIFIC OPTIONS

            to, from_, increment, values, wrap, format, command
        """
        Entry.__init__(self, master, "ttk::spinbox", **kw)


    def set(self, value):
        """Sets the value of the Spinbox to value."""
        self.tk.call(self._w, "set", value)


class Treeview(Widget, tkinter.XView, tkinter.YView):
    """Ttk Treeview widget displays a hierarchical collection of items.

    Each item has a textual label, an optional image, and an optional list
    of data values. The data values are displayed in successive columns
    after the tree label."""

    def __init__(self, master=None, **kw):
        """Construct a Ttk Treeview with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand,
            yscrollcommand

        WIDGET-SPECIFIC OPTIONS

            columns, displaycolumns, height, padding, selectmode, show

        ITEM OPTIONS

            text, image, values, open, tags

        TAG OPTIONS

            foreground, background, font, image
        """
        Widget.__init__(self, master, "ttk::treeview", kw)


    def bbox(self, item, column=None):
        """Returns the bounding box (relative to the treeview widget's
        window) of the specified item in the form x y width height.

        If column is specified, returns the bounding box of that cell.
        If the item is not visible (i.e., if it is a descendant of a
        closed item or is scrolled offscreen), returns an empty string."""
        return self._getints(self.tk.call(self._w, "bbox", item, column)) or ''


    def get_children(self, item=None):
        """Returns a tuple of children belonging to item.

        If item is not specified, returns root children."""
        return self.tk.splitlist(
                self.tk.call(self._w, "children", item or '') or ())


    def set_children(self, item, *newchildren):
        """Replaces item's child with newchildren.

        Children present in item that are not present in newchildren
        are detached from tree. No items in newchildren may be an
        ancestor of item."""
        self.tk.call(self._w, "children", item, newchildren)


    def column(self, column, option=None, **kw):
        """Query or modify the options for the specified column.

        If kw is not given, returns a dict of the column option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values."""
        if option is not None:
            kw[option] = None
        return _val_or_dict(self.tk, kw, self._w, "column", column)


    def delete(self, *items):
        """Delete all specified items and all their descendants. The root
        item may not be deleted."""
        self.tk.call(self._w, "delete", items)


    def detach(self, *items):
        """Unlinks all of the specified items from the tree.

        The items and all of their descendants are still present, and may
        be reinserted at another point in the tree, but will not be
        displayed. The root item may not be detached."""
        self.tk.call(self._w, "detach", items)


    def exists(self, item):
        """Returns True if the specified item is present in the tree,
        False otherwise."""
        return self.tk.getboolean(self.tk.call(self._w, "exists", item))


    def focus(self, item=None):
        """If item is specified, sets the focus item to item. Otherwise,
        returns the current focus item, or '' if there is none."""
        return self.tk.call(self._w, "focus", item)


    def heading(self, column, option=None, **kw):
        """Query or modify the heading options for the specified column.

        If kw is not given, returns a dict of the heading option values. If
        option is specified then the value for that option is returned.
        Otherwise, sets the options to the corresponding values.

        Valid options/values are:
            text: text
                The text to display in the column heading
            image: image_name
                Specifies an image to display to the right of the column
                heading
            anchor: anchor
                Specifies how the heading text should be aligned. One of
                the standard Tk anchor values
            command: callback
                A callback to be invoked when the heading label is
                pressed.

        To configure the tree column heading, call this with column = "#0" """
        cmd = kw.get('command')
        if cmd and not isinstance(cmd, str):
            # callback not registered yet, do it now
            kw['command'] = self.master.register(cmd, self._substitute)

        if option is not None:
            kw[option] = None

        return _val_or_dict(self.tk, kw, self._w, 'heading', column)


    def identify(self, component, x, y):
        """Returns a description of the specified component under the
        point given by x and y, or the empty string if no such component
        is present at that position."""
        return self.tk.call(self._w, "identify", component, x, y)


    def identify_row(self, y):
        """Returns the item ID of the item at position y."""
        return self.identify("row", 0, y)


    def identify_column(self, x):
        """Returns the data column identifier of the cell at position x.

        The tree column has ID #0."""
        return self.identify("column", x, 0)


    def identify_region(self, x, y):
        """Returns one of:

        heading: Tree heading area.
        separator: Space between two columns headings;
        tree: The tree area.
        cell: A data cell.

        * Availability: Tk 8.6"""
        return self.identify("region", x, y)


    def identify_element(self, x, y):
        """Returns the element at position x, y.

        * Availability: Tk 8.6"""
        return self.identify("element", x, y)


    def index(self, item):
        """Returns the integer index of item within its parent's list
        of children."""
        return self.tk.getint(self.tk.call(self._w, "index", item))


    def insert(self, parent, index, iid=None, **kw):
        """Creates a new item and return the item identifier of the newly
        created item.

        parent is the item ID of the parent item, or the empty string
        to create a new top-level item. index is an integer, or the value
        end, specifying where in the list of parent's children to insert
        the new item. If index is less than or equal to zero, the new node
        is inserted at the beginning, if index is greater than or equal to
        the current number of children, it is inserted at the end. If iid
        is specified, it is used as the item identifier, iid must not
        already exist in the tree. Otherwise, a new unique identifier
        is generated."""
        opts = _format_optdict(kw)
        if iid is not None:
            res = self.tk.call(self._w, "insert", parent, index,
                "-id", iid, *opts)
        else:
            res = self.tk.call(self._w, "insert", parent, index, *opts)

        return res


    def item(self, item, option=None, **kw):
        """Query or modify the options for the specified item.

        If no options are given, a dict with options/values for the item
        is returned. If option is specified then the value for that option
        is returned. Otherwise, sets the options to the corresponding
        values as given by kw."""
        if option is not None:
            kw[option] = None
        return _val_or_dict(self.tk, kw, self._w, "item", item)


    def move(self, item, parent, index):
        """Moves item to position index in parent's list of children.

        It is illegal to move an item under one of its descendants. If
        index is less than or equal to zero, item is moved to the
        beginning, if greater than or equal to the number of children,
        it is moved to the end. If item was detached it is reattached."""
        self.tk.call(self._w, "move", item, parent, index)

    reattach = move # A sensible method name for reattaching detached items


    def next(self, item):
        """Returns the identifier of item's next sibling, or '' if item
        is the last child of its parent."""
        return self.tk.call(self._w, "next", item)


    def parent(self, item):
        """Returns the ID of the parent of item, or '' if item is at the
        top level of the hierarchy."""
        return self.tk.call(self._w, "parent", item)


    def prev(self, item):
        """Returns the identifier of item's previous sibling, or '' if
        item is the first child of its parent."""
        return self.tk.call(self._w, "prev", item)


    def see(self, item):
        """Ensure that item is visible.

        Sets all of item's ancestors open option to True, and scrolls
        the widget if necessary so that item is within the visible
        portion of the tree."""
        self.tk.call(self._w, "see", item)


    def selection(self):
        """Returns the tuple of selected items."""
        return self.tk.splitlist(self.tk.call(self._w, "selection"))


    def _selection(self, selop, items):
        if len(items) == 1 and isinstance(items[0], (tuple, list)):
            items = items[0]

        self.tk.call(self._w, "selection", selop, items)


    def selection_set(self, *items):
        """The specified items becomes the new selection."""
        self._selection("set", items)


    def selection_add(self, *items):
        """Add all of the specified items to the selection."""
        self._selection("add", items)


    def selection_remove(self, *items):
        """Remove all of the specified items from the selection."""
        self._selection("remove", items)


    def selection_toggle(self, *items):
        """Toggle the selection state of each specified item."""
        self._selection("toggle", items)


    def set(self, item, column=None, value=None):
        """Query or set the value of given item.

        With one argument, return a dictionary of column/value pairs
        for the specified item. With two arguments, return the current
        value of the specified column. With three arguments, set the
        value of given column in given item to the specified value."""
        res = self.tk.call(self._w, "set", item, column, value)
        if column is None and value is None:
            return _splitdict(self.tk, res,
                              cut_minus=False, conv=_tclobj_to_py)
        else:
            return res


    def tag_bind(self, tagname, sequence=None, callback=None):
        """Bind a callback for the given event sequence to the tag tagname.
        When an event is delivered to an item, the callbacks for each
        of the item's tags option are called."""
        self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0)


    def tag_configure(self, tagname, option=None, **kw):
        """Query or modify the options for the specified tagname.

        If kw is not given, returns a dict of the option settings for tagname.
        If option is specified, returns the value for that option for the
        specified tagname. Otherwise, sets the options to the corresponding
        values for the given tagname."""
        if option is not None:
            kw[option] = None
        return _val_or_dict(self.tk, kw, self._w, "tag", "configure",
            tagname)


    def tag_has(self, tagname, item=None):
        """If item is specified, returns 1 or 0 depending on whether the
        specified item has the given tagname. Otherwise, returns a list of
        all items which have the specified tag.

        * Availability: Tk 8.6"""
        if item is None:
            return self.tk.splitlist(
                self.tk.call(self._w, "tag", "has", tagname))
        else:
            return self.tk.getboolean(
                self.tk.call(self._w, "tag", "has", tagname, item))


# Extensions

class LabeledScale(Frame):
    """A Ttk Scale widget with a Ttk Label widget indicating its
    current value.

    The Ttk Scale can be accessed through instance.scale, and Ttk Label
    can be accessed through instance.label"""

    def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
        """Construct a horizontal LabeledScale with parent master, a
        variable to be associated with the Ttk Scale widget and its range.
        If variable is not specified, a tkinter.IntVar is created.

        WIDGET-SPECIFIC OPTIONS

            compound: 'top' or 'bottom'
                Specifies how to display the label relative to the scale.
                Defaults to 'top'.
        """
        self._label_top = kw.pop('compound', 'top') == 'top'

        Frame.__init__(self, master, **kw)
        self._variable = variable or tkinter.IntVar(master)
        self._variable.set(from_)
        self._last_valid = from_

        self.label = Label(self)
        self.scale = Scale(self, variable=self._variable, from_=from_, to=to)
        self.scale.bind('<<RangeChanged>>', self._adjust)

        # position scale and label according to the compound option
        scale_side = 'bottom' if self._label_top else 'top'
        label_side = 'top' if scale_side == 'bottom' else 'bottom'
        self.scale.pack(side=scale_side, fill='x')
        # Dummy required to make frame correct height
        dummy = Label(self)
        dummy.pack(side=label_side)
        dummy.lower()
        self.label.place(anchor='n' if label_side == 'top' else 's')

        # update the label as scale or variable changes
        self.__tracecb = self._variable.trace_add('write', self._adjust)
        self.bind('<Configure>', self._adjust)
        self.bind('<Map>', self._adjust)


    def destroy(self):
        """Destroy this widget and possibly its associated variable."""
        try:
            self._variable.trace_remove('write', self.__tracecb)
        except AttributeError:
            pass
        else:
            del self._variable
        super().destroy()
        self.label = None
        self.scale = None


    def _adjust(self, *args):
        """Adjust the label position according to the scale."""
        def adjust_label():
            self.update_idletasks() # "force" scale redraw

            x, y = self.scale.coords()
            if self._label_top:
                y = self.scale.winfo_y() - self.label.winfo_reqheight()
            else:
                y = self.scale.winfo_reqheight() + self.label.winfo_reqheight()

            self.label.place_configure(x=x, y=y)

        from_ = _to_number(self.scale['from'])
        to = _to_number(self.scale['to'])
        if to < from_:
            from_, to = to, from_
        newval = self._variable.get()
        if not from_ <= newval <= to:
            # value outside range, set value back to the last valid one
            self.value = self._last_valid
            return

        self._last_valid = newval
        self.label['text'] = newval
        self.after_idle(adjust_label)

    @property
    def value(self):
        """Return current scale value."""
        return self._variable.get()

    @value.setter
    def value(self, val):
        """Set new scale value."""
        self._variable.set(val)


class OptionMenu(Menubutton):
    """Themed OptionMenu, based after tkinter's OptionMenu, which allows
    the user to select a value from a menu."""

    def __init__(self, master, variable, default=None, *values, **kwargs):
        """Construct a themed OptionMenu widget with master as the parent,
        the resource textvariable set to variable, the initially selected
        value specified by the default parameter, the menu values given by
        *values and additional keywords.

        WIDGET-SPECIFIC OPTIONS

            style: stylename
                Menubutton style.
            direction: 'above', 'below', 'left', 'right', or 'flush'
                Menubutton direction.
            command: callback
                A callback that will be invoked after selecting an item.
        """
        kw = {'textvariable': variable, 'style': kwargs.pop('style', None),
              'direction': kwargs.pop('direction', None)}
        Menubutton.__init__(self, master, **kw)
        self['menu'] = tkinter.Menu(self, tearoff=False)

        self._variable = variable
        self._callback = kwargs.pop('command', None)
        if kwargs:
            raise tkinter.TclError('unknown option -%s' % (
                next(iter(kwargs.keys()))))

        self.set_menu(default, *values)


    def __getitem__(self, item):
        if item == 'menu':
            return self.nametowidget(Menubutton.__getitem__(self, item))

        return Menubutton.__getitem__(self, item)


    def set_menu(self, default=None, *values):
        """Build a new menu of radiobuttons with *values and optionally
        a default value."""
        menu = self['menu']
        menu.delete(0, 'end')
        for val in values:
            menu.add_radiobutton(label=val,
                command=(
                    None if self._callback is None
                    else lambda val=val: self._callback(val)
                ),
                variable=self._variable)

        if default:
            self._variable.set(default)


    def destroy(self):
        """Destroy this widget and its associated variable."""
        try:
            del self._variable
        except AttributeError:
            pass
        super().destroy()