Hacked By AnonymousFox

Current Path : /usr/lib64/python3.8/tkinter/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/tkinter/__pycache__/__init__.cpython-38.pyc

U

e5d͕�@s�dZddlZddlZddlZejZddlTddlZdZeej	�Z
eej�Zej
Z
ejZejZe�d�Ze�dej�Zdd�Zd	d
�Zdd�Zz
ejZWnek
r�YnXd
d�Zz
ejZWnek
r�YnXdydd�ZGdd�deej�ZGdd�d�Zdadadd�Z dzdd�Z!dd�Z"d{dd�Z#da$Gdd�d�Z%Gd d!�d!e%�Z&Gd"d#�d#e%�Z'Gd$d%�d%e%�Z(Gd&d'�d'e%�Z)d|d(d)�Z*e+Z,eZ-d*d+�Z.Gd,d-�d-�Z/Gd.d/�d/�Z0Gd0d1�d1�Z1Gd2d3�d3�Z2Gd4d5�d5�Z3Gd6d7�d7e/e3�Z4d}d8d9�Z5Gd:d;�d;�Z6Gd<d=�d=�Z7Gd>d?�d?�Z8Gd@dA�dAe/�Z9GdBdC�dCe9e6e7e8�Z:GdDdE�dEe9e3�Z;GdFdG�dGe:�Z<GdHdI�dIe:e1e2�Z=GdJdK�dKe:�Z>GdLdM�dMe:e1�Z?GdNdO�dOe:�Z@GdPdQ�dQe:�ZAGdRdS�dSe:e1e2�ZBGdTdU�dUe:�ZCGdVdW�dWe:�ZDGdXdY�dYe:�ZEGdZd[�d[e:�ZFGd\d]�d]e:�ZGGd^d_�d_e:�ZHGd`da�dae:e1e2�ZIGdbdc�dc�ZJGddde�deeD�ZKGdfdg�dg�ZLGdhdi�dieL�ZMGdjdk�dkeL�ZNdldm�ZOdndo�ZPGdpdq�dqe:e1�ZQGdrds�dse:�ZRGdtdu�due:�ZSdvdw�ZTeUdxk�r�eT�dS)~a8Wrapper 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)�*�z([\\{}])z([\s])cCsd�tt|��S)�Internal function.� )�join�map�
_stringify��value�r�(/usr/lib64/python3.8/tkinter/__init__.py�_join8sr
cCs�t|ttf�rHt|�dkr:t|d�}t�|�rFd|}q�dt|�}ntt|�}|sZd}nbt�|�r�t�	d|�}|�
dd�}t�	d|�}|ddkr�d	|}n|ddks�t�|�r�d|}|S)
rrrz{%s}z{}z\\\1�
z\n�"�\)�
isinstance�list�tuple�lenr�	_magic_re�searchr
�str�sub�replace�	_space_rer	rrrr=s$



rcCs@d}|D]2}t|ttf�r(|t|�}q|dk	r||f}q|S)rrN)rrr�_flatten)�seq�res�itemrrrrVsrcCs�t|t�r|St|td�tf�r$|Si}t|�D]^}z|�|�Wq0ttfk
r�}z(td|�|�	�D]\}}|||<qjW5d}~XYq0Xq0|SdS)rNz_cnfmerge: fallback due to:)
r�dict�typerr�update�AttributeError�	TypeError�print�items)Zcnfs�cnf�c�msg�k�vrrr�	_cnfmergees

r+Tc	Csz|�|�}t|�drtd��t|�}i}t||�D]@\}}t|�}|r`|ddkr`|dd�}|rl||�}|||<q4|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)	�tkr*Z	cut_minus�conv�t�itr�keyr
rrr�
_splitdict{s

r7c@s�eZdZdZeZdZdZeZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)e*j+Z+d&S)'�	EventType�2�3�4�5�6�7�8�9Z10Z11Z12Z13Z14Z15Z16Z17Z18Z19Z20Z21Z22Z23Z24Z25Z26Z27Z28Z29Z30Z31Z32Z33Z34Z35Z36Z37Z38N),�__name__�
__module__�__qualname__ZKeyPressZKeyZ
KeyReleaseZButtonPress�ButtonZ
ButtonReleaseZMotionZEnterZLeaveZFocusInZFocusOutZKeymapZExposeZGraphicsExposeZNoExposeZ
VisibilityZCreateZDestroyZUnmapZMapZ
MapRequestZReparentZ	ConfigureZConfigureRequestZGravityZ
ResizeRequestZ	CirculateZCirculateRequestZPropertyZSelectionClearZSelectionRequestZ	SelectionZColormapZ
ClientMessage�MappingZVirtualEventZActivateZ
DeactivateZ
MouseWheelr�__str__rrrrr8�sPr8c@seZdZdZdd�ZdS)�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)
    csdd�|j��D��|js"�d=n|jdkr:t|j��d<t|dd�sL�d=|jdkr^�d=n|t|jt�r�|j}d	}g}t|�D]\}}|d
|>@r�|�	|�q�|d
t
|�>d
@}|s�|s�|�	t|��d�|��d<|j
dkr�d=d
}dt|jd|j�d��fdd�|D��fS)NcSsi|]\}}|dkr||�qS)�??r��.0r)r*rrr�
<dictcomp>�sz"Event.__repr__.<locals>.<dictcomp>�charrH�
send_eventTr�state)
ZShiftZLockZControlZMod1ZMod2ZMod3ZMod4ZMod5ZButton1ZButton2ZButton3ZButton4ZButton5r�|�delta)rMrN�keysym�keycoderL�numrP�focus�x�y�width�heightz<%s event%s>�name�c3s&|]}|�krd|�|fVqdS)z %s=%sNr)rJr)��attrsrr�	<genexpr>
sz!Event.__repr__.<locals>.<genexpr>)�__dict__r%rL�repr�getattrrNr�int�	enumerate�appendr�hexrrPr )�selfrNZmods�s�i�n�keysrr[r�__repr__�s6


�zEvent.__repr__N)rArBrC�__doc__rjrrrrrG�s*rGcCsdadabdS)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_rootrrrr�
NoDefaultRootsrncCs:tstd��ts6|r$td|�d���t�}t|ks6t�tS)NzINo master specified and tkinter is configured to not support default rootz
Too early to z: no default root window)rlr/rm�Tk�AssertionError)�what�rootrrr�_get_default_root#srscCsdS�rNr)�errrrr�_tkerror/srvcCs.zt|�}Wntk
r YnXt|��dS)zBInternal function. Calling it will raise the exception SystemExit.N)ra�
ValueError�
SystemExit)�coderrr�_exit4s
rzc@s�eZdZdZdZdZdZddd�Zdd�Zdd	�Z	d
d�Z
e
Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZdd�Zdd�Zdd�ZdS)�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().rZNcCs�|dk	rt|t�std��|s&td�}|��|_|j|_|rD||_ndtt	�|_t	d7a	|dk	rn|�
|�n&|j�|j�dd|j��s�|�
|j
�dS)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#rs�_rootr2�_tk�_namer_�_varnum�
initialize�
getboolean�call�_default�re�masterr
rYrrr�__init__Is

zVariable.__init__cCsb|jdkrdS|j�|j�dd|j��r6|j�|j�|jdk	r^|jD]}|j�|�qFd|_dS)zUnset the variable in Tcl.Nr}r~)r�r�r�r�Zglobalunsetvar�_tclCommands�
deletecommand�rerYrrr�__del__gs


zVariable.__del__cCs|jS)z'Return the name of the variable in Tcl.)r��rerrrrFsszVariable.__str__cCs|j�|j|�S�zSet the variable to VALUE.)r��globalsetvarr��rer
rrr�setwszVariable.setcCs|j�|j�S)zReturn value of variable.)r��globalgetvarr�r�rrr�get}szVariable.getcCs�t|d|j�j}tt|��}z
|j}Wntk
r:YnXz||j}Wntk
r^YnX|j�	||�|j
dkr~g|_
|j
�|�|S�N)�CallWrapperr�__call__r_�id�__func__r"rAr��
createcommandr�rc)re�callback�f�cbnamerrr�	_register�s

zVariable._registercCs(|�|�}|j�ddd|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�r�r�r��re�moder�r�rrr�	trace_add�s

�zVariable.trace_addcCsx|j�ddd|j||�|��D] \}}|j�|�d|kr qtq |j�|�z|j�|�Wntk
rrYnXdS)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)	r�r�r��
trace_infor.r�r�r�rw�rer�r��mZcarrr�trace_remove�s�zVariable.trace_removec
s4|jj��fdd�t��|j�ddd|j���D�S)z&Return all trace callback information.csg|]\}}�|�|f�qSrrrI�r.rr�
<listcomp>�sz'Variable.trace_info.<locals>.<listcomp>r�r}r�)r�r.rr�r�r�rr�rr��s�zVariable.trace_infocCs$|�|�}|j�dd|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�rrr�trace_variable�s
zVariable.trace_variablecCs�|j�dd|j||�|j�|�d}|��D] \}}|j�|�d|kr.q�q.|j�|�z|j�|�Wntk
r�YnXdS)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�ZvdeleterN)	r�r�r�r.r�r�r�r�rwr�rrr�
trace_vdelete�s
zVariable.trace_vdeletecs(�fdd��j��j�dd�j��D�S)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.
        csg|]}�j�|��qSr)r�r.�rJrUr�rrr��sz(Variable.trace_vinfo.<locals>.<listcomp>r�Zvinfo)r�r.r�r�r�rr�r�trace_vinfo�s�zVariable.trace_vinfocCs6t|t�stS|j|jko4|jj|jjko4|j|jkSr�)rr{�NotImplementedr��	__class__rAr�)re�otherrrr�__eq__�s
�
�zVariable.__eq__)NNN)rArBrCrkr�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�rrrrr{@s&

r{c@s&eZdZdZdZddd�Zdd�ZdS)	�	StringVarz#Value holder for strings variables.rZNcCst�||||�dS)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�rrrr��s
zStringVar.__init__cCs$|j�|j�}t|t�r|St|�S)z#Return value of variable as string.)r�r�r�rrr�rrrr�s
z
StringVar.get)NNN�rArBrCrkr�r�r�rrrrr��s
r�c@s&eZdZdZdZddd�Zdd�ZdS)	�IntVarz#Value holder for integer variables.rNcCst�||||�dS)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.
        Nr�r�rrrr�s
zIntVar.__init__c	CsJ|j�|j�}z|j�|�WSttfk
rDt|j�|��YSXdS)z/Return the value of the variable as an integer.N)r�r�r��getintr#�TclErrorra�	getdoubler�rrrr�s
z
IntVar.get)NNNr�rrrrr�
s
r�c@s&eZdZdZdZddd�Zdd�ZdS)	�	DoubleVarz!Value holder for float variables.gNcCst�||||�dS)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.
        Nr�r�rrrr�*s
zDoubleVar.__init__cCs|j�|j�|j��S)z,Return the value of the variable as a float.)r�r�r�r�r�rrrr�6sz
DoubleVar.get)NNNr�rrrrr�&s
r�c@s2eZdZdZdZd
dd�Zdd�ZeZdd	�ZdS)�
BooleanVarz#Value holder for boolean variables.FNcCst�||||�dS)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.
        Nr�r�rrrr�?s
zBooleanVar.__init__cCs|j�|j|j�|��Sr�)r�r�r�r�r�rrrr�KszBooleanVar.setcCs:z|j�|j�|j��WStk
r4td��YnXdS)z+Return the value of the variable as a bool.� invalid literal for getboolean()N)r�r�r�r�r�rwr�rrrr�QszBooleanVar.get)NNN)	rArBrCrkr�r�r�r�r�rrrrr�;s
r�cCstd�j�|�dS)zRun the main loop of Tcl.zrun the main loopN)rsr2�mainloop)rhrrrr�Ysr�cCs4ztd�j�|�WStk
r.td��YnXdS)z$Convert Tcl object to True or False.zuse getboolean()r�N)rsr2r�r�rw�rfrrrr�csr�c@s�eZdZdZdZdZdd�Zdd�Z�d1dd�Zd	d
�Z	dd�Z
�d2dd�ZeZ�d3dd�Z
�d4dd�Z�d5dd�Z�d6dd�Zdd�Zdd�Zdd�Zdd �ZeZd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z�d7d/d0�Zd1d2�Zd3d4�Z�d8d6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(�d9dHdI�Z)dJdK�Z*dLdM�Z+�d:dNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/dVdW�Z0dXdY�Z1dZd[�Z2�d;d\d]�Z3�d<d^d_�Z4e4Z5�d=d`da�Z6�d>dbdc�Z7ddde�Z8dfdg�Z9dhdi�Z:djdk�Z;�d?dldm�Z<dndo�Z=dpdq�Z>drds�Z?dtdu�Z@dvdw�ZAdxdy�ZB�d@dzd{�ZCd|d}�ZDd~d�ZEd�d��ZFd�d��ZG�dAd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\d�d��Z]d�d��Z^�dBd�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d„Zfd�dĄZgd�dƄZhd�dȄZid�dʄZj�dCd�d̄Zk�dDd�dτZl�dEd�dфZm�dFd�dӄZn�dGd�dՄZod�dׄZp�dHd�dلZqd�dۄZr�dId�d݄Zsd�d߄Ztd�d�Zud�d�Zvd�d�Zwd�d�Zxeyd�d��Zz�dJd�d�Z{d�d�Z|e|Z}�dKd�d�Z~e~Zd�d�Z�d�Z�d�e��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z��dLd�d��Z�e�Z��d�d�Z�e�Z��d�d�Z��d�d�Z��d�d�Z��d�d	�Z��d
gZ�e�f�d�d�Z�e�Z��d
�d�Z�e�Z��d�d�Z��dM�d�d�Z�e�Z��dN�d�d�Z�e�Z��d�d�Z��d�d�Z�if�d�d�Z�e�Z��d�d�Z�e�f�d�d�Z�if�d�d �Z�e�Z��d!�d"�Z�e�Z��dO�d#�d$�Z��d%�d&�Z��d'�d(�Z��d)�d*�Z��dP�d+�d,�Z��d-�d.�Z��d/�d0�Z�dS(Q�MisczRInternal class.

    Base class which defines methods common for interior widgets.NcCs,|jdk	r(|jD]}|j�|�qd|_dS)zkInternal function.

        Delete all Tcl commands created for
        this widget in the Tcl interpreter.N)r�r2r�r�rrr�destroyxs

zMisc.destroycCs6|j�|�z|j�|�Wntk
r0YnXdS)zDInternal function.

        Delete the Tcl command provided in NAME.N)r2r�r�r�rwr�rrrr��s
zMisc.deletecommandcCs|j�|j�dd|��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)r2r�r��re�booleanrrrr��s
�zMisc.tk_strictMotifcCs|j�d�dS)zDChange the color scheme to light brown as used in Tk 3.6 and before.�	tk_bisqueN�r2r�r�rrrr��szMisc.tk_bisquecOs(|j�dt|�tt|�����dS)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)r2r�rrr%�re�args�kwrrrr��s
��zMisc.tk_setPaletter|cCs|j�dd|�dS)z�Wait until the variable is modified.

        A parameter of type IntVar, StringVar, DoubleVar or
        BooleanVar must be given.�tkwaitr�Nr�r�rrr�
wait_variable�szMisc.wait_variablecCs"|dkr|}|j�dd|j�dS)zQWait until a WIDGET is destroyed.

        If no parameter is given self is used.Nr��window�r2r��_w�rer�rrr�wait_window�szMisc.wait_windowcCs"|dkr|}|j�dd|j�dS)zxWait until the visibility of a WIDGET changes
        (e.g. it appears).

        If no parameter is given self is used.Nr�Z
visibilityr�r�rrr�wait_visibility�szMisc.wait_visibility�1cCs|j�||�dS)zSet Tcl variable NAME to VALUE.N)r2�setvar)rerYr
rrrr��szMisc.setvarcCs|j�|�S)z"Return value of Tcl variable NAME.)r2�getvarr�rrrr��szMisc.getvarc
CsBz|j�|�WStk
r<}ztt|���W5d}~XYnXdSr�)r2r�r�rwr�rerf�excrrrr��szMisc.getintc
CsBz|j�|�WStk
r<}ztt|���W5d}~XYnXdSr�)r2r�r�rwrr�rrrr��szMisc.getdoublecCs0z|j�|�WStk
r*td��YnXdS)zPReturn a boolean value for Tcl boolean values true and false given as parameter.r�N)r2r�r�rw)rerfrrrr��szMisc.getbooleancCs|j�d|j�dS)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.rTNr�r�rrr�	focus_set�szMisc.focus_setcCs|j�dd|j�dS)ztDirect input focus to this widget even if the
        application does not have the focus. Use with
        caution!rTz-forceNr�r�rrr�focus_force�szMisc.focus_forcecCs&|j�d�}|dks|sdS|�|�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.rT�noneN)r2r��
_nametowidgetr�rrr�	focus_get�szMisc.focus_getcCs,|j�dd|j�}|dks|s"dS|�|�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.rT�
-displayofr�N�r2r�r�r�r�rrr�focus_displayof�szMisc.focus_displayofcCs,|j�dd|j�}|dks|s"dS|�|�S)zyReturn the widget which would have the focus if top level
        for this widget gets the focus from the window manager.rTz-lastforr�Nr�r�rrr�
focus_lastforszMisc.focus_lastforcCs|j�d�dS)zXThe widget under mouse will get automatically focus. Can not
        be disabled easily.�tk_focusFollowsMouseNr�r�rrrr�szMisc.tk_focusFollowsMousecCs"|j�d|j�}|sdS|�|�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�r�rrrr�
s	zMisc.tk_focusNextcCs"|j�d|j�}|sdS|�|�S)zHReturn previous widget in the focus order. See tk_focusNext for details.�tk_focusPrevNr�r�rrrr�szMisc.tk_focusPrevcsN�s�j�d|�dS����fdd�}�j|_��|���j�d|��SdS)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.�afterNcs8z���W5z����Wntk
r0YnXXdSr�)r�r�r�r��funcrYrerr�callit,szMisc.after.<locals>.callit)r2r�rAr�)reZmsr�r�r�rr�rr� s
z
Misc.aftercGs|jd|f|��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.Zidle)r�)rer�r�rrr�
after_idle8szMisc.after_idlecCsd|std��z.|j�dd|�}|j�|�d}|�|�Wntk
rNYnX|j�dd|�dS)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�r}rZcancelN)rwr2r�r.r�r�)rer��dataZscriptrrr�after_cancel@szMisc.after_cancelrcCs|j�d|�|��dS)zRing a display's bell.)�bellN)r2r��
_displayof�re�	displayofrrrr�Qsz	Misc.bellcKsdd|krN|jdkrNz d|d<|j�d|�|��WStk
rL|d=YnX|j�d|�|��S)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�)�_windowingsystemr2r��_optionsr��rer�rrr�
clipboard_getVszMisc.clipboard_getcKs,d|kr|j|d<|j�d|�|��dS)z�Clear the data in the Tk clipboard.

        A widget specified for the optional displayof keyword
        argument specifies the target display.r�)r��clearN�r�r2r�r�r�rrr�clipboard_clearms
zMisc.clipboard_clearcKs4d|kr|j|d<|j�d|�|�d|f�dS)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�rc�--Nr�)re�stringr�rrr�clipboard_appendus

�zMisc.clipboard_appendcCs$|j�dd|j�}|sdS|�|�S)zOReturn widget which has currently the grab in this application
        or None.�grabZcurrentNr�r�rrr�grab_current�szMisc.grab_currentcCs|j�dd|j�dS)z.Release grab for this widget if currently set.r��releaseNr�r�rrr�grab_release�szMisc.grab_releasecCs|j�dd|j�dS)zwSet grab for this widget.

        A grab directs all events to this and descendant
        widgets in the application.r�r�Nr�r�rrr�grab_set�sz
Misc.grab_setcCs|j�ddd|j�dS)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�r�z-globalNr�r�rrr�grab_set_global�szMisc.grab_set_globalcCs"|j�dd|j�}|dkrd}|S)zYReturn None, "local" or "global" if this widget has
        no, a local or a global grab.r��statusr�Nr�)rerrrr�grab_status�szMisc.grab_statuscCs|j�dd|||�dS)z�Set a VALUE (second parameter) for an option
        PATTERN (first parameter).

        An optional third parameter gives the numeric priority
        (defaults to 80).�optionr�Nr�)re�patternr
�priorityrrr�
option_add�szMisc.option_addcCs|j�dd�dS)zPClear the option database.

        It will be reloaded if option_add is called.rr�Nr�r�rrr�option_clear�szMisc.option_clearcCs|j�dd|j||�S)z�Return the value for an option NAME for this widget
        with CLASSNAME.

        Values with higher priority override lower values.rr�r�)rerY�	classNamerrr�
option_get�szMisc.option_getcCs|j�dd||�dS)zvRead file FILENAME into the option database.

        An optional second parameter gives the numeric
        priority.rZreadfileNr�)reZfileNamerrrr�option_readfile�szMisc.option_readfilecKs,d|kr|j|d<|j�d|�|��dS)zClear the current X selection.r�)�	selectionr�Nr�r�rrr�selection_clear�s
zMisc.selection_clearcKsvd|kr|j|d<d|kr`|jdkr`z d|d<|j�d|�|��WStk
r^|d=YnX|j�d|�|��S)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�)r�r�r2r�r�r�r�rrr�
selection_get�s	
zMisc.selection_getcKs.|�|�}|j�d|�|�|j|f�dS)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
ZhandleN)r�r2r�r�r�)re�commandr�rYrrr�selection_handle�s
�zMisc.selection_handlecKs"|j�d|�|�|jf�dS)z�Become owner of X selection.

        A keyword parameter selection specifies the name of
        the selection (default PRIMARY).�r
ZownN)r2r�r�r�r�rrr�
selection_own�s
��zMisc.selection_owncKs:d|kr|j|d<|j�d|�|��}|s0dS|�|�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�rN)r�r2r�r�r�)rer�rYrrr�selection_own_get�s
zMisc.selection_own_getcGs|j�d||f|�S)zDSend Tcl command CMD to different interpreter INTERP to be executed.�sendr�)reZinterp�cmdr�rrrr�sz	Misc.sendcCs|j�d|j|�dS)z(Lower this widget in the stacking order.�lowerNr�)re�	belowThisrrrr�sz
Misc.lowercCs|j�d|j|�dS)z(Raise this widget in the stacking order.�raiseNr�)re�	aboveThisrrr�tkraiseszMisc.tkraisecCs(d|�|�|f}|j�|j�|��S)z*Return integer which represents atom NAME.)�winfoZatom)r�r2r�r�)rerYr�r�rrr�
winfo_atomszMisc.winfo_atomcCs d|�|�|f}|j�|�S)z'Return name of atom with identifier ID.)rZatomname�r�r2r��rer�r�r�rrr�winfo_atomnames��zMisc.winfo_atomnamecCs|j�|j�dd|j��S)z7Return number of cells in the colormap for this widget.rZcells�r2r�r�r�r�rrr�winfo_cellss�zMisc.winfo_cellsc	CsRg}|j�|j�dd|j��D].}z|�|�|��Wqtk
rJYqXq|S)z?Return a list of all widgets which are children of this widget.r�children)r2r.r�r�rcr��KeyError)re�result�childrrr�winfo_childrens�zMisc.winfo_childrencCs|j�dd|j�S)z(Return window class name of this widget.r�classr�r�rrr�winfo_class#szMisc.winfo_classcCs|j�|j�dd|j��S)z?Return True if at the last color request the colormap was full.rZcolormapfull�r2r�r�r�r�rrr�winfo_colormapfull's�zMisc.winfo_colormapfullcCs4d|�|�||f}|j�|�}|s*dS|�|�S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.)rZ
containingN)r�r2r�r�)reZrootXZrootYr�r�rYrrr�winfo_containing,s��zMisc.winfo_containingcCs|j�|j�dd|j��S)z$Return the number of bits per pixel.rZdepthr!r�rrr�winfo_depth4szMisc.winfo_depthcCs|j�|j�dd|j��S)z"Return true if this widget exists.rr~r!r�rrr�winfo_exists8s�zMisc.winfo_existscCs|j�|j�dd|j|��S)zWReturn the number of pixels for the given distance NUMBER
        (e.g. "3c") as float.rZfpixels�r2r�r�r��re�numberrrr�
winfo_fpixels=s�zMisc.winfo_fpixelscCs|j�dd|j�S)zFReturn geometry string for this widget in the form "widthxheight+X+Y".r�geometryr�r�rrr�winfo_geometryCszMisc.winfo_geometrycCs|j�|j�dd|j��S)zReturn height of this widget.rrXr!r�rrr�winfo_heightGs�zMisc.winfo_heightcCst|j�dd|j�d�S)z%Return identifier ID for this widget.rr�r)rar2r�r�r�rrr�winfo_idLsz
Misc.winfo_idcCs"d|�|�}|j�|j�|��S)z9Return the name of all Tcl interpreters for this display.)rZinterps)r�r2r.r�)rer�r�rrr�
winfo_interpsPszMisc.winfo_interpscCs|j�|j�dd|j��S)z%Return true if this widget is mapped.rZismappedr!r�rrr�winfo_ismappedUs�zMisc.winfo_ismappedcCs|j�dd|j�S)z/Return the window manager name for this widget.rZmanagerr�r�rrr�
winfo_managerZszMisc.winfo_managercCs|j�dd|j�S)zReturn the name of this widget.rrYr�r�rrr�
winfo_name^szMisc.winfo_namecCs|j�dd|j�S)z-Return the name of the parent of this widget.r�parentr�r�rrr�winfo_parentbszMisc.winfo_parentcCs d|�|�|f}|j�|�S)z.Return the pathname of the widget given by ID.)r�pathnamerrrrr�winfo_pathnamefs��zMisc.winfo_pathnamecCs|j�|j�dd|j|��S)z'Rounded integer value of winfo_fpixels.rZpixelsr!r0rrr�winfo_pixelsls�zMisc.winfo_pixelscCs|j�|j�dd|j��S)z:Return the x coordinate of the pointer on the root window.rZpointerxr!r�rrr�winfo_pointerxqs�zMisc.winfo_pointerxcCs|�|j�dd|j��S)zHReturn a tuple of x and y coordinates of the pointer on the root window.rZ	pointerxy��_getintsr2r�r�r�rrr�winfo_pointerxyvs�zMisc.winfo_pointerxycCs|j�|j�dd|j��S)z:Return the y coordinate of the pointer on the root window.rZpointeryr!r�rrr�winfo_pointery{s�zMisc.winfo_pointerycCs|j�|j�dd|j��S)z'Return requested height of this widget.rZ	reqheightr!r�rrr�winfo_reqheight�s�zMisc.winfo_reqheightcCs|j�|j�dd|j��S)z&Return requested width of this widget.rZreqwidthr!r�rrr�winfo_reqwidth�s�zMisc.winfo_reqwidthcCs|�|j�dd|j|��S)zNReturn a tuple of integer RGB values in range(65536) for color in this widget.rZrgbrA)reZcolorrrr�	winfo_rgb�s�zMisc.winfo_rgbcCs|j�|j�dd|j��S)zSReturn x coordinate of upper left corner of this widget on the
        root window.rZrootxr!r�rrr�winfo_rootx�s�zMisc.winfo_rootxcCs|j�|j�dd|j��S)zSReturn y coordinate of upper left corner of this widget on the
        root window.rZrootyr!r�rrr�winfo_rooty�s�zMisc.winfo_rootycCs|j�dd|j�S)z&Return the screen name of this widget.r�screenr�r�rrr�winfo_screen�szMisc.winfo_screencCs|j�|j�dd|j��S)zTReturn the number of the cells in the colormap of the screen
        of this widget.rZscreencellsr!r�rrr�winfo_screencells�s�zMisc.winfo_screencellscCs|j�|j�dd|j��S)z\Return the number of bits per pixel of the root window of the
        screen of this widget.rZscreendepthr!r�rrr�winfo_screendepth�s�zMisc.winfo_screendepthcCs|j�|j�dd|j��S)zXReturn the number of pixels of the height of the screen of this widget
        in pixel.rZscreenheightr!r�rrr�winfo_screenheight�s�zMisc.winfo_screenheightcCs|j�|j�dd|j��S)zUReturn the number of pixels of the height of the screen of
        this widget in mm.rZscreenmmheightr!r�rrr�winfo_screenmmheight�s�zMisc.winfo_screenmmheightcCs|j�|j�dd|j��S)zTReturn the number of pixels of the width of the screen of
        this widget in mm.rZ
screenmmwidthr!r�rrr�winfo_screenmmwidth�s�zMisc.winfo_screenmmwidthcCs|j�dd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the default
        colormodel of this screen.rZscreenvisualr�r�rrr�winfo_screenvisual�szMisc.winfo_screenvisualcCs|j�|j�dd|j��S)zWReturn the number of pixels of the width of the screen of
        this widget in pixel.rZscreenwidthr!r�rrr�winfo_screenwidth�s�zMisc.winfo_screenwidthcCs|j�dd|j�S)zxReturn information of the X-Server of the screen of this widget in
        the form "XmajorRminor vendor vendorVersion".rZserverr�r�rrr�winfo_server�szMisc.winfo_servercCs|�|j�dd|j��S)z*Return the toplevel widget of this widget.r�toplevel)r�r2r�r�r�rrr�winfo_toplevel�s

�zMisc.winfo_toplevelcCs|j�|j�dd|j��S)zBReturn true if the widget and all its higher ancestors are mapped.rZviewabler!r�rrr�winfo_viewable�s�zMisc.winfo_viewablecCs|j�dd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
        staticcolor, staticgray, or truecolor for the
        colormodel of this widget.r�visualr�r�rrr�winfo_visual�szMisc.winfo_visualcCs|j�dd|j�S)z7Return the X identifier for the visual for this widget.rZvisualidr�r�rrr�winfo_visualid�szMisc.winfo_visualidFcsH�j�dd�j|rdnd�}�fdd��j�|�D�}�fdd�|D�S)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.rZvisualsavailable�
includeidsNcsg|]}�j�|��qSr)r2r.r�r�rrr��sz/Misc.winfo_visualsavailable.<locals>.<listcomp>csg|]}��|��qSr)�_Misc__winfo_parseitemr�r�rrr��s)r2r�r�r.)rerZr�rr�r�winfo_visualsavailable�s

�zMisc.winfo_visualsavailablecCs$|dd�tt|j|dd���S)rNr)rr�_Misc__winfo_getint)rer4rrrZ__winfo_parseitem�szMisc.__winfo_parseitemcCs
t|d�S)rr)ra�rerUrrrZ__winfo_getint�szMisc.__winfo_getintcCs|j�|j�dd|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.rZvrootheightr!r�rrr�winfo_vrootheight�s�zMisc.winfo_vrootheightcCs|j�|j�dd|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.rZ
vrootwidthr!r�rrr�winfo_vrootwidth�s�zMisc.winfo_vrootwidthcCs|j�|j�dd|j��S)ziReturn the x offset of the virtual root relative to the root
        window of the screen of this widget.rZvrootxr!r�rrr�winfo_vrootxs�zMisc.winfo_vrootxcCs|j�|j�dd|j��S)ziReturn the y offset of the virtual root relative to the root
        window of the screen of this widget.rZvrootyr!r�rrr�winfo_vrooty	s�zMisc.winfo_vrootycCs|j�|j�dd|j��S)z Return the width of this widget.rrWr!r�rrr�winfo_widths�zMisc.winfo_widthcCs|j�|j�dd|j��S)zVReturn the x coordinate of the upper left corner of this widget
        in the parent.rrUr!r�rrr�winfo_xs�zMisc.winfo_xcCs|j�|j�dd|j��S)zVReturn the y coordinate of the upper left corner of this widget
        in the parent.rrVr!r�rrr�winfo_ys�zMisc.winfo_ycCs|j�d�dS)zEEnter event loop until all pending events have been processed by Tcl.r!Nr�r�rrrr! szMisc.updatecCs|j�dd�dS)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!Z	idletasksNr�r�rrr�update_idletasks$szMisc.update_idletaskscCs6|dkr |j�|j�d|j��S|j�d|j|�dS)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�r2r.r�r�)reZtagListrrrrg*s
�z
Misc.bindtagsrcCs�t|t�r |j�|||f�nn|rd|�||j|�}d|r>dp@d||jf}|j�|||f�|S|rz|j�||f�S|j�|j�|��SdS)rz"%sif {"[%s %s]" == "break"} break
�+rZN)rrr2r�r��_substitute�_subst_format_strr.)rerq�sequencer�r��needcleanup�funcidrrrr�_bind7s"

�
��z
Misc._bindcCs|�d|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�ror��rerlr�r�rrrrpIs'z	Misc.bindcCs&|j�d|j|d�|r"|�|�dS)zWUnbind for this widget for event SEQUENCE  the
        function identified with FUNCID.rprZN�r2r�r�r�)rerlrnrrr�unbindrszMisc.unbindcCs|�d|||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.)rp�allr�rorrrrr�bind_allysz
Misc.bind_allcCs|j�dd|d�dS)z8Unbind for all widgets for event SEQUENCE all functions.rprurZNr�)rerlrrr�
unbind_all�szMisc.unbind_allcCs|�d|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.rprrv)rer
rlr�r�rrr�
bind_class�szMisc.bind_classcCs|j�d||d�dS)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE
        all functions.rprZNr�)rer
rlrrr�unbind_class�szMisc.unbind_classcCs|j�|�dS)zCall the mainloop of Tk.N)r2r�)rerhrrrr��sz
Misc.mainloopcCs|j��dS)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r2�quitr�rrrr{�sz	Misc.quitcCs"|rtt|jj|j�|���SdSrt)rrr2r�r.�rer�rrrrB�sz
Misc._getintscCs"|rtt|jj|j�|���SdSrt)rrr2r�r.r|rrr�_getdoubles�szMisc._getdoublescCs|r|j�|�SdSrt)r2r�r|rrr�_getboolean�szMisc._getbooleancCs"|rd|fS|dkrd|jfSdS)rr�Nr�r�r�rrrr��s

zMisc._displayofcCsBz|��jWStk
r<|j�dd�}|��_|YSXdS)rr2ZwindowingsystemN)rZ_windowingsystem_cachedr"r2r�)reZwsrrrr��s�zMisc._windowingsystemcCs�|rt||f�}nt|�}d}|��D]�\}}|dk	r&|ddkrN|dd�}t|�rb|�|�}n^t|ttf�r�g}|D]<}t|t�r�|�t	|��qxt|t	�r�|�t
|��qxq�qxd�|�}|d||f}q&|S)rrN����_rr-)r+r%�callabler�rrrrarcrrr)rer&r�rr)r*Znvrrrrr��s*


z
Misc._optionscCsNt|��d�}|}|ds.|��}|dd�}|D]}|s>qJ|j|}q2|S)zPReturn the Tkinter instance of a widget identified by
        its Tcl name NAME.�.rrN)r�splitrr#)rerY�wrhrrr�nametowidget�szMisc.nametowidgetcCs�t|||�j}tt|��}z
|j}Wntk
r8YnXz||j}Wntk
r\YnX|j�||�|r�|j	dkr�g|_	|j	�
|�|S)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.N)r�r�r_r�r�r"rAr2r�r�rc)rer��substrmr�rYrrrr��s 

zMisc._registercCs|}|jr|j}q|S)r�r�)rer�rrrrsz
Misc._root)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%Drcs�t|�t|j�kr|S|jj}|jj��fdd�}|\}}}}}}	}
}}}
}}}}}}}}}t�}�|�|_||�|_z||�|_Wnt	k
r�YnX||�|_
||�|_||	�|_||
�|_
||�|_||�|_||
�|_||_z||�|_Wnt	k
�r
YnX||_||�|_zt|�|_Wntk
�rF||_YnXz|�|�|_Wntk
�rt||_YnX||�|_||�|_z�|�|_Wn tt	fk
�r�d|_YnX|fS)rc	s,z
�|�WSttfk
r&|YSXdS)z?Tk changed behavior in 8.4.2, returning "??" rather more often.N)rwr�r��r�rr�getint_events
z&Misc._substitute.<locals>.getint_eventr)r�
_subst_formatr2r�r�rG�serialrSrTr�rXrRrN�timerWrUrVrLrMrQZ
keysym_numr8r rwr��widgetr$Zx_rootZy_rootrP)rer�r�r�Znsign�br��hr)rfr4r�rUrV�A�E�K�N�W�T�X�Y�D�err�rrjsT*











zMisc._substitutecCs(t��\}}}|��}|�|||�dSrt)�sys�exc_infor�report_callback_exception)rer��val�tbrrrrr�_report_exceptionHszMisc._report_exceptioncGs\i}|j�|jj|��D]>}|j�|�}|ddd�f|dd�||ddd�<q|S)z;Call Tcl configure command and return the result as a dict.rrN�r2r.r�)rer�r&rUrrr�
_getconfigureNs
0zMisc._getconfigurecGs2|j�|jj|��}|ddd�f|dd�S)Nrrr�)rer�rUrrr�_getconfigure1VszMisc._getconfigure1cCs�|rt||f�}n|rt|�}|dkr:|�t|j|f��St|t�r^|�t|j|d|f��S|j�t|j|f�|�	|��dS)rNr-)
r+r�rr�rrr�r2r�r�)rerr&r�rrr�
_configureZs
zMisc._configurecKs|�d||�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��rer&r�rrrr�gszMisc.configurecCs|j�|jdd|�S)z4Return the resource value for a KEY given as string.�cgetr-r��rer6rrrr�rsz	Misc.cgetcCs|�||i�dSr�)r��rer6r
rrr�__setitem__xszMisc.__setitem__cs*|jj��fdd��|j�|jd��D�S)z3Return a list of all resource names of this widget.cs g|]}�|�ddd��qS)rrNrr�r�rrr�~szMisc.keys.<locals>.<listcomp>r�rhr�rr�rri{s
�z	Misc.keyscCs|jS)z+Return the window path name of this widget.rr�rrrrF�szMisc.__str__cCsd|jj|jj|jfS)Nz<%s.%s object %s>)r�rBrCr�r�rrrrj�s
�z
Misc.__repr__�_noarg_cCs:|tjkr"|�|j�dd|j��S|j�dd|j|�dS)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�r�r�r~r2r�r��re�flagrrr�pack_propagate�s

�zMisc.pack_propagatecs(�fdd��j��j�dd�j��D�S)�HReturn a list of all slaves of this widget
        in its packing order.csg|]}��|��qSr�r�r�r�rrr��sz$Misc.pack_slaves.<locals>.<listcomp>r��slavesrhr�rr�r�pack_slaves�s

��zMisc.pack_slavescs(�fdd��j��j�dd�j��D�S)r�csg|]}��|��qSrr�r�r�rrr��sz%Misc.place_slaves.<locals>.<listcomp>�placer�rhr�rr�r�place_slaves�s
���zMisc.place_slavescCs|j�dd|j|�dS)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�anchorNr�)rer�rrr�grid_anchor�szMisc.grid_anchorcCsZdd|jf}|dk	r(|dk	r(|||f}|dk	rD|dk	rD|||f}|�|jj|��pXdS)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)r�rBr2r�)re�column�rowZcol2Zrow2r�rrr�	grid_bbox�szMisc.grid_bboxc	Csht|ttjf�rdz:t|�}|s$WdSd|kr:|j�|�WS|j�|�WSWnttfk
rbYnX|S)Nr�)	rr�_tkinterZTcl_Objr2r�r�rwr�)rer
Zsvaluerrr�_gridconvvalue�szMisc._gridconvvaluecCs�t|t�rJ|sJ|dd�dkr*|dd�}|dd�dkrBd|}|f}n|�||�}|s|t|j|j�d||j|�|jd�S|j�d||j|f|�}t|�dkr�|�|�SdS)rr�Nr�rr-r�)r3)	rrr�r7r2r�r�r�r)rer�indexr&r��optionsrrrr�_grid_configure�s(���zMisc._grid_configurecKs|�d|||�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��rer�r&r�rrr�grid_columnconfigure�szMisc.grid_columnconfigurec	Cs |�|j�dd|j||��pdS)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��locationNrA�rerUrVrrr�
grid_location�s���zMisc.grid_locationcCs:|tjkr"|�|j�dd|j��S|j�dd|j|�dS)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�r�Nr�r�rrr�grid_propagates

�zMisc.grid_propagatecKs|�d|||�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).�rowconfigurer�r�rrr�grid_rowconfigureszMisc.grid_rowconfigurecCs|�|j�dd|j��pdS)z<Return a tuple of the number of column and rows in the grid.r��sizeNrAr�rrr�	grid_sizes
��zMisc.grid_sizecsZd}|dk	r|d|f}|dk	r,|d|f}�fdd��j��j�dd�jf|��D�S)	r�rNz-rowz-columncsg|]}��|��qSrr�r�r�rrr�(sz$Misc.grid_slaves.<locals>.<listcomp>r�r�rh)rer�r�r�rr�r�grid_slaves s
��zMisc.grid_slavescGsdd|f|}|j�|�dS)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�Nr��re�virtual�	sequencesr�rrr�	event_add/szMisc.event_addcGsdd|f|}|j�|�dS)z-Unbind a virtual event VIRTUAL from SEQUENCE.r��deleteNr�r�rrr�event_delete6szMisc.event_deletecKsDdd|j|f}|��D]\}}|d|t|�f}q|j�|�dS)z�Generate an event SEQUENCE. Additional
        keyword arguments specify parameter of the event
        (e.g. x, y, rootx, rooty).r�Zgenerate�-%sN)r�r%rr2r�)rerlr�r�r)r*rrr�event_generate;szMisc.event_generatecCs|j�|j�dd|��S)zuReturn a list of all virtual events or the information
        about the SEQUENCE bound to the virtual event VIRTUAL.r�r}r�)rer�rrr�
event_infoDs�zMisc.event_infocCs|j�|j�dd��S)z*Return a list of all existing image names.�image�namesr�r�rrr�image_namesLszMisc.image_namescCs|j�|j�dd��S)z?Return a list of all available image types (e.g. photo bitmap).r��typesr�r�rrr�image_typesPszMisc.image_types)N)r|)N)N)r|r�)r|)N)r)N)N)N)N)r)r)r)r)r)F)N)r)NNN)N)NNN)NNN)r)N)Nr)N)N)NNNN)NN)N)�rArBrCrk�_last_child_idsr�r�r�r�r�r�r�Zwaitvarr�r�r�r�r�r�r�r�rTr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr	rrrrrrrrrr�liftrr r"r'r)r+r,r-r.r2r4r5r6r7r8r9r:r<r>r?r@rCrDrErFrGrHrIrKrLrMrNrOrPrQrRrSrUrVrXrYr\r[r]r_r`rarbrcrdrer!rfrgrorprtrwrxryrzr�r{rBr}r~r��propertyr�r�r�r�r��registerrr�rrkrjr�r�r�r�r��configr��__getitem__r�rirFrjr�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�rrrrr�msP
		


)

	
=
	


	r�c@s eZdZdZdd�Zdd�ZdS)r�zwInternal class. Stores function to call when some user
    defined Tcl function is called e.g. after an event occurred.cCs||_||_||_dS)z(Store FUNC, SUBST and WIDGET as members.N)r�r�r�)rer�r�r�rrrr�YszCallWrapper.__init__cGsLz|jr|j|�}|j|�WStk
r2�Yn|j��YnXdS)z3Apply first function SUBST to arguments, than FUNC.N)r�r�rxr�r��rer�rrrr�_s
zCallWrapper.__call__N�rArBrCrkr�r�rrrrr�Usr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�XViewzXMix-in class for querying and changing the horizontal position
    of a widget's window.cGs(|jj|jdf|��}|s$|�|�SdS)z5Query and change the horizontal position of the view.�xviewN�r2r�r�r}�rer�rrrrr�oszXView.xviewcCs|j�|jdd|�dS)zsAdjusts the view in the window so that FRACTION of the
        total width of the canvas is off-screen to the left.r��movetoNr��re�fractionrrr�xview_movetouszXView.xview_movetocCs|j�|jdd||�dS)z\Shift the x-view according to NUMBER which is measured in "units"
        or "pages" (WHAT).r��scrollNr��rer1rqrrr�xview_scrollzszXView.xview_scrollN)rArBrCrkr�r�r�rrrrr�ksr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�YViewzVMix-in class for querying and changing the vertical position
    of a widget's window.cGs(|jj|jdf|��}|s$|�|�SdS)z3Query and change the vertical position of the view.�yviewNr�r�rrrr��szYView.yviewcCs|j�|jdd|�dS)zsAdjusts the view in the window so that FRACTION of the
        total height of the canvas is off-screen to the top.r�r�Nr�r�rrr�yview_moveto�szYView.yview_movetocCs|j�|jdd||�dS)z\Shift the y-view according to NUMBER which is measured in
        "units" or "pages" (WHAT).r�r�Nr�r�rrr�yview_scroll�szYView.yview_scrollN)rArBrCrkr�r�r�rrrrr��sr�c@s�eZdZdZdBdd�ZeZdd�ZeZdCdd�ZeZ	d	d
�Z
e
ZdDdd�ZeZ
d
d�ZeZdEdd�ZeZdd�ZeZdd�ZeZdFdd�ZeZdGdd�ZeZdHdd�ZeZdIdd�ZeZdd�ZeZdJdd �Z e Z!dKd!d"�Z"e"Z#dLd$d%�Z$e$Z%dMd&d'�Z&e&Z'dNd(d)�Z(e(Z)d*d+�Z*e*Z+dOd,d-�Z,e,Z-dPd.d/�Z.e.Z/dQd0d1�Z0e0Z1dRd2d3�Z2e2Z3dSd4d5�Z4e4Z5dTd6d7�Z6e6Z7dUd8d9�Z8e8Z9dVd:d;�Z:e:Z;dWd<d=�Z<e<Z=dXd>d?�Z>e>Z?d@dA�Z@e@ZAdS)Y�WmzAProvides functions for the communication with the window manager.NcCs |�|j�dd|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�aspectrA)reZminNumerZminDenomZmaxNumerZmaxDenomrrr�	wm_aspect�s��zWm.wm_aspectcGsdd|jf|}|j�|�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)r�r2r�r�rrr�
wm_attributes�szWm.wm_attributescCs|j�dd|j|�S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return
        current value.r��clientr�r�rrr�	wm_client�szWm.wm_clientcsZt|�dkr|f}dd�jf|}|r4�j�|�n"�fdd��j��j�|��D�SdS)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��colormapwindowscsg|]}��|��qSrr�r�r�rrr��s�z)Wm.wm_colormapwindows.<locals>.<listcomp>N)rr�r2r�r.)reZwlistr�rr�r�wm_colormapwindows�s
�zWm.wm_colormapwindowscCs|j�dd|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�rr�r�rrr�
wm_command�sz
Wm.wm_commandcCs|j�dd|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��	deiconifyr�r�rrr�wm_deiconify�szWm.wm_deiconifycCs|j�dd|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��
focusmodelr�)reZmodelrrr�
wm_focusmodel�szWm.wm_focusmodelcCs|j�dd|�dS)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��forgetNr�r�rrr�	wm_forget�szWm.wm_forgetcCs|j�dd|j�S)zAReturn identifier for decorative frame of this widget if present.r��framer�r�rrr�wm_frame�szWm.wm_framecCs|j�dd|j|�S)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
        current value if None is given.r�r3r�)reZnewGeometryrrr�wm_geometry�szWm.wm_geometrycCs |�|j�dd|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�rA)reZ	baseWidthZ
baseHeightZwidthIncZ	heightIncrrr�wm_grids
�z
Wm.wm_gridcCs|j�dd|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��groupr��reZpathNamerrr�wm_group
szWm.wm_groupcCs2|r|j�dd|jd|�S|j�dd|j|�SdS)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 descendents 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�-defaultNr�)re�bitmap�defaultrrr�
wm_iconbitmaps	zWm.wm_iconbitmapcCs|j�dd|j�S)zDisplay widget as icon.r��iconifyr�r�rrr�
wm_iconify$sz
Wm.wm_iconifycCs|j�dd|j|�S)zVSet mask for the icon bitmap of this widget. Return the
        mask if None is given.r��iconmaskr�)rerrrr�wm_iconmask*szWm.wm_iconmaskcCs|j�dd|j|�S)zSSet the name of the icon for this widget. Return the name if
        None is given.r��iconnamer�)reZnewNamerrr�wm_iconname1szWm.wm_iconnameFcGs<|r |jjdd|jdf|��n|jjdd|jf|��dS)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��	iconphotorNr�)rerr�rrr�wm_iconphoto8szWm.wm_iconphotoc	Cs|�|j�dd|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��iconpositionrAr�rrr�wm_iconpositionSs
�zWm.wm_iconpositioncCs|j�dd|j|�S)zgSet widget PATHNAME to be displayed instead of icon. Return the current
        value if None is given.r��
iconwindowr�rrrr�
wm_iconwindow[szWm.wm_iconwindowcCs|j�dd|�dS)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��manageNr�)rer�rrr�	wm_managebszWm.wm_managec	Cs|�|j�dd|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��maxsizerA�rerWrXrrr�
wm_maxsizejs
�z
Wm.wm_maxsizec	Cs|�|j�dd|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��minsizerAr$rrr�
wm_minsizess
�z
Wm.wm_minsizecCs|�|j�dd|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~r2r�r�r�rrr�wm_overrideredirect|s
�zWm.wm_overrideredirectcCs|j�dd|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��positionfromr��reZwhorrr�wm_positionfrom�szWm.wm_positionfromcCs.t|�r|�|�}n|}|j�dd|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�r2r�r�)rerYr�rrrr�wm_protocol�s�zWm.wm_protocolcCs|j�dd|j||�S)zyInstruct the window manager whether this width can be resized
        in WIDTH or HEIGHT. Both values are boolean values.r��	resizabler�r$rrr�wm_resizable�szWm.wm_resizablecCs|j�dd|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��sizefromr�r+rrr�wm_sizefrom�szWm.wm_sizefromcCs|j�dd|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�rNr�)reZnewstaterrr�wm_state�szWm.wm_statecCs|j�dd|j|�S)zSet the title of this widget.r��titler�r|rrr�wm_title�szWm.wm_titlecCs|j�dd|j|�S)z_Instruct the window manager that this widget is transient
        with regard to widget MASTER.r��	transientr�)rer�rrr�wm_transient�szWm.wm_transientcCs|j�dd|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��withdrawr�r�rrr�wm_withdraw�szWm.wm_withdraw)NNNN)N)N)N)N)NNNN)N)NN)N)N)F)NN)N)NN)NN)N)N)NN)NN)N)N)N)N)BrArBrCrkr�r�r�r�r�r�rrrrrrrrrrr
r	rr3rr�rr
rrrrrrrrrrrrr rr"r!r%r#r'r&r)r(r,r*r.r-r0r/r2r1r3rNr5r4r7r6r9r8rrrrr��s��





�

















r�c@sNeZdZdZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rozzToplevel widget of Tk which represents mostly the main window
    of an application. It has an associated Tcl interpreter.r�Nrrc

Cs�d|_i|_d|_d|_|dkrZddl}|j�tjd�}|j�	|�\}}|dkrZ||}d}	t
�||||	t|||�|_|r�|�
�tjjs�|�||�dS)a@Return a new Toplevel 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#�	_tkloadedr2�os�path�basenamer��argv�splitextr��create�wantobjects�_loadtk�flags�ignore_environment�readprofile)
re�
screenName�baseNamer
�useTk�syncZuser;Zext�interactiverrrr��s zTk.__init__cCs|js|j��|��dSr�)r:r2�loadtkrBr�rrrrK�s
z	Tk.loadtkcCs�d|_|j�d�}|tjkr.tdtj|f��t|j�d��}|tjkrZtdtj|f��|jdkrjg|_|j�	dt
�|j�	dt�|j�d�|j�d�t
r�ts�|a|�d|j�dS)	NT�
tk_versionz4tk.h version (%s) doesn't match libtk.a version (%s)�tcl_versionz6tcl.h version (%s) doesn't match libtcl.a version (%s)Ztkerror�exit�WM_DELETE_WINDOW)r:r2r�r��
TK_VERSIONr/r�TCL_VERSIONr�r�rvrzrcrlrmr-r�)rerLrMrrrrB�s(
�
�
z
Tk._loadtkcCsJt|j���D]}|��q|j�d|j�t�|�trFt	|krFda	dS)zhDestroy this and all descendants widgets. This will
        end the application of this Tcl interpreter.r�N)
rr#�valuesr�r2r�r�r�rlrm�rer'rrrr�	s

z
Tk.destroyc
Cs�ddl}d|jkr|jd}n|j}|j�|d|�}|j�|d|�}|j�|d|�}|j�|d|�}d|i}	td|	�|j�|�r�|j�d|�|j�|�r�tt	|��
�|	�|j�|�r�|j�d|�|j�|�r�tt	|��
�|	�dS)	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.pyrezfrom tkinter import *�source)r;�environ�curdirr<r�exec�isfiler2r��open�read)
rerGr
r;�homeZ	class_tclZclass_pyZbase_tclZbase_py�dirrrrrE	s$

zTk.readprofilecCs:ddl}tdtjd�|t_|t_|t_|�|||�dS)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_type�
last_value�last_traceback�print_exception)rer�r�r�r_rrrr�$	szTk.report_callback_exceptioncCst|j|�S)z3Delegate attribute access to the interpreter object)r`r2)re�attrrrr�__getattr__0	szTk.__getattr__)NNrorrN)rArBrCrkr�r�rKrBr�rEr�rfrrrrro�s�

rocCst||||�Sr�)ro)rFrGr
rHrrr�TclC	srgc@sTeZdZdZifdd�ZeZZZdd�ZeZ	dd�Z
e
Zej
ZZ
ejZZdS)	�PackzQGeometry manager Pack.

    Base class to use the methods pack_* in every widget.cKs$|j�dd|jf|�||��dS)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.
        r�r�N�r2r�r�r�r�rrr�pack_configureL	s


��zPack.pack_configurecCs|j�dd|j�dS)z:Unmap this widget and do not use it for the packing order.r�rNr�r�rrr�pack_forgetb	szPack.pack_forgetcCs8t|j|j�dd|j��}d|kr4|�|d�|d<|S)zEReturn information about the packing options
        for this widget.r�r}�in�r7r2r�r�r��re�drrr�	pack_infoh	szPack.pack_infoN)rArBrCrkrjr�r�r�rkrrpr}r�r�r�r�r�rrrrrhG	s
rhc@sJeZdZdZifdd�ZeZZZdd�ZeZ	dd�Z
e
Zej
ZZ
dS)	�PlacezSGeometry manager Place.

    Base class to use the methods place_* in every widget.cKs$|j�dd|jf|�||��dS)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�r�Nrir�rrr�place_configurez	s


��zPlace.place_configurecCs|j�dd|j�dS)�Unmap this widget.r�rNr�r�rrr�place_forget�	szPlace.place_forgetcCs8t|j|j�dd|j��}d|kr4|�|d�|d<|S)zEReturn information about the placing options
        for this widget.r�r}rlrmrnrrr�
place_info�	szPlace.place_infoN)rArBrCrkrrr�r�r�rtrrur}r�r�r�rrrrrqu	srqc@s�eZdZdZifdd�ZeZZZej	Z
Z	ejZZdd�Z
e
Zdd�Zdd	�ZeZejZZejZZejZZejZZejZZd
S)�GridzQGeometry manager Grid.

    Base class to use the methods grid_* in every widget.cKs$|j�dd|jf|�||��dS)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�r�Nrir�rrr�grid_configure�	s


��zGrid.grid_configurecCs|j�dd|j�dS)rsr�rNr�r�rrr�grid_forget�	szGrid.grid_forgetcCs|j�dd|j�dS)z0Unmap this widget but remember the grid options.r�r�Nr�r�rrr�grid_remove�	szGrid.grid_removecCs8t|j|j�dd|j��}d|kr4|�|d�|d<|S)zSReturn information about the options
        for positioning this widget in a grid.r�r}rlrmrnrrr�	grid_info�	szGrid.grid_infoN)rArBrCrkrwr�r�r�r�r�r�r�r�rxrryrzr}r�r�r�r�r�r�r�r�r�r�rrrrrv�	s





rvc@s:eZdZdZdd�Ziidfdd�Zdd�Zdd	d
�ZdS)
�
BaseWidgetzInternal class.cCs�|s
t�}||_|j|_d}d|kr2|d}|d=|s�|jj��}|jdkrRi|_|j�|d�d}||j|<|dkr�d|f}nd||f}||_|j	dkr�d||_	n|j	d||_	i|_
|j|jj
kr�|jj
|j��||jj
|j<dS)z6Internal function. Sets up information about children.NrYrrz!%sz!%s%dr�)rsr�r2r�rArr�r�r�r�r#r�)rer�r&rY�countrrr�_setup�	s2


zBaseWidget._setuprc	Cs�|rt||f�}||_t�|||�|jdkr4g|_dd�|��D�}|D]\}}||=qJ|j�||jf||�	|��|D]\}}|�
||�q~dS)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME
        and appropriate options.NcSs"g|]\}}t|t�r||f�qSr)rr rIrrrr�	
s
z'BaseWidget.__init__.<locals>.<listcomp>)r+�
widgetNamer{r}r�r%r2r�r�r�r�)	rer�r~r&r��extra�classesr)r*rrrr�
s
�zBaseWidget.__init__cCsTt|j���D]}|��q|j�d|j�|j|jjkrF|jj|j=t	�|�dS)z)Destroy this and all descendants widgets.r�N)
rr#rRr�r2r�r�r�r�r�rSrrrr�
s
zBaseWidget.destroycCs|j�|j|f|�Sr�r�)rerYr�rrr�_do
szBaseWidget._doN)r)rArBrCrkr}r�r�r�rrrrr{�	s
r{c@seZdZdZdS)�WidgetzxInternal class.

    Base class for a widget which can be positioned with the geometry managers
    Pack, Place or Grid.N)rArBrCrkrrrrr�
sr�c@seZdZdZdifdd�ZdS)�Toplevelz"Toplevel widget, e.g. for dialogs.Nc	Ks�|rt||f�}d}dD]L}||kr||}|ddkrJd|dd�}nd|}|||f}||=qt�||d|i|�|��}|�|���|�|���|�d|j�dS)	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)rJ�class_r(rWZcolormapr�r�r-NrTrO)r+r{r�rrr4r-r�)	rer�r&r�rZwmkeyr��optrrrrrr�)
s zToplevel.__init__�rArBrCrkr�rrrrr�&
sr�c@s.eZdZdZdifdd�Zdd�Zdd�ZdS)	rDzButton widget.NcKst�||d||�dS)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
        ZbuttonN�r�r��rer�r&r�rrrr�G
szButton.__init__cCs|j�|jd�dS)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.
        �flashNr�r�rrrr�\
s
zButton.flashcCs|j�|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.
        �invoker�r�rrrr�h
sz
Button.invoke)rArBrCrkr�r�r�rrrrrDD
srDc@seZdZdZdifdd�Zdd�Zdd�Zd	d
�Zdd�Zdwd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dxdd�Zdydd�Zdzdd�Zd{dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#d|dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-d}dWdX�Z.e.Z/dYdZ�Z0e0Z1d[d\�Z2d~d^d_�Z3ifd`da�Z4dbdc�Z5e5Z6Z7ddde�Z8dfdg�Z9ddidj�Z:dkdl�Z;dmdn�Z<dodp�Z=dqdr�Z>dsdt�Z?dudv�Z@dS)��Canvasz?Canvas widget to display graphical elements like lines or text.NcKst�||d||�dS)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.ZcanvasNr�r�rrrr�v
s
zCanvas.__init__cGs|j�|jdf|�dS)r�addtagNr�r�rrrr��
sz
Canvas.addtagcCs|�|d|�dS)z*Add tag NEWTAG to all items above TAGORID.�aboveN�r��re�newtag�tagOrIdrrr�addtag_above�
szCanvas.addtag_abovecCs|�|d�dS)zAdd tag NEWTAG to all items.ruNr�)rer�rrr�
addtag_all�
szCanvas.addtag_allcCs|�|d|�dS)z*Add tag NEWTAG to all items below TAGORID.�belowNr�r�rrr�addtag_below�
szCanvas.addtag_belowcCs|�|d||||�dS)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
        closests). If START is specified the next below this tag is taken.�closestNr�)rer�rUrV�halo�startrrr�addtag_closest�
szCanvas.addtag_closestcCs|�|d||||�dS)zLAdd tag NEWTAG to all items in the rectangle defined
        by X1,Y1,X2,Y2.�enclosedNr��rer��x1�y1�x2�y2rrr�addtag_enclosed�
szCanvas.addtag_enclosedcCs|�|d||||�dS)zWAdd tag NEWTAG to all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.�overlappingNr�r�rrr�addtag_overlapping�
szCanvas.addtag_overlappingcCs|�|d|�dS)z)Add tag NEWTAG to all items with TAGORID.�withtagNr�r�rrr�addtag_withtag�
szCanvas.addtag_withtagcGs |�|j�|jdf|��pdS)z|Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses all items with tags specified as arguments.r�NrAr�rrrr��
s
��zCanvas.bboxcCs(|j�|jd||d�|r$|�|�dS)zbUnbind for all items with TAGORID for event SEQUENCE  the
        function identified with FUNCID.rprZNrs)rer�rlrnrrr�
tag_unbind�
szCanvas.tag_unbindcCs|�|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.rprq)rer�rlr�r�rrr�tag_bind�
s
�zCanvas.tag_bindcCs|j�|j�|jd||��S)zrReturn the canvas x coordinate of pixel position SCREENX rounded
        to nearest multiple of GRIDSPACING units.�canvasxr/)reZscreenx�gridspacingrrrr��
s�zCanvas.canvasxcCs|j�|j�|jd||��S)zrReturn the canvas y coordinate of pixel position SCREENY rounded
        to nearest multiple of GRIDSPACING units.�canvasyr/)reZscreenyr�rrrr��
s�zCanvas.canvasycs,�fdd��j��j��jdf|��D�S)z8Return a list of coordinates for the item given in ARGS.csg|]}�j�|��qSr)r2r�r�r�rrr��
sz!Canvas.coords.<locals>.<listcomp>�coordsrhr�rr�rr��
s

��z
Canvas.coordsc	Cs\t|�}|d}t|ttf�r,|dd�}ni}|j�|jj|jd|f||�||����S)rr�Nr@)	rrrrr2r�r�r�r�)re�itemTyper�r�r&rrr�_create�
s��zCanvas._createcOs|�d||�S)z6Create arc shaped region with coordinates x1,y1,x2,y2.Zarc�r�r�rrr�
create_arc�
szCanvas.create_arccOs|�d||�S)z%Create bitmap with coordinates x1,y1.rr�r�rrr�
create_bitmap�
szCanvas.create_bitmapcOs|�d||�S)z)Create image item with coordinates x1,y1.r�r�r�rrr�create_image�
szCanvas.create_imagecOs|�d||�S)z-Create line with coordinates x1,y1,...,xn,yn.�liner�r�rrr�create_line�
szCanvas.create_linecOs|�d||�S)z)Create oval with coordinates x1,y1,x2,y2.Zovalr�r�rrr�create_oval�
szCanvas.create_ovalcOs|�d||�S)z0Create polygon with coordinates x1,y1,...,xn,yn.Zpolygonr�r�rrr�create_polygon�
szCanvas.create_polygoncOs|�d||�S)z.Create rectangle with coordinates x1,y1,x2,y2.Z	rectangler�r�rrr�create_rectangle�
szCanvas.create_rectanglecOs|�d||�S)z#Create text with coordinates x1,y1.�textr�r�rrr�create_text�
szCanvas.create_textcOs|�d||�S)z+Create window with coordinates x1,y1,x2,y2.r�r�r�rrr�
create_window�
szCanvas.create_windowcGs|j�|jdf|�dS)z�Delete characters of text items identified by tag or id in ARGS (possibly
        several times) from FIRST to LAST character (including).�dcharsNr�r�rrrr�sz
Canvas.dcharscGs|j�|jdf|�dS)z<Delete items identified by all tag or ids contained in ARGS.r�Nr�r�rrrr�sz
Canvas.deletecGs|j�|jdf|�dS)ziDelete tag or id given as last arguments in ARGS from items
        identified by first argument in ARGS.�dtagNr�r�rrrr�	szCanvas.dtagcGs |�|j�|jdf|��pdS)r�findrrAr�rrrr�s
��zCanvas.findcCs|�d|�S)zReturn items above TAGORID.r��r��rer�rrr�
find_aboveszCanvas.find_abovecCs
|�d�S)zReturn all items.rur�r�rrr�find_allszCanvas.find_allcCs|�d|�S)zReturn all items below TAGORID.r�r�r�rrr�
find_belowszCanvas.find_belowcCs|�d||||�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�)rerUrVr�r�rrr�find_closestszCanvas.find_closestcCs|�d||||�S)z=Return all items in rectangle defined
        by X1,Y1,X2,Y2.r�r��rer�r�r�r�rrr�
find_enclosed&szCanvas.find_enclosedcCs|�d||||�S)zLReturn all items which overlap the rectangle
        defined by X1,Y1,X2,Y2.r�r�r�rrr�find_overlapping+szCanvas.find_overlappingcCs|�d|�S)zReturn all items with TAGORID.r�r�r�rrr�find_withtag0szCanvas.find_withtagcGs|j�|jdf|�S)z.Set focus to the first item specified in ARGS.rTr�r�rrrrT4szCanvas.focuscGs|j�|j�|jdf|��S)z=Return tags associated with the first item specified in ARGS.�gettagsrhr�rrrr�8s�zCanvas.gettagscGs|j�|jdf|�dS)zdSet cursor at position POS in the item identified by TAGORID.
        In ARGS TAGORID must be first.�icursorNr�r�rrrr�=szCanvas.icursorcGs|j�|j�|jdf|��S)z?Return position of cursor as integer in item specified in ARGS.r�r!r�rrrr�BszCanvas.indexcGs|j�|jdf|�dS)zSInsert TEXT in item TAGORID at position POS. ARGS must
        be TAGORID POS TEXT.�insertNr�r�rrrr�Fsz
Canvas.insertcCs|j�|jdf|d|f�S)z9Return the resource value for an OPTION for item TAGORID.�itemcgetr-r�)rer�rrrrr�Ks�zCanvas.itemcgetcKs|�d|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��rer�r&r�rrrr�PszCanvas.itemconfigurecGs|j�|jdf|�dS)zJLower an item TAGORID given in ARGS
        (optional below another item).rNr�r�rrr�	tag_lower_szCanvas.tag_lowercGs|j�|jdf|�dS)z#Move an item TAGORID given in ARGS.�moveNr�r�rrrr�fszCanvas.moverZcCs|j�|jd|||�dS)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�Nr�)rer�rUrVrrrr�jsz
Canvas.movetocKs|j�|jdf|�||��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.�
postscriptrir�rrrr�ss
�zCanvas.postscriptcGs|j�|jdf|�dS)zJRaise an item TAGORID given in ARGS
        (optional above another item).rNr�r�rrr�	tag_raise{szCanvas.tag_raisecGs|j�|jdf|�dS)z9Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.�scaleNr�r�rrrr��szCanvas.scalecCs|j�|jdd||�dS�z&Remember the current X, Y coordinates.�scan�markNr�r�rrr�	scan_mark�szCanvas.scan_mark�
cCs|j�|jdd|||�dS)z�Adjust the view of the canvas to GAIN times the
        difference between X and Y and the coordinates given in
        scan_mark.r��dragtoNr�)rerUrVZgainrrr�scan_dragto�szCanvas.scan_dragtocCs|j�|jdd||�dS)zLAdjust the end of the selection near the cursor of an item TAGORID to index.�select�adjustNr��rer�r�rrr�
select_adjust�szCanvas.select_adjustcCs|j�|jdd�dS)�,Clear the selection if it is in this widget.r�r�Nr�r�rrr�select_clear�szCanvas.select_clearcCs|j�|jdd||�dS)z:Set the fixed end of a selection in item TAGORID to INDEX.r��fromNr�r�rrr�select_from�szCanvas.select_fromcCs|j�|jdd�pdS)z(Return the item which has the selection.r�rNr�r�rrr�select_item�szCanvas.select_itemcCs|j�|jdd||�dS)z=Set the variable end of a selection in item TAGORID to INDEX.r��toNr�r�rrr�	select_to�szCanvas.select_tocCs|j�|jd|�pdS)z$Return the type of the item TAGORID.r Nr�r�rrrr �szCanvas.type)NN)N)NNN)N)N)NN)N)rZrZ)r�)ArArBrCrkr�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�rTr�r�r�r�r�r��
itemconfigr�rr�r�r�r�r�rr�r�r�r�r�r�r�r�r rrrrr�s
sz


	



	
	
r�c@sFeZdZdZdifdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�Checkbuttonz7Checkbutton widget which is either in on- or off-state.NcKst�||d||�dS)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�rrrr��s
zCheckbutton.__init__cCs|j�|jd�dS�zPut the button in off-state.�deselectNr�r�rrrr��szCheckbutton.deselectcCs|j�|jd�dS�zFlash the button.r�Nr�r�rrrr��szCheckbutton.flashcCs|j�|jd�S�z<Toggle the button and invoke a command if given as resource.r�r�r�rrrr��szCheckbutton.invokecCs|j�|jd�dS�zPut the button in on-state.r�Nr�r�rrrr��szCheckbutton.selectcCs|j�|jd�dS)zToggle the button.�toggleNr�r�rrrr��szCheckbutton.toggle)
rArBrCrkr�r�r�r�r�r�rrrrr��sr�c@s�eZdZdZdifdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�ZeZdd�ZeZdd�ZeZdd�ZeZdd�ZeZdS) �Entryz1Entry widget which allows displaying simple text.NcKst�||d||�dS)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�rrrr��szEntry.__init__cCs|j�|jd||�dS)z.Delete text from FIRST to LAST (not included).r�Nr��re�firstZlastrrrr��szEntry.deletecCs|j�|jd�S)zReturn the text.r�r�r�rrrr��sz	Entry.getcCs|j�|jd|�dS)zInsert cursor at INDEX.r�Nr��rer�rrrr��sz
Entry.icursorcCs|j�|j�|jd|��S)zReturn position of cursor.r�r!r�rrrr��s
�zEntry.indexcCs|j�|jd||�dS)zInsert STRING at INDEX.r�Nr�)rer�r�rrrr��szEntry.insertcCs|j�|jdd|�dSr�r�r^rrrr��szEntry.scan_markcCs|j�|jdd|�dS)z�Adjust the view of the canvas to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.r�r�Nr�r^rrrr��szEntry.scan_dragtocCs|j�|jdd|�dS)z9Adjust the end of the selection near the cursor to INDEX.r
r�Nr�r�rrr�selection_adjust�szEntry.selection_adjustcCs|j�|jdd�dS)r�r
r�Nr�r�rrrrszEntry.selection_clearcCs|j�|jdd|�dS)�*Set the fixed end of a selection to INDEX.r
r�Nr�r�rrr�selection_fromszEntry.selection_fromcCs|j�|j�|jdd��S)zSReturn True if there are characters selected in the entry, False
        otherwise.r
�presentr*r�rrr�selection_presents�zEntry.selection_presentcCs|j�|jdd||�dS)�3Set the selection from START to END (not included).r
�rangeNr��rer��endrrr�selection_rangeszEntry.selection_rangecCs|j�|jdd|�dS)�-Set the variable end of a selection to INDEX.r
r�Nr�r�rrr�selection_toszEntry.selection_to)N)rArBrCrkr�r�r�r�r�r�r�r�r�r�rr�r�r�r�Zselect_presentr�Zselect_ranger�r�rrrrr��s*
r�c@seZdZdZdifdd�ZdS)�FramezFFrame widget which may contain other widgets and can have a 3D border.NcKs^t||f�}d}d|kr,d|df}|d=nd|krFd|df}|d=t�||d|i|�dS)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.rr�z-classr(r	N)r+r�r�)rer�r&r�rrrrr�&szFrame.__init__r�rrrrr�#sr�c@seZdZdZdifdd�ZdS)�Labelz0Label widget which can display text and bitmaps.NcKst�||d||�dS)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�rrrr�:szLabel.__init__r�rrrrr�7sr�c@s�eZdZdZdifdd�Zdd�Zdd�Zd	d
�Zd)dd�Zd*d
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZeZd+dd�ZeZdd �ZeZd,d!d"�ZeZd#d$�Zd%d&�Zd-d'd(�ZeZdS).�Listboxz3Listbox widget which can display a list of strings.NcKst�||d||�dS)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.ZlistboxNr�r�rrrr�RszListbox.__init__cCs|j�|jd|�dS)z"Activate item identified by INDEX.�activateNr�r�rrrr\szListbox.activatecCs|�|j�|jd|��pdS)zxReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
        which encloses the item identified by the given index.r�NrAr�rrrr�`szListbox.bboxcCs|�|j�|jd��pdS)z.Return the indices of currently selected item.�curselectionrrAr�rrrreszListbox.curselectioncCs|j�|jd||�dS)z+Delete items from FIRST to LAST (included).r�Nr�r�rrrr�iszListbox.deletecCs:|dk	r$|j�|j�|jd||��S|j�|jd|�SdS)z0Get list of items from FIRST to LAST (included).Nr�rhr�rrrr�ms�zListbox.getcCs*|j�|jd|�}|dkrdS|j�|�S)z+Return index of item identified with INDEX.r�r�N�r2r�r�r��rer�rgrrrr�usz
Listbox.indexcGs|j�|jd|f|�dS)zInsert ELEMENTS at INDEX.r�Nr�)rer��elementsrrrr�{szListbox.insertcCs|j�|j�|jd|��S)z5Get index of item which is nearest to y coordinate Y.�nearestr!)rerVrrrrs
�zListbox.nearestcCs|j�|jdd||�dSr�r�r�rrrr��szListbox.scan_markcCs|j�|jdd||�dS)z�Adjust the view of the listbox to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.r�r�Nr�r�rrrr��szListbox.scan_dragtocCs|j�|jd|�dS)z"Scroll such that INDEX is visible.�seeNr�r�rrrr�szListbox.seecCs|j�|jdd|�dS)z-Set the fixed end oft the selection to INDEX.r
r�Nr�r�rrr�selection_anchor�szListbox.selection_anchorcCs|j�|jdd||�dS)z2Clear the selection from FIRST to LAST (included).r
r�Nr�r�rrrr�s
�zListbox.selection_clearcCs|j�|j�|jdd|��S)z.Return True if INDEX is part of the selection.r
Zincludesr*r�rrr�selection_includes�s�zListbox.selection_includescCs|j�|jdd||�dS)ziSet the selection from FIRST to LAST (included) without
        changing the currently selected elements.r
r�Nr�r�rrr�
selection_set�szListbox.selection_setcCs|j�|j�|jd��S)z-Return the number of elements in the listbox.r�r!r�rrrr��szListbox.sizecCs|j�|jdf|d|f�S)z4Return the resource value for an ITEM and an OPTION.r�r-r��rer�rrrrr��s�zListbox.itemcgetcKs|�d|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�r�r�rrrr��szListbox.itemconfigure)N)N)N)N)N)rArBrCrkr�rr�rr�r�r�r�rr�r�rrZ
select_anchorrr�r	Zselect_includesr
Z
select_setr�r�r�r�rrrrrOs2






rc@seZdZdZdifdd�Zd6dd�Zdd	�Zifd
d�Zifdd
�Zifdd�Z	ifdd�Z
ifdd�Zifdd�Zifdd�Z
ifdd�Zifdd�Zifdd�Zifdd�Zifd d!�Zd7d"d#�Zd$d%�Zd8d&d'�ZeZd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)9�MenuzPMenu widget which allows displaying menu bars, pull-down menus and pop-up menus.NcKst�||d||�dS)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�rrrr��sz
Menu.__init__rZcCs|j�d|j|||�dS)z/Post the menu at position X,Y with entry ENTRY.�tk_popupNr�)rerUrVr�rrrr�sz
Menu.tk_popupcCs|j�|jd|�dS)zActivate entry at INDEX.rNr�r�rrrr�sz
Menu.activatecKs$|j�|jd|f|�||��dS)rr�Nri)rer�r&r�rrrr��s
�zMenu.addcKs|�d|p|�dS)zAdd hierarchical menu item.�cascadeN�r�r�rrr�add_cascade�szMenu.add_cascadecKs|�d|p|�dS)zAdd checkbutton menu item.r�Nrr�rrr�add_checkbutton�szMenu.add_checkbuttoncKs|�d|p|�dS)zAdd command menu item.rNrr�rrr�add_command�szMenu.add_commandcKs|�d|p|�dS)zAddd radio menu item.�radiobuttonNrr�rrr�add_radiobutton�szMenu.add_radiobuttoncKs|�d|p|�dS)zAdd separator.�	separatorNrr�rrr�
add_separator�szMenu.add_separatorcKs&|j�|jd||f|�||��dS)rr�Nri)rer�r�r&r�rrrr��s
�zMenu.insertcKs|�|d|p|�dS)z$Add hierarchical menu item at INDEX.rN�r�r�rrr�insert_cascade�szMenu.insert_cascadecKs|�|d|p|�dS)z#Add checkbutton menu item at INDEX.r�Nrr�rrr�insert_checkbutton�szMenu.insert_checkbuttoncKs|�|d|p|�dS)zAdd command menu item at INDEX.rNrr�rrr�insert_command�szMenu.insert_commandcKs|�|d|p|�dS)zAddd radio menu item at INDEX.rNrr�rrr�insert_radiobutton
szMenu.insert_radiobuttoncKs|�|d|p|�dS)zAdd separator at INDEX.rNrr�rrr�insert_separator
szMenu.insert_separatorcCs�|dkr|}|�|�|�|�}}|dks2|dkr:d\}}t||d�D]0}d|�|�krHt|�|d��}|rH|�|�qH|j�|jd||�dS)z7Delete menu items between INDEX1 and INDEX2 (included).N)rr�rrr�)	r�r��entryconfigr�	entrycgetr�r2r�r�)re�index1�index2Z
num_index1Z
num_index2rgr'rrrr�	
szMenu.deletecCs|j�|jd|d|�S)z=Return the resource value of a menu item for OPTION at INDEX.rr-r�rrrrr
szMenu.entrycgetcKs|�d|f||�S)zConfigure a menu item at INDEX.�entryconfigurer�r�rrrr"
szMenu.entryconfigurecCs*|j�|jd|�}|dkrdS|j�|�S)z4Return the index of a menu item identified by INDEX.r�r�Nrrrrrr�#
sz
Menu.indexcCs|j�|jd|�S)zRInvoke a menu item identified by INDEX and execute
        the associated command.r�r�r�rrrr�)
szMenu.invokecCs|j�|jd||�dS)zDisplay a menu at position X,Y.�postNr�r�rrrr#.
sz	Menu.postcCs|j�|jd|�S)z*Return the type of the menu item at INDEX.r r�r�rrrr 2
sz	Menu.typecCs|j�|jd�dS)z
Unmap a menu.�unpostNr�r�rrrr$6
szMenu.unpostcCs|j�|j�|jd|��S)zNReturn the x-position of the leftmost pixel of the menu item
        at INDEX.�	xpositionr!r�rrrr%:
szMenu.xpositioncCs|j�|j�|jd|��S)zEReturn the y-position of the topmost pixel of the menu item at INDEX.�	ypositionr!r�rrrr&?
s
�zMenu.yposition)rZ)N)N)rArBrCrkr�rrr�rrrrrr�rrrrrr�rr"rr�r�r#r r$r%r&rrrrr�s6	


rc@seZdZdZdifdd�ZdS)�
Menubuttonz(Menubutton widget, obsolete since Tk8.0.NcKst�||d||�dS)N�
menubuttonr�r�rrrr�H
szMenubutton.__init__r�rrrrr'E
sr'c@seZdZdZdifdd�ZdS)�MessagezKMessage widget to display multiline text. Obsolete since Label does it too.NcKst�||d||�dS)N�messager�r�rrrr�O
szMessage.__init__r�rrrrr)L
sr)c@s>eZdZdZdifdd�Zdd�Zdd�Zd	d
�Zdd�ZdS)
�RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.NcKst�||d||�dS)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.rNr�r�rrrr�V
s
zRadiobutton.__init__cCs|j�|jd�dSr�r�r�rrrr�b
szRadiobutton.deselectcCs|j�|jd�dSr�r�r�rrrr�g
szRadiobutton.flashcCs|j�|jd�Sr�r�r�rrrr�k
szRadiobutton.invokecCs|j�|jd�dSr�r�r�rrrr�o
szRadiobutton.select)	rArBrCrkr�r�r�r�r�rrrrr+S
sr+c@s@eZdZdZdifdd�Zdd�Zdd�Zd
d	d
�Zdd�ZdS)�Scalez1Scale widget which can display a numerical scale.NcKst�||d||�dS)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.r�Nr�r�rrrr�w
s	zScale.__init__c
CsJ|j�|jd�}z|j�|�WStttfk
rD|j�|�YSXdS)z*Get the current value as integer or float.r�N)r2r�r�r�rwr#r�r�r�rrrr��
s
z	Scale.getcCs|j�|jd|�dS)zSet the value to VALUE.r�Nr�r�rrrr��
sz	Scale.setcCs|�|j�|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�rAr�rrrr��
szScale.coordscCs|j�|jd||�S)zcReturn where the point X,Y lies. Valid return values are "slider",
        "though1" and "though2".�identifyr�r�rrrr-�
szScale.identify)N)	rArBrCrkr�r�r�r�r-rrrrr,t
s
r,c@sPeZdZdZdifdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�	Scrollbarz?Scrollbar widget which displays a slider at a certain position.NcKst�||d||�dS)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.Z	scrollbarNr�r�rrrr��
s	zScrollbar.__init__cCs|j�|jd|�pdS)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.rNr�r�rrrr�
szScrollbar.activatecCs|j�|j�|jd||��S)znReturn the fractional change of the scrollbar setting if it
        would be moved by DELTAX or DELTAY pixels.rPr/)reZdeltaxZdeltayrrrrP�
s�zScrollbar.deltacCs|j�|j�|jd||��S)zRReturn the fractional value which corresponds to a slider
        position of X,Y.r�r/r�rrrr��
szScrollbar.fractioncCs|j�|jd||�S)zYReturn the element under position X,Y as one of
        "arrow1","slider","arrow2" or "".r-r�r�rrrr-�
szScrollbar.identifycCs|�|j�|jd��S)zZReturn the current fractional values (upper and lower end)
        of the slider position.r�)r}r2r�r�r�rrrr��
sz
Scrollbar.getcCs|j�|jd||�dS)ziSet the fractional values of the slider position (upper and
        lower ends as value between 0 and 1).r�Nr�r�rrrr��
sz
Scrollbar.set)N)rArBrCrkr�rrPr�r-r�r�rrrrr.�
s
	r.c@s�eZdZdZdifdd�Zdd�Zdd�Zd	d
�Zdkdd�Zdld
d�Z	dd�Z
dmdd�Zdd�Zdndd�Z
dd�Zdd�Zdd�Zdd�Zdodd �Zd!d"�Zdpd#d$�Zifd%d&�Zd'd(�Zd)d*�Zd+d,�Zdqd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zifd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#drdCdD�Z$dEdF�Z%dGdH�Z&dsdIdJ�Z'dtdKdL�Z(dMdN�Z)dudOdP�Z*e*Z+dQdR�Z,dvdSdT�Z-dwdUdV�Z.dxdWdX�Z/dydYdZ�Z0dzd[d\�Z1d]d^�Z2d{d_d`�Z3dadb�Z4d|dcdd�Z5e5Z6ifdedf�Z7dgdh�Z8didj�Z9dS)}�Textz4Text widget which can display text in various forms.NcKst�||d||�dS)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�rrrr��
sz
Text.__init__cCs|�|j�|jd|��pdS)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.r�NrAr�rrrr��
s
��z	Text.bboxc	Cs|j�|j�|jd|||��S)z�Return whether between index INDEX1 and index INDEX2 the
        relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.�comparer*)rer �opr!rrrr0�
s�zText.comparecGsVdd�|D�}|||g7}|jj|jdf|��p2d}|dk	rNt|�dkrN|fS|SdS)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.cSsg|]}|�d�sd|�qS)r-r�)�
startswith)rJ�argrrrr�s
zText.count.<locals>.<listcomp>r|N�)r2r�r�r)rer r!r�rrrrr|�
sz
Text.countcCs6|dkr |j�|j�|jd��S|j�|jd|�dS)zjTurn on the internal consistency checks of the B-Tree inside the text
        widget according to BOOLEAN.N�debugr*r�rrrr5	sz
Text.debugcCs|j�|jd||�dS)z?Delete the characters between INDEX1 and INDEX2 (not included).r�Nr��rer r!rrrr�szText.deletecCs|�|j�|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.�	dlineinforAr�rrrr7szText.dlineinfoc
	Ks�g}d}d}|s$g}|fdd�}|}zzt|t�s>|�|�}}|d|g7}|D]}	||	rN|�d|	�qN|�|�|r�|�|�|jj|jdf|��|W�S|r�|�|�XdS)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.NcSs|�|||f�dSr�)rc)r6r
r�r%rrr�
append_triple/sz Text.dump.<locals>.append_triplez-commandr-�dump)r�rrr�rcr2r�r�)
rer r!rr�r�Z	func_namer%r8r6rrrr9s*


z	Text.dumpcGs|jj|jdf|��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

        �editr�r�rrrr:Bs
z	Text.editcCs|�d|�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.
        Zmodified�r:)rer3rrr�
edit_modifiedQs	zText.edit_modifiedcCs
|�d�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.
        Zredor;r�rrr�	edit_redo\szText.edit_redocCs
|�d�S)z(Clears the undo and redo stacks
        �resetr;r�rrr�
edit_resetfszText.edit_resetcCs
|�d�S)znInserts a separator (boundary) on the undo stack.

        Does nothing when the undo option is false
        rr;r�rrr�edit_separatorkszText.edit_separatorcCs
|�d�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
        Zundor;r�rrr�	edit_undors	zText.edit_undocCs|j�|jd||�S)z5Return the text from INDEX1 to INDEX2 (not included).r�r�r6rrrr�}szText.getcCsJ|dd�dkrd|}|dd�dkr4|dd�}|j�|jdd||�S)z9Return the value of OPTION of an embedded image at INDEX.Nrr-r�r�r�r�r�rrrr�
image_cget�s
zText.image_cgetcKs|�dd|f||�S)z%Configure an embedded image at INDEX.r�r�r�r�rrr�image_configure�szText.image_configurecKs"|jj|jdd|f|�||���S)z"Create an embedded image at INDEX.r�r@rir�rrr�image_create�s�
�zText.image_createcCs|j�|jdd�S)z3Return all names of embedded images in this widget.r�r�r�r�rrrr��szText.image_namescCst|j�|jd|��S)z1Return the index in the form line.char for INDEX.r�)rr2r�r�r�rrrr��sz
Text.indexcGs|j�|jd||f|�dS)z�Insert CHARS before the characters at INDEX. An additional
        tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.r�Nr�)rer��charsr�rrrr��szText.insertcCs|j�|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�Zgravityr�)re�markName�	directionrrr�mark_gravity�s�zText.mark_gravitycCs|j�|j�|jdd��S)zReturn all mark names.r�r�rhr�rrr�
mark_names�s
�zText.mark_namescCs|j�|jdd||�dS)z0Set mark MARKNAME before the character at INDEX.r�r�Nr�)rerFr�rrr�mark_set�sz
Text.mark_setcGs|j�|jddf|�dS)zDelete all marks in MARKNAMES.r�ZunsetNr�)reZ	markNamesrrr�
mark_unset�szText.mark_unsetcCs|j�|jdd|�pdS)z-Return the name of the next mark after INDEX.r��nextNr�r�rrr�	mark_next�szText.mark_nextcCs|j�|jdd|�pdS)z2Return the name of the previous mark before INDEX.r�ZpreviousNr�r�rrr�
mark_previous�szText.mark_previouscKs&|jj|jdd|f|�||���dS)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.�peerr@Nri)reZnewPathNamer&r�rrr�peer_create�s
�zText.peer_createcCs|j�|j�|jdd��S)zYReturns a list of peers of this widget (this does not include
        the widget itself).rOr�rhr�rrr�
peer_names�szText.peer_namescGs |jj|jd|||f|��dS)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.rNr�)rer r!rEr�rrrr�szText.replacecCs|j�|jdd||�dSr�r�r�rrrr��szText.scan_markcCs|j�|jdd||�dS)z~Adjust the view of the text to 10 times the
        difference between X and Y and the coordinates given in
        scan_mark.r�r�Nr�r�rrrr��szText.scan_dragtocCs�|jdg}|r|�d�|r&|�d�|r4|�d�|rB|�d�|rP|�d�|
r^|�d�|	rv|�d�|�|	�|r�|d	d
kr�|�d�|�|�|�|�|r�|�|�t|j�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-countrr-r�)r�rcrr2r�r)rerr�Z	stopindexZforwardsZ	backwards�exactZregexpZnocaser|Zelider�rrrr�s.












zText.searchcCs|j�|jd|�dS)z3Scroll such that the character at INDEX is visible.rNr�r�rrrr�szText.seecGs |j�|jdd||f|�dS)z|Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
        Additional pairs of indices may follow in ARGS.�tagr�Nr�)re�tagNamer r�rrr�tag_add�s�zText.tag_addcCs*|j�|jdd||d�|r&|�|�dS)zgUnbind for all characters with TAGNAME for event SEQUENCE  the
        function identified with FUNCID.rSrprZNrs)rerTrlrnrrrr��szText.tag_unbindcCs|�|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.rSrprq)rerTrlr�r�rrrr�s
�z
Text.tag_bindcCsJ|dd�dkrd|}|dd�dkr4|dd�}|j�|jdd||�S)z+Return the value of OPTION for tag TAGNAME.Nrr-r�r�rSr�r�)rerTrrrr�tag_cget	s
z
Text.tag_cgetcKs|�dd|f||�S)zConfigure a tag TAGNAME.rSr�r�)rerTr&r�rrr�
tag_configureszText.tag_configurecGs|j�|jddf|�dS)zDelete all tags in TAGNAMES.rSr�Nr�)reZtagNamesrrr�
tag_deleteszText.tag_deletecCs|j�|jdd||�dS)z`Change the priority of tag TAGNAME such that it is lower
        than the priority of BELOWTHIS.rSrNr�)rerTrrrrr�szText.tag_lowercCs|j�|j�|jdd|��S)zReturn a list of all tag names.rSr�rhr�rrr�	tag_names s�zText.tag_namesc
Cs |j�|j�|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.rSZ	nextrangerh�rerTr r!rrr�
tag_nextrange%s�zText.tag_nextrangec
Cs |j�|j�|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.rSZ	prevrangerhrZrrr�
tag_prevrange,s�zText.tag_prevrangecCs|j�|jdd||�dS)zaChange the priority of tag TAGNAME such that it is higher
        than the priority of ABOVETHIS.rSrNr�)rerTrrrrr�3s�zText.tag_raisecCs|j�|j�|jdd|��S)z7Return a list of ranges of text which have tag TAGNAME.rSZrangesrh)rerTrrr�
tag_ranges9s�zText.tag_rangescCs|j�|jdd|||�dS)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.rSr�Nr�rZrrr�
tag_remove>s�zText.tag_removecCsJ|dd�dkrd|}|dd�dkr4|dd�}|j�|jdd||�S)z:Return the value of OPTION of an embedded window at INDEX.Nrr-r�r�r�r�r�rrrr�window_cgetCs
zText.window_cgetcKs|�dd|f||�S)z&Configure an embedded window at INDEX.r�r�r�r�rrr�window_configureKszText.window_configurecKs&|j�|jdd|f|�||��dS)zCreate a window at INDEX.r�r@Nrir�rrr�
window_createQs

��zText.window_createcCs|j�|j�|jdd��S)z4Return all names of embedded windows in this widget.r�r�rhr�rrr�window_namesWs�zText.window_namescGs|j�|jddf|�dS)zObsolete function, use see.r�z
-pickplaceNr�)rerqrrr�yview_pickplace\szText.yview_pickplace)N)N)NN)N)N)N)N)NNNNNNNN)N)N)N)N)N)N)N)N)N)N):rArBrCrkr�r�r0r|r5r�r7r9r:r<r=r?r@rAr�rBrCrDr�r�r�rHrIrJrKrMrNrPrQrr�r�rrrUr�r�rVrWZ
tag_configrXr�rYr[r\r�r]r^r_r`Z
window_configrarbrcrrrrr/�
s~


(




�


	







r/c@s"eZdZdZddd�Zdd�ZdS)�_setitz>Internal class. It wraps the command in the widget OptionMenu.NcCs||_||_||_dSr�)�
_setit__value�_setit__var�_setit__callback)re�varr
r�rrrr�dsz_setit.__init__cGs*|j�|j�|jr&|j|jf|��dSr�)rfr�rergr�rrrr�isz_setit.__call__)Nr�rrrrrdas
rdc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
OptionMenuz?OptionMenu which allows the user to select a value from a menu.c
Os�d|dtddd�}t�||d|�d|_t|ddd	�}|_|j|_|�d
�}d
|kr\|d
=|rtt	dt
t|����|j|t
|||�d�|D]}	|j|	t
||	|�d�q�||d<d
S)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.r,rr')ZborderwidthZtextvariableZindicatoronZreliefr�Zhighlightthicknessr(Z
tk_optionMenur
r)rYZtearoffrzunknown option -)r�rN)ZRAISEDr�r�r~r�_OptionMenu__menur�Zmenunamer�r�rLr0rrd)
rer�r�r
rR�kwargsr�r
r�r*rrrr�rs.�

�
�zOptionMenu.__init__cCs|dkr|jSt�||�S)Nr
)rjr�r�r�rrrr��szOptionMenu.__getitem__cCst�|�d|_dS)z,Destroy this widget and the associated menu.N)r'r�rjr�rrrr��s
zOptionMenu.destroyN)rArBrCrkr�r�r�rrrrriosric@sheZdZdZdZdidfdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
e
Zdd�Zdd�Z
dd�ZdS)�ImagezBase class for images.rNc	Ks�d|_|std�}t|d|�|_|s>tjd7_dtjf}|rT|rTt||f�}n|r\|}d}|��D]*\}}t|�r�|�	|�}|d||f}qh|j�
dd||f|�||_dS)	Nzcreate imager2rz	pyimage%rrr-r�r@)rYrsr`r2rl�_last_idr+r%r�r�r�)	reZimgtyperYr&r�r�r�r)r*rrrr��s$
zImage.__init__cCs|jSr�)rYr�rrrrF��z
Image.__str__cCs6|jr2z|j�dd|j�Wntk
r0YnXdS)Nr�r�)rYr2r�r�r�rrrr��s
z
Image.__del__cCs|j�|jdd||�dS�Nr�r-�r2r�rYr�rrrr��szImage.__setitem__cCs|j�|jdd|�Srorpr�rrrr��szImage.__getitem__cKsvd}t|���D]J\}}|dk	r|ddkr8|dd�}t|�rJ|�|�}|d||f}q|j�|jdf|�dS)zConfigure the image.rNr�r�r-r�)r+r%r�r�r2r�rY)rer�rr)r*rrrr��s
zImage.configurecCs|j�|j�dd|j��S)zReturn the height of the image.r�rX�r2r�r�rYr�rrrrX�s�zImage.heightcCs|j�dd|j�S)z7Return the type of the image, e.g. "photo" or "bitmap".r�r rpr�rrrr �sz
Image.typecCs|j�|j�dd|j��S)zReturn the width of the image.r�rWrqr�rrrrW�s�zImage.width)rArBrCrkrmr�rFr�r�r�r�r�rXr rWrrrrrl�srlc@s�eZdZdZdidfdd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Z	ddd�Z
dd�Zddd�Zddd�Z
dd�Zdd�ZdS) �
PhotoImagez=Widget which can display images in PGM, PPM, GIF, PNG format.NcKstj|d|||f|�dS)ztCreate an image with NAME.

        Valid resource names: data, format, file, gamma, height, palette,
        width.ZphotoN�rlr��rerYr&r�r�rrrr��szPhotoImage.__init__cCs|j�|jd�dS)zDisplay a transparent image.�blankNrpr�rrrru�szPhotoImage.blankcCs|j�|jdd|�S)zReturn the value of OPTION.r�r-rp)rerrrrr��szPhotoImage.cgetcCs|j�|jdd|�S)Nr�r-rpr�rrrr��szPhotoImage.__getitem__cCs"t|jd�}|j�|d|j�|S)z;Return a new PhotoImage with the same image as this widget.r��copy�rrr2r�rY)re�	destImagerrrrv�szPhotoImage.copyrZcCs4t|jd�}|dkr|}|j�|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�rZrvz-zoomrw�rerUrVrxrrr�zoom�s
zPhotoImage.zoomcCs4t|jd�}|dkr|}|j�|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�rZrvz
-subsamplerwryrrr�	subsample�s
zPhotoImage.subsamplecCs|j�|jd||�S)z8Return the color (red, green, blue) of the pixel at X,Y.r�rpr�rrrr�	szPhotoImage.getcCsH|jd|f}|r8|ddkr(|dd�}|dt|�}|j�|�dS)zzPut row formatted colors to image starting from
        position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))�putr�-torN)r}�rYrr2r�)rer�r�r�rrrr|
szPhotoImage.putcCs@|jd|f}|r|d|f}|r0|dt|�}|j�|�dS)zRWrite image to file FILENAME in FORMAT starting from
        position FROM_COORDS.�writez-format)z-fromNr~)re�filename�formatZfrom_coordsr�rrrrszPhotoImage.writec	Cs|j�|j�|jdd||��S)z/Return True if the pixel at x,y is transparent.�transparencyr�)r2r�r�rYr�rrr�transparency_get"s�zPhotoImage.transparency_getcCs|j�|jdd|||�dS)z)Set the transparency of the pixel at x,y.r�r�Nrp)rerUrVr�rrr�transparency_set'szPhotoImage.transparency_set)rZ)rZ)N)NN)rArBrCrkr�rur�r�rvrzr{r�r|rr�r�rrrrrr�s






rrc@s eZdZdZdidfdd�ZdS)�BitmapImagez.Widget which can display images in XBM format.NcKstj|d|||f|�dS)zqCreate a bitmap with NAME.

        Valid resource names: background, data, file, foreground, maskdata, maskfile.rNrsrtrrrr�/szBitmapImage.__init__r�rrrrr�,sr�cCstd�j}|�|�dd��S)Nzuse image_names()r�r��rsr2r.r��r2rrrr�6s
r�cCstd�j}|�|�dd��S)Nzuse image_types()r�r�r�r�rrrr�;s
r�c@s�eZdZdZdifdd�Zdd�Zd+dd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd,d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdS)-�Spinboxzspinbox widget.NcKst�||d||�dS)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,
        ZspinboxNr�r�rrrr�CszSpinbox.__init__cCs|�|j�|jd|��pdS)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.
        r�NrAr�rrrr�`szSpinbox.bboxcCs|j�|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.
        r�r�r�rrrr�ns	zSpinbox.deletecCs|j�|jd�S)zReturns the spinbox's stringr�r�r�rrrr�yszSpinbox.getcCs|j�|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
        r�r�r�rrrr�}szSpinbox.icursorcCs|j�|jd||�S)z{Returns the name of the widget at position x, y

        Return value is one of: none, buttondown, buttonup, entry
        r-r�r�rrrr-�szSpinbox.identifycCs|j�|jd|�S)z;Returns the numerical index corresponding to index
        r�r�r�rrrr��sz
Spinbox.indexcCs|j�|jd||�S)zDInsert string s at index

         Returns an empty string.
        r�r�)rer�rfrrrr��szSpinbox.insertcCs|j�|jd|�S)z�Causes the specified element to be invoked

        The element could be buttondown or buttonup
        triggering the action associated with it.
        r�r��re�elementrrrr��szSpinbox.invokecGs |�|j�|jdf|��pdS)rr�rrAr�rrrr��s
��zSpinbox.scancCs|�d|�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��r�r^rrrr��szSpinbox.scan_markcCs|�d|�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.
        r�r�r^rrrr��s
zSpinbox.scan_dragtocGs |�|j�|jdf|��pdS)rr
rrAr�rrrr
�s
��zSpinbox.selectioncCs|�d|�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
r�rrrr��szSpinbox.selection_adjustcCs
|�d�S)zsClear the selection

        If the selection isn't in this widget then the
        command has no effect.
        r�r�r�rrrr�szSpinbox.selection_clearcCs|j�|jdd|�S)z�Sets or gets the currently selected element.

        If a spinbutton element is specified, it will be
        displayed depressed.
        r
r�r�r�rrr�selection_element�szSpinbox.selection_elementcCs|�d|�dS)r�r�Nr�r�rrrr��szSpinbox.selection_fromcCs|j�|j�|jdd��S)zUReturn True if there are characters selected in the spinbox, False
        otherwise.r
r�r*r�rrrr��s�zSpinbox.selection_presentcCs|�d||�dS)r�r�Nr�r�rrrr��szSpinbox.selection_rangecCs|�d|�dS)r�r�Nr�r�rrrr��szSpinbox.selection_to)N)N)rArBrCrkr�r�r�r�r�r-r�r�r�r�r�r�r
r�rr�r�r�r�r�rrrrr�@s*
	
r�c@seZdZdZdifdd�ZdS)�
LabelFramezlabelframe widget.NcKst�||d||�dS)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
        Z
labelframeNr�r�rrrr��szLabelFrame.__init__r�rrrrr��sr�c@s�eZdZdZdifdd�Zdd�Zdd�ZeZd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd!dd�ZeZdd �ZdS)"�PanedWindowzpanedwindow widget.NcKst�||d||�dS)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,
        ZpanedwindowNr�r�rrrr�
szPanedWindow.__init__cKs"|j�|jd|f|�|��dS)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�Nri)rer&r�rrrr�szPanedWindow.addcCs|j�|jd|�dS)z�Remove the pane containing child from the panedwindow

        All geometry management options for child will be forgotten.
        rNr�)rer&rrrr�'szPanedWindow.removecCs|j�|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-r�r�rrrr-0s
zPanedWindow.identifycGs |�|j�|jdf|��pdS)r�proxyrrAr�rrrr�<s
��zPanedWindow.proxycCs
|�d�S)zBReturn the x and y pair of the most recent proxy location
        �coord�r�r�rrr�proxy_coordAszPanedWindow.proxy_coordcCs
|�d�S)z+Remove the proxy from the display.
        rr�r�rrr�proxy_forgetFszPanedWindow.proxy_forgetcCs|�d||�S)z:Place the proxy at the given x and y coordinates.
        r�r�r�rrr�proxy_placeKszPanedWindow.proxy_placecGs |�|j�|jdf|��pdS)r�sashrrAr�rrrr�Ps
��zPanedWindow.sashcCs|�d|�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�r�rrr�
sash_coordUszPanedWindow.sash_coordcCs|�d|�S)zRecords x and y for the sash given by index;

        Used in conjunction with later dragto commands to move the sash.
        r�r�r�rrr�	sash_markcszPanedWindow.sash_markcCs|�d|||�S)z?Place the sash given by index at the given coordinates
        r�r�)rer�rUrVrrr�
sash_placejszPanedWindow.sash_placecCs|j�|jdf|d|f�S)zwQuery a management option for window.

        Option may be any value allowed by the paneconfigure subcommand
        �panecgetr-r�)rer&rrrrr�os�zPanedWindow.panecgetcKsd|dkr|s|�|jd|�St|t�r@|s@|�|jd|d|�S|j�|jd|f|�||��dS)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�
paneconfigurer-)r�r�rrr�r2r�r�r�rrrr�wsD�
�zPanedWindow.paneconfigurecCs|j�|j�|jd��S)z+Returns an ordered list of the child panes.�panesrhr�rrrr��szPanedWindow.panes)N)rArBrCrkr�r�r�rr-r�r�r�r�r�r�r�r�r�r�Z
paneconfigr�rrrrr�
s$

Lr�cCs�t�}dt}|d7}t||d�}|��t|d|fdd�d�}|��||_t|d|jd�}|��|��|��|�	�|�
�dS)	NzThis is Tcl/Tk version %su
This should be a cedilla: ç�r�z	Click me!cSs|jjd|jdd�S)Nz[%s]r�r�)�testr�)rrrrr�<lambda>�s�z_test.<locals>.<lambda>)r�rZQUIT)ro�
TclVersionr�r�rDr�r�rr!rr�)rrr�r�r�r{rrr�_test�s 
�r��__main__)TN)N)r)r)NNror)Vrk�enumr�r�r�Ztkinter.constants�rerA�floatrPZ	TkVersionrQr�ZREADABLEZWRITABLEZ	EXCEPTION�compiler�ASCIIrr
rrr"r+r7r�Enumr8rGrlrmrnrsrvrzr�r{r�r�r�r�r�rar�r�r�r�r�r�r�r�rorgrhrqrvr{r�r�rDr�r�r�r�r�rrr'r)r+r,r.r/rdrirlrrr�r�r�r�r�r�r�rArrrr�<module>s� 





,R

	6

q2~
.37?/8$Vt!'2'BT
3C


Hacked By AnonymousFox1.0, Coded By AnonymousFox