Sindbad~EG File Manager
3
\;��@s�dZddlZddlZddlZejZddlTddlZdZeej �Z
eej�Zej
Z
ejZejZejd�Zejdej�Zdd�Zd d
�Zdd�Zy
ejZWnek
r�YnXd
d�Zy
ejZWnek
r�YnXdwdd�ZGdd�deej�ZGdd�d�Zdadadd�Z dd�Z!dxdd�Z"da#Gdd�d�Z$Gdd�de$�Z%Gd d!�d!e$�Z&Gd"d#�d#e$�Z'Gd$d%�d%e$�Z(dyd&d'�Z)e*Z+eZ,d(d)�Z-Gd*d+�d+�Z.Gd,d-�d-�Z/Gd.d/�d/�Z0Gd0d1�d1�Z1Gd2d3�d3�Z2Gd4d5�d5e.e2�Z3dzd6d7�Z4Gd8d9�d9�Z5Gd:d;�d;�Z6Gd<d=�d=�Z7Gd>d?�d?e.�Z8Gd@dA�dAe8e5e6e7�Z9GdBdC�dCe8e2�Z:GdDdE�dEe9�Z;GdFdG�dGe9e0e1�Z<GdHdI�dIe9�Z=GdJdK�dKe9e0�Z>GdLdM�dMe9�Z?GdNdO�dOe9�Z@GdPdQ�dQe9e0e1�ZAGdRdS�dSe9�ZBGdTdU�dUe9�ZCGdVdW�dWe9�ZDGdXdY�dYe9�ZEGdZd[�d[e9�ZFGd\d]�d]e9�ZGGd^d_�d_e9e0e1�ZHGd`da�da�ZIGdbdc�dceC�ZJGddde�de�ZKGdfdg�dgeK�ZLGdhdi�dieK�ZMdjdk�ZNdldm�ZOGdndo�doe9e0�ZPGdpdq�dqe9�ZQGdrds�dse9�ZRdtdu�ZSeTdvk�r�eS�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])cCsdjtt|��S)zInternal function.� )�join�map�
_stringify)�value�r �(/usr/lib64/python3.6/tkinter/__init__.py�_join7srcCs�t|ttf�rHt|�dkr:t|d�}tj|�rFd|}q�dt|�}ntt|�}|sZd}nbtj|�r�tj d|�}|j
dd�}tj d|�}|ddkr�d |}n|ddks�tj|�r�d|}|S)
zInternal function.rrz{%s}z{}z\\\1�
z\n�"�\)�
isinstance�list�tuple�lenr� _magic_re�searchr�str�sub�replace� _space_re)rr r r
r;s$
rcCsDf}x:|D]2}t|ttf�r*|t|�}q
|dk r
||f}q
W|S)zInternal function.N)rrr�_flatten)�seq�res�itemr r r
rSs
rcCs�t|t�r|St|td�tf�r$|Si}xnt|�D]b}y|j|�Wq2ttfk
r�}z.td|�x|j �D]\}}|||<qnWWYdd}~Xq2Xq2W|SdS)zInternal function.Nz_cnfmerge: fallback due to:)
r�dict�typerr�update�AttributeError� TypeError�print�items)Zcnfs�cnf�c�msg�k�vr r r
� _cnfmerge`s
"r)Tc Cs~|j|�}t|�drtd��t|�}i}xNt||�D]@\}}t|�}|rb|ddkrb|dd�}|rn||�}|||<q6W|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�keyrr r r
�
_splitdictts
r5c@s�eZdZdZefZdZdZefZdZdZ dZ
dZdZd Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d)Z&d*Z'd+Z(d,Z)d&d'�Z*d(S)-� EventType�2�3�4�5�6�7�8�9Z10Z11Z12Z13Z14Z15Z16Z17Z18Z19Z20Z21Z22Z23Z24Z25Z26Z27Z28Z29Z30Z31Z32Z33Z34�35�36�37�38cCs|jS)N)�name)�selfr r r
�__str__�szEventType.__str__N)r?)r@)rA)rB)+�__name__�
__module__�__qualname__ZKeyPressZKeyZ
KeyReleaseZButtonPress�ButtonZ
ButtonReleaseZMotionZEnterZLeaveZFocusInZFocusOutZKeymapZExposeZGraphicsExposeZNoExposeZ
VisibilityZCreateZDestroyZUnmapZMapZ
MapRequestZReparentZ ConfigureZConfigureRequestZGravityZ
ResizeRequestZ CirculateZCirculateRequestZPropertyZSelectionClearZSelectionRequestZ SelectionZColormapZ
ClientMessage�MappingZVirtualEventZActivateZ
DeactivateZ
MouseWheelrEr r r r
r6�sPr6c@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)
c
sdd�|jj�D��|js"�d=n|jdkr:t|j��d<t|dd�sL�d=|jdkr^�d=n�t|jt�r�|j}d%}g}x*t|�D]\}}|d|>@r�|j |�q�W|dt
|�>d@}|s�|r�|j t|��dj|��d<|j
dk�r�d=d&}d!|jd"j�fd#d$�|D��fS)'NcSsi|]\}}|dkr||�qS)z??r )�.0r'r(r r r
�
<dictcomp>�sz"Event.__repr__.<locals>.<dictcomp>�charz??�
send_eventTr�state�Shift�Lock�Control�Mod1�Mod2�Mod3�Mod4�Mod5�Button1�Button2�Button3�Button4�Button5r�|�delta�keysym�keycode�num�focus�x�y�width�heightz<%s event%s>�c3s&|]}|�krd|�|fVqdS)z %s=%sNr )rLr')�attrsr r
� <genexpr>sz!Event.__repr__.<locals>.<genexpr>)
rQrRrSrTrUrVrWrXrYrZr[r\r])rOrPr`rarNrbr_rcrdrerfrg)�__dict__r#rN�repr�getattrrPr�int� enumerate�appendr�hexrr_r)rDrPZmods�s�i�n�keysr )rir
�__repr__�s>
zEvent.__repr__N)rFrGrH�__doc__rvr r r r
rK�s)rKcCsdadabdS)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.
rN)�_support_default_root�
_default_rootr r r r
�
NoDefaultRoot
srzcCsdS)zInternal function.Nr )�errr r r
�_tkerrorsr|cCs.yt|�}Wntk
r YnXt|��dS)zBInternal function. Calling it will raise the exception SystemExit.N)rn�
ValueError�
SystemExit)�coder r r
�_exits
r�c@s�eZdZdZdZdZdZddd�Zdd�Zdd �Z d
d�Z
e
Zdd
�Zdd�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().rhNcCs�|dk rt|t�rtd��|s$t}|j�|_|j|_|rB||_ndtt �|_t d7a |dk rl|j
|�n&|jj|jjdd|j��s�|j
|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 string�PY_VARr�info�exists)rrr!ry�_rootr0�_tk�_namerl�_varnum�
initialize�
getboolean�call�_default)rD�masterrrCr r r
�__init__+s
zVariable.__init__cCsf|jdkrdS|jj|jjdd|j��r6|jj|j�|jdk rbx|jD]}|jj|�qHWd|_dS)zUnset the variable in Tcl.Nr�r�)r�r�r�r�Zglobalunsetvar�_tclCommands�
deletecommand)rDrCr r r
�__del__Hs
zVariable.__del__cCs|jS)z'Return the name of the variable in Tcl.)r�)rDr r r
rESszVariable.__str__cCs|jj|j|�S)zSet the variable to VALUE.)r��globalsetvarr�)rDrr r r
�setVszVariable.setcCs|jj|j�S)zReturn value of variable.)r��globalgetvarr�)rDr r r
�getZszVariable.getcCs�t|d|j�j}tt|��}y
|j}Wntk
r:YnXy||j}Wntk
r^YnX|jj ||�|j
dkr~g|_
|j
j|�|S)N)�CallWrapperr��__call__rl�id�__func__r rFr��
createcommandr�rp)rD�callback�f�cbnamer r r
� _register^s
zVariable._registercCs(|j|�}|jjddd|j||f�|S)a#Define a trace callback for the variable.
Mode is one of "read", "write", "unset", or a list or tuple of
such strings.
Callback must be a function which is called when the variable is
read, written or unset.
Return the name of the callback.
�trace�add�variable)r�r�r�r�)rD�moder�r�r r r
� trace_addos
zVariable.trace_addcCsz|jjddd|j||�x\|j�D]\}}|jj|�d|kr"Pq"W|jj|�y|jj|�Wntk
rtYnXdS)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�r})rDr�r��m�car r r
�trace_remove~szVariable.trace_removec s4|jj��fdd�t��|jjddd|j���D�S)z&Return all trace callback information.csg|]\}}�|�|f�qSr r )rLr'r()r,r r
�
<listcomp>�sz'Variable.trace_info.<locals>.<listcomp>r�r�r�)r�r,rr�r�)rDr )r,r
r��szVariable.trace_infocCs$|j|�}|jjdd|j||�|S)a�Define a trace callback for the variable.
MODE is one of "r", "w", "u" for read, write, undefine.
CALLBACK must be a function which is called when
the variable is read, written or undefined.
Return the name of the callback.
This deprecated method wraps a deprecated Tcl method that will
likely be removed in the future. Use trace_add() instead.
r�r�)r�r�r�r�)rDr�r�r�r r r
�trace_variable�s
zVariable.trace_variablecCs�|jjdd|j||�|jj|�d}x\|j�D]\}}|jj|�d|kr0Pq0W|jj|�y|jj|�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�r})rDr�r�r�r�r r r
�
trace_vdelete�s
zVariable.trace_vdeletecs(�fdd��jj�jjdd�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|]}�jj|��qSr )r�r,)rLrd)rDr r
r��sz(Variable.trace_vinfo.<locals>.<listcomp>r�Zvinfo)r�r,r�r�)rDr )rDr
�trace_vinfo�szVariable.trace_vinfocCs|jj|jjko|j|jkS)z�Comparison for equality (==).
Note: if the Variable's master matters to behavior
also compare self._master == other._master
)� __class__rFr�)rD�otherr r r
�__eq__�szVariable.__eq__)NNN)rFrGrHrwr�r�r�r�r�rEr�r�r�r�r�r�r�r�r�r�r�r�r r r r
r�#s&
r�c@s&eZdZdZdZddd�Zdd�ZdS) � StringVarz#Value holder for strings variables.rhNcCstj||||�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�)rDr�rrCr r r
r��s
zStringVar.__init__cCs$|jj|j�}t|t�r|St|�S)z#Return value of variable as string.)r�r�r�rr)rDrr r r
r��s
z
StringVar.get)NNN)rFrGrHrwr�r�r�r r r r
r��s
r�c@s&eZdZdZdZddd�Zdd�ZdS) �IntVarz#Value holder for integer variables.rNcCstj||||�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.
N)r�r�)rDr�rrCr r r
r��s
zIntVar.__init__cCsD|jj|j�}y|jj|�Sttfk
r>t|jj|��SXdS)z/Return the value of the variable as an integer.N)r�r�r��getintr!�TclErrorrn� getdouble)rDrr r r
r��s
z
IntVar.get)NNN)rFrGrHrwr�r�r�r r r r
r��s
r�c@s&eZdZdZdZddd�Zdd�ZdS) � DoubleVarz!Value holder for float variables.gNcCstj||||�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.
N)r�r�)rDr�rrCr r r
r�s
zDoubleVar.__init__cCs|jj|jj|j��S)z,Return the value of the variable as a float.)r�r�r�r�)rDr r r
r�sz
DoubleVar.get)NNN)rFrGrHrwr�r�r�r r r r
r�s
r�c@s2eZdZdZdZd
dd�Zdd�ZeZdd �ZdS)�
BooleanVarz#Value holder for boolean variables.FNcCstj||||�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.
N)r�r�)rDr�rrCr r r
r�s
zBooleanVar.__init__cCs|jj|j|jj|��S)zSet the variable to VALUE.)r�r�r�r�)rDrr r r
r�"szBooleanVar.setcCs8y|jj|jj|j��Stk
r2td��YnXdS)z+Return the value of the variable as a bool.z invalid literal for getboolean()N)r�r�r�r�r�r})rDr r r
r�'szBooleanVar.get)NNN) rFrGrHrwr�r�r�r�r�r r r r
r�s
r�cCstjj|�dS)zRun the main loop of Tcl.N)ryr0�mainloop)rtr r r
r�.sr�cCs.ytjj|�Stk
r(td��YnXdS)z1Convert true and false to integer values 1 and 0.z invalid literal for getboolean()N)ryr0r�r�r})rrr r r
r�6sr�c@seZdZdZdZdZdd�Zdd�Z�dCdd�Zd d
�Z dd�Z
�dDdd�ZeZ�dEdd�Z
�dFdd�Z�dGdd�Z�dHdd�Zdd�Zdd�Zdd�Zdd �ZeZd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z�dId/d0�Zd1d2�Zd3d4�Z�dJd6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(�dKdHdI�Z)dJdK�Z*dLdM�Z+�dLdNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/dVdW�Z0dXdY�Z1dZd[�Z2�dMd\d]�Z3�dNd^d_�Z4e4Z5�dOd`da�Z6�dPdbdc�Z7ddde�Z8dfdg�Z9dhdi�Z:djdk�Z;�dQdldm�Z<dndo�Z=dpdq�Z>drds�Z?dtdu�Z@dvdw�ZAdxdy�ZB�dRdzd{�ZCd|d}�ZDd~d�ZEd�d��ZFd�d��ZG�dSd�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^�dTd�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�dZfd�dĄZgd�dƄZhd�dȄZid�dʄZj�dUd�d̄Zk�dVd�dτZl�dWd�dфZm�dXd�dӄZn�dYd�dՄZod�dׄZp�dZd�dلZqd�dۄZr�d[d�d݄Zsd�d߄Ztd�d�Zud�d�Zvd�d�Zwd�d�Zxeyd�d��Zz�d\d�d�Z{d�d�Z|e|Z}�d]d�d�Z~e~Zd�d�Z��d^Z��dj�e��Z��d�d�Z��d�d �Z��d
�d�Z��d�d
�Z��d�d�Z��d_�d�d�Z�e�Z��d�d�Z�e�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��dgZ�e�f�d�d�Z�e�Z��d�d �Z�e�Z��d!�d"�Z��d`�d#�d$�Z�e�Z��da�d%�d&�Z�e�Z��d'�d(�Z��d)�d*�Z�if�d+�d,�Z�e�Z��d-�d.�Z�e�f�d/�d0�Z�if�d1�d2�Z�e�Z��d3�d4�Z�e�Z��db�d5�d6�Z��d7�d8�Z��d9�d:�Z��d;�d<�Z��dc�d=�d>�Z��d?�d@�Z��dA�dB�Z�dS(d�MisczRInternal class.
Base class which defines methods common for interior widgets.NcCs0|jdk r,x|jD]}|jj|�qWd|_dS)zkInternal function.
Delete all Tcl commands created for
this widget in the Tcl interpreter.N)r�r0r�)rDrCr r r
�destroyHs
zMisc.destroycCs6|jj|�y|jj|�Wntk
r0YnXdS)zDInternal function.
Delete the Tcl command provided in NAME.N)r0r�r�r�r})rDrCr r r
r�Rs
zMisc.deletecommandcCs|jj|jjdd|��S)z�Set Tcl internal variable, whether the look and feel
should adhere to Motif.
A parameter of 1 means adhere to Motif (e.g. no color
change if mouse passes over slider).
Returns the set value.r��tk_strictMotif)r0r�r�)rD�booleanr r r
r�\szMisc.tk_strictMotifcCs|jjd�dS)zDChange the color scheme to light brown as used in Tk 3.6 and before.� tk_bisqueN)r0r�)rDr r r
r�eszMisc.tk_bisquecOs(|jjdt|�tt|j����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)r�)r0r�rrr#)rD�args�kwr r r
r�hszMisc.tk_setPaletter�cCs|jjdd|�dS)z�Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or
BooleanVar must be given.�tkwaitr�N)r0r�)rDrCr r r
�
wait_variableuszMisc.wait_variablecCs"|dkr|}|jjdd|j�dS)zQWait until a WIDGET is destroyed.
If no parameter is given self is used.Nr��window)r0r��_w)rDr�r r r
�wait_window|szMisc.wait_windowcCs"|dkr|}|jjdd|j�dS)zxWait until the visibility of a WIDGET changes
(e.g. it appears).
If no parameter is given self is used.Nr�Z
visibility)r0r�r�)rDr�r r r
�wait_visibility�szMisc.wait_visibility�1cCs|jj||�dS)zSet Tcl variable NAME to VALUE.N)r0�setvar)rDrCrr r r
r��szMisc.setvarcCs|jj|�S)z"Return value of Tcl variable NAME.)r0�getvar)rDrCr r r
r��szMisc.getvarcCs@y|jj|�Stk
r:}ztt|���WYdd}~XnXdS)N)r0r�r�r}r)rDrr�excr r r
r��szMisc.getintcCs@y|jj|�Stk
r:}ztt|���WYdd}~XnXdS)N)r0r�r�r}r)rDrrr�r r r
r��szMisc.getdoublecCs.y|jj|�Stk
r(td��YnXdS)zPReturn a boolean value for Tcl boolean values true and false given as parameter.z invalid literal for getboolean()N)r0r�r�r})rDrrr r r
r��szMisc.getbooleancCs|jjd|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.rcN)r0r�r�)rDr r r
� focus_set�szMisc.focus_setcCs|jjdd|j�dS)ztDirect input focus to this widget even if the
application does not have the focus. Use with
caution!rcz-forceN)r0r�r�)rDr r r
�focus_force�szMisc.focus_forcecCs(|jjd�}|dks|rdS|j|�S)z�Return the widget which has currently the focus in the
application.
Use focus_displayof to allow working with several
displays. Return None if application does not have
the focus.rc�noneN)r0r��
_nametowidget)rDrCr r r
� focus_get�szMisc.focus_getcCs.|jjdd|j�}|dks |r$dS|j|�S)z�Return the widget which has currently the focus on the
display where this widget is located.
Return None if the application does not have the focus.rcz
-displayofr�N)r0r�r�r�)rDrCr r r
�focus_displayof�szMisc.focus_displayofcCs.|jjdd|j�}|dks |r$dS|j|�S)zyReturn the widget which would have the focus if top level
for this widget gets the focus from the window manager.rcz-lastforr�N)r0r�r�r�)rDrCr r r
�
focus_lastfor�szMisc.focus_lastforcCs|jjd�dS)zXThe widget under mouse will get automatically focus. Can not
be disabled easily.�tk_focusFollowsMouseN)r0r�)rDr r r
r��szMisc.tk_focusFollowsMousecCs"|jjd|j�}|sdS|j|�S)anReturn the next widget in the focus order which follows
widget which has currently the focus.
The focus order first goes to the next child, then to
the children of the child recursively and then to the
next sibling which is higher in the stacking order. A
widget is omitted if it has the takefocus resource set
to 0.�tk_focusNextN)r0r�r�r�)rDrCr r r
r��s zMisc.tk_focusNextcCs"|jjd|j�}|sdS|j|�S)zHReturn previous widget in the focus order. See tk_focusNext for details.�tk_focusPrevN)r0r�r�r�)rDrCr r r
r��szMisc.tk_focusPrevcsN�s�jjd|�dS����fdd�}�j|_�j|���jjd|��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���Wdy�j��Wntk
r0YnXXdS)N)r�r�r )r��funcrCrDr r
�callit�szMisc.after.<locals>.callit)r0r�rFr�)rDZmsr�r�r�r )r�r�rCrDr
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�)rDr�r�r r r
�
after_idle�szMisc.after_idlecCsd|std��y.|jjdd|�}|jj|�d}|j|�Wntk
rNYnX|jjdd|�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)r}r0r�r,r�r�)rDr��dataZscriptr r r
�after_cancel�szMisc.after_cancelrcCs|jjd|j|��dS)zRing a display's bell.�bellN)r�)r0r��
_displayof)rD� displayofr r r
r�
sz Misc.bellcKsbd|krL|jdkrLyd|d<|jjd|j|��Stk
rJ|d=YnX|jjd|j|��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�)r�r�)r�r�)�_windowingsystemr0r��_optionsr�)rDr�r r r
�
clipboard_getszMisc.clipboard_getcKs,d|kr|j|d<|jjd|j|��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�r�)r�r0r�r�)rDr�r r r
�clipboard_clear)s
zMisc.clipboard_clearcKs4d|kr|j|d<|jjd|j|�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�rpz--N)r�rp)r�r0r�r�)rD�stringr�r r r
�clipboard_append0s
zMisc.clipboard_appendcCs$|jjdd|j�}|sdS|j|�S)zOReturn widget which has currently the grab in this application
or None.�grabZcurrentN)r0r�r�r�)rDrCr r r
�grab_current:szMisc.grab_currentcCs|jjdd|j�dS)z.Release grab for this widget if currently set.r��releaseN)r0r�r�)rDr r r
�grab_release@szMisc.grab_releasecCs|jjdd|j�dS)zwSet grab for this widget.
A grab directs all events to this and descendant
widgets in the application.r�r�N)r0r�r�)rDr r r
�grab_setCsz
Misc.grab_setcCs|jjddd|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-globalN)r0r�r�)rDr r r
�grab_set_globalIszMisc.grab_set_globalcCs"|jjdd|j�}|dkrd}|S)zYReturn None, "local" or "global" if this widget has
no, a local or a global grab.r��statusr�N)r0r�r�)rDr�r r r
�grab_statusPszMisc.grab_statuscCs|jjdd|||�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�N)r0r�)rD�patternr�priorityr r r
�
option_addVszMisc.option_addcCs|jjdd�dS)zPClear the option database.
It will be reloaded if option_add is called.r�r�N)r0r�)rDr r r
�option_clear]szMisc.option_clearcCs|jjdd|j||�S)z�Return the value for an option NAME for this widget
with CLASSNAME.
Values with higher priority override lower values.r�r�)r0r�r�)rDrC� classNamer r r
�
option_getbszMisc.option_getcCs|jjdd||�dS)zvRead file FILENAME into the option database.
An optional second parameter gives the numeric
priority.r�ZreadfileN)r0r�)rDZfileNamer�r r r
�option_readfilehszMisc.option_readfilecKs,d|kr|j|d<|jjd|j|��dS)zClear the current X selection.r�� selectionr�N)r�r�)r�r0r�r�)rDr�r r r
�selection_clearns
zMisc.selection_clearcKstd|kr|j|d<d|kr^|jdkr^yd|d<|jjd|j|��Stk
r\|d=YnX|jjd|j|��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�rr�r�r�r�)r�r�)r�r�)r�r�r0r�r�r�)rDr�r r r
�
selection_getrs
zMisc.selection_getcKs.|j|�}|jjd|j|�|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��handleN)r�r�)r�r0r�r�r�)rD�commandr�rCr r r
�selection_handle�s
zMisc.selection_handlecKs"|jjd|j|�|jf�dS)z�Become owner of X selection.
A keyword parameter selection specifies the name of
the selection (default PRIMARY).r��ownN)r�r�)r0r�r�r�)rDr�r r r
�
selection_own�szMisc.selection_owncKs:d|kr|j|d<|jjd|j|��}|s0dS|j|�S)z�Return owner of X selection.
The following keyword parameter can
be provided:
selection - name of the selection (default PRIMARY),
type - type of the selection (e.g. STRING, FILE_NAME).r�r�r�N)r�r�)r�r0r�r�r�)rDr�rCr r r
�selection_own_get�s
zMisc.selection_own_getcGs|jjd||f|�S)zDSend Tcl command CMD to different interpreter INTERP to be executed.�send)r0r�)rDZinterp�cmdr�r r r
r�sz Misc.sendcCs|jjd|j|�dS)z(Lower this widget in the stacking order.�lowerN)r0r�r�)rD� belowThisr r r
r�sz
Misc.lowercCs|jjd|j|�dS)z(Raise this widget in the stacking order.�raiseN)r0r�r�)rD� aboveThisr r r
�tkraise�szMisc.tkraisecCs(d|j|�|f}|jj|jj|��S)z*Return integer which represents atom NAME.�winfo�atom)rr)r�r0r�r�)rDrCr�r�r r r
�
winfo_atom�szMisc.winfo_atomcCs d|j|�|f}|jj|�S)z'Return name of atom with identifier ID.r�atomname)rr
)r�r0r�)rDr�r�r�r r r
�winfo_atomname�szMisc.winfo_atomnamecCs|jj|jjdd|j��S)z7Return number of cells in the colormap for this widget.rZcells)r0r�r�r�)rDr r r
�winfo_cells�szMisc.winfo_cellscCsVg}xL|jj|jjdd|j��D].}y|j|j|��Wq tk
rLYq Xq W|S)z?Return a list of all widgets which are children of this widget.r�children)r0r,r�r�rpr��KeyError)rD�result�childr r r
�winfo_children�s
zMisc.winfo_childrencCs|jjdd|j�S)z(Return window class name of this widget.r�class)r0r�r�)rDr r r
�winfo_class�szMisc.winfo_classcCs|jj|jjdd|j��S)z?Return true if at the last color request the colormap was full.rZcolormapfull)r0r�r�r�)rDr r r
�winfo_colormapfull�szMisc.winfo_colormapfullcCs4d|j|�||f}|jj|�}|s*dS|j|�S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.r�
containingN)rr)r�r0r�r�)rDZrootXZrootYr�r�rCr r r
�winfo_containing�s
zMisc.winfo_containingcCs|jj|jjdd|j��S)z$Return the number of bits per pixel.rZdepth)r0r�r�r�)rDr r r
�winfo_depth�szMisc.winfo_depthcCs|jj|jjdd|j��S)z"Return true if this widget exists.rr�)r0r�r�r�)rDr r r
�winfo_exists�szMisc.winfo_existscCs|jj|jjdd|j|��S)zWReturn the number of pixels for the given distance NUMBER
(e.g. "3c") as float.rZfpixels)r0r�r�r�)rD�numberr r r
�
winfo_fpixels�szMisc.winfo_fpixelscCs|jjdd|j�S)zFReturn geometry string for this widget in the form "widthxheight+X+Y".r�geometry)r0r�r�)rDr r r
�winfo_geometry�szMisc.winfo_geometrycCs|jj|jjdd|j��S)zReturn height of this widget.rrg)r0r�r�r�)rDr r r
�winfo_height�szMisc.winfo_heightcCst|jjdd|j�d�S)z%Return identifier ID for this widget.rr�r)rnr0r�r�)rDr r r
�winfo_id�sz
Misc.winfo_idcCs"d|j|�}|jj|jj|��S)z9Return the name of all Tcl interpreters for this display.r�interps)rr)r�r0r,r�)rDr�r�r r r
�
winfo_interps�szMisc.winfo_interpscCs|jj|jjdd|j��S)z%Return true if this widget is mapped.rZismapped)r0r�r�r�)rDr r r
�winfo_ismapped�szMisc.winfo_ismappedcCs|jjdd|j�S)z/Return the window manager name for this widget.rZmanager)r0r�r�)rDr r r
�
winfo_manager�szMisc.winfo_managercCs|jjdd|j�S)zReturn the name of this widget.rrC)r0r�r�)rDr r r
�
winfo_name�szMisc.winfo_namecCs|jjdd|j�S)z-Return the name of the parent of this widget.r�parent)r0r�r�)rDr r r
�winfo_parent�szMisc.winfo_parentcCs d|j|�|f}|jj|�S)z.Return the pathname of the widget given by ID.r�pathname)rr&)r�r0r�)rDr�r�r�r r r
�winfo_pathname�szMisc.winfo_pathnamecCs|jj|jjdd|j|��S)z'Rounded integer value of winfo_fpixels.rZpixels)r0r�r�r�)rDrr r r
�winfo_pixelsszMisc.winfo_pixelscCs|jj|jjdd|j��S)z:Return the x coordinate of the pointer on the root window.rZpointerx)r0r�r�r�)rDr r r
�winfo_pointerxszMisc.winfo_pointerxcCs|j|jjdd|j��S)zHReturn a tuple of x and y coordinates of the pointer on the root window.rZ pointerxy)�_getintsr0r�r�)rDr r r
�winfo_pointerxy
szMisc.winfo_pointerxycCs|jj|jjdd|j��S)z:Return the y coordinate of the pointer on the root window.rZpointery)r0r�r�r�)rDr r r
�winfo_pointeryszMisc.winfo_pointerycCs|jj|jjdd|j��S)z'Return requested height of this widget.rZ reqheight)r0r�r�r�)rDr r r
�winfo_reqheightszMisc.winfo_reqheightcCs|jj|jjdd|j��S)z&Return requested width of this widget.rZreqwidth)r0r�r�r�)rDr r r
�winfo_reqwidthszMisc.winfo_reqwidthcCs|j|jjdd|j|��S)zUReturn tuple of decimal values for red, green, blue for
COLOR in this widget.rZrgb)r*r0r�r�)rDZcolorr r r
� winfo_rgbszMisc.winfo_rgbcCs|jj|jjdd|j��S)zSReturn x coordinate of upper left corner of this widget on the
root window.rZrootx)r0r�r�r�)rDr r r
�winfo_rootxszMisc.winfo_rootxcCs|jj|jjdd|j��S)zSReturn y coordinate of upper left corner of this widget on the
root window.rZrooty)r0r�r�r�)rDr r r
�winfo_rooty$szMisc.winfo_rootycCs|jjdd|j�S)z&Return the screen name of this widget.r�screen)r0r�r�)rDr r r
�winfo_screen)szMisc.winfo_screencCs|jj|jjdd|j��S)zTReturn the number of the cells in the colormap of the screen
of this widget.rZscreencells)r0r�r�r�)rDr r r
�winfo_screencells,szMisc.winfo_screencellscCs|jj|jjdd|j��S)z\Return the number of bits per pixel of the root window of the
screen of this widget.rZscreendepth)r0r�r�r�)rDr r r
�winfo_screendepth1szMisc.winfo_screendepthcCs|jj|jjdd|j��S)zXReturn the number of pixels of the height of the screen of this widget
in pixel.rZscreenheight)r0r�r�r�)rDr r r
�winfo_screenheight6szMisc.winfo_screenheightcCs|jj|jjdd|j��S)zUReturn the number of pixels of the height of the screen of
this widget in mm.rZscreenmmheight)r0r�r�r�)rDr r r
�winfo_screenmmheight;szMisc.winfo_screenmmheightcCs|jj|jjdd|j��S)zTReturn the number of pixels of the width of the screen of
this widget in mm.rZ
screenmmwidth)r0r�r�r�)rDr r r
�winfo_screenmmwidth@szMisc.winfo_screenmmwidthcCs|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the default
colormodel of this screen.rZscreenvisual)r0r�r�)rDr r r
�winfo_screenvisualEszMisc.winfo_screenvisualcCs|jj|jjdd|j��S)zWReturn the number of pixels of the width of the screen of
this widget in pixel.rZscreenwidth)r0r�r�r�)rDr r r
�winfo_screenwidthJszMisc.winfo_screenwidthcCs|jjdd|j�S)zxReturn information of the X-Server of the screen of this widget in
the form "XmajorRminor vendor vendorVersion".rZserver)r0r�r�)rDr r r
�winfo_serverOszMisc.winfo_servercCs|j|jjdd|j��S)z*Return the toplevel widget of this widget.r�toplevel)r�r0r�r�)rDr r r
�winfo_toplevelSs
zMisc.winfo_toplevelcCs|jj|jjdd|j��S)zBReturn true if the widget and all its higher ancestors are mapped.rZviewable)r0r�r�r�)rDr r r
�winfo_viewableWszMisc.winfo_viewablecCs|jjdd|j�S)z�Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the
colormodel of this widget.r�visual)r0r�r�)rDr r r
�winfo_visual[szMisc.winfo_visualcCs|jjdd|j�S)z7Return the X identifier for the visual for this widget.rZvisualid)r0r�r�)rDr r r
�winfo_visualid`szMisc.winfo_visualidFcsH�jjdd�j|rdnd�}�fdd��jj|�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|]}�jj|��qSr )r0r,)rLrd)rDr r
r�ksz/Misc.winfo_visualsavailable.<locals>.<listcomp>csg|]}�j|��qSr )�_Misc__winfo_parseitem)rLrd)rDr r
r�ls)r0r�r�r,)rDrBr�r )rDr
�winfo_visualsavailablecszMisc.winfo_visualsavailablecCs$|dd�tt|j|dd���S)zInternal function.Nr)rr�_Misc__winfo_getint)rDr2r r r
Z__winfo_parseitemmszMisc.__winfo_parseitemcCs
t|d�S)zInternal function.r)rn)rDrdr r r
Z__winfo_getintpszMisc.__winfo_getintcCs|jj|jjdd|j��S)z�Return the height of the virtual root window associated with this
widget in pixels. If there is no virtual root window return the
height of the screen.rZvrootheight)r0r�r�r�)rDr r r
�winfo_vrootheightsszMisc.winfo_vrootheightcCs|jj|jjdd|j��S)z�Return the width of the virtual root window associated with this
widget in pixel. If there is no virtual root window return the
width of the screen.rZ
vrootwidth)r0r�r�r�)rDr r r
�winfo_vrootwidthyszMisc.winfo_vrootwidthcCs|jj|jjdd|j��S)ziReturn the x offset of the virtual root relative to the root
window of the screen of this widget.rZvrootx)r0r�r�r�)rDr r r
�winfo_vrootxszMisc.winfo_vrootxcCs|jj|jjdd|j��S)ziReturn the y offset of the virtual root relative to the root
window of the screen of this widget.rZvrooty)r0r�r�r�)rDr r r
�winfo_vrooty�szMisc.winfo_vrootycCs|jj|jjdd|j��S)z Return the width of this widget.rrf)r0r�r�r�)rDr r r
�winfo_width�szMisc.winfo_widthcCs|jj|jjdd|j��S)zVReturn the x coordinate of the upper left corner of this widget
in the parent.rrd)r0r�r�r�)rDr r r
�winfo_x�szMisc.winfo_xcCs|jj|jjdd|j��S)zVReturn the y coordinate of the upper left corner of this widget
in the parent.rre)r0r�r�r�)rDr r r
�winfo_y�szMisc.winfo_ycCs|jjd�dS)zEEnter event loop until all pending events have been processed by Tcl.rN)r0r�)rDr r r
r�szMisc.updatecCs|jjdd�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.rZ idletasksN)r0r�)rDr r r
�update_idletasks�szMisc.update_idletaskscCs6|dkr |jj|jjd|j��S|jjd|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)r0r,r�r�)rDZtagListr r r
rN�sz
Misc.bindtagsrcCs�t|t�r |jj|||f�nn|rd|j||j|�}d|r>dp@d||jf}|jj|||f�|S|rz|jj||f�S|jj|jj|��SdS)zInternal function.z"%sif {"[%s %s]" == "break"} break
�+rhN)rrr0r�r��_substitute�_subst_format_strr,)rD�what�sequencer�r��needcleanup�funcidrr r r
�_bind�s
z
Misc._bindcCs|jd|jf|||�S)aOBind to this widget at event SEQUENCE a call to function FUNC.
SEQUENCE is a string of concatenated event
patterns. An event pattern is of the form
<MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
B3, Alt, Button4, B4, Double, Button5, B5 Triple,
Mod1, M1. TYPE is one of Activate, Enter, Map,
ButtonPress, Button, Expose, Motion, ButtonRelease
FocusIn, MouseWheel, Circulate, FocusOut, Property,
Colormap, Gravity Reparent, Configure, KeyPress, Key,
Unmap, Deactivate, KeyRelease Visibility, Destroy,
Leave and DETAIL is the button number for ButtonPress,
ButtonRelease and DETAIL is the Keysym for KeyPress and
KeyRelease. Examples are
<Control-Button-1> for pressing Control and mouse button 1 or
<Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
An event pattern can also be a virtual event of the form
<<AString>> where AString can be arbitrary. This
event can be generated by event_generate.
If events are concatenated they must appear shortly
after each other.
FUNC will be called if the event sequence occurs with an
instance of Event as argument. If the return value of FUNC is
"break" no further bound function is invoked.
An additional boolean parameter ADD specifies whether FUNC will
be called additionally to the other bound function or whether
it will replace the previous function.
Bind will return an identifier to allow deletion of the bound function with
unbind without memory leak.
If FUNC or SEQUENCE is omitted the bound function or list
of bound events are returned.�bind)rVr�)rDrSr�r�r r r
rW�s'z Misc.bindcCs&|jjd|j|d�|r"|j|�dS)zWUnbind for this widget for event SEQUENCE the
function identified with FUNCID.rWrhN)r0r�r�r�)rDrSrUr r r
�unbind�szMisc.unbindcCs|jd|||d�S)aBind to all widgets at an event SEQUENCE a call to function FUNC.
An additional boolean parameter ADD specifies whether FUNC will
be called additionally to the other bound function or whether
it will replace the previous function. See bind for the return value.rW�allr)rWrY)rV)rDrSr�r�r r r
�bind_all�sz
Misc.bind_allcCs|jjdd|d�dS)z8Unbind for all widgets for event SEQUENCE all functions.rWrYrhN)r0r�)rDrSr r r
�
unbind_all�szMisc.unbind_allcCs|jd|f|||d�S)a=Bind to widgets with bindtag CLASSNAME at event
SEQUENCE a call of function FUNC. An additional
boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or
whether it will replace the previous function. See bind for
the return value.rWr)rV)rDr�rSr�r�r r r
�
bind_class�s zMisc.bind_classcCs|jjd||d�dS)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE
all functions.rWrhN)r0r�)rDr�rSr r r
�unbind_class�szMisc.unbind_classcCs|jj|�dS)zCall the mainloop of Tk.N)r0r�)rDrtr r r
r�sz
Misc.mainloopcCs|jj�dS)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r0�quit)rDr r r
r^sz Misc.quitcCs"|rtt|jj|jj|���SdS)zInternal function.N)rrr0r�r,)rDr�r r r
r*sz
Misc._getintscCs"|rtt|jj|jj|���SdS)zInternal function.N)rrr0r�r,)rDr�r r r
�_getdoublesszMisc._getdoublescCs|r|jj|�SdS)zInternal function.N)r0r�)rDr�r r r
�_getbooleanszMisc._getbooleancCs"|rd|fS|dkrd|jfSfS)zInternal function.z
-displayofN)r�)rDr�r r r
r�s
zMisc._displayofcCs<y
|j�jStk
r6|jjdd�}|j�_|SXdS)zInternal function.r0ZwindowingsystemN)r�Z_windowingsystem_cachedr r0r�)rDZwsr r r
r�s
zMisc._windowingsystemcCs�|rt||f�}nt|�}f}x�|j�D]�\}}|dk r(|ddkrP|dd�}t|�rd|j|�}n`t|ttf�r�g}xL|D]:}t|t�r�|jt |��q|t|t �r�|jt
|��q|Pq|Wdj|�}|d||f}q(W|S)zInternal function.Nr�_rr+���rb)r)r#�callabler�rrrrnrprrr)rDr$r�rr'r(Znvrr r r
r�#s*
z
Misc._optionscCsPt|�jd�}|}|ds.|j�}|dd�}x|D]}|s>P|j|}q4W|S)zPReturn the Tkinter instance of a widget identified by
its Tcl name NAME.�.rrN)r�splitr�r
)rDrC�wrtr r r
�nametowidget<s
zMisc.nametowidgetcCs�t|||�j}tt|��}y
|j}Wntk
r8YnXy||j}Wntk
r\YnX|jj||�|r�|j dkr�g|_ |j 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�rlr�r�r rFr0r�r�rp)rDr��substrTr�rCr r r
r�Ms
zMisc._registercCs|}x|jr|j}qW|S)zInternal function.)r�)rDrfr r r
r�cs
z
Misc._root�%#�%b�%f�%h�%k�%s�%t�%w�%x�%y�%A�%E�%K�%N�%W�%T�%X�%Y�%Drc,s�t|�t|j�kr|S|jj}|jj��fdd�}|\}}}}}} }
}}}
}}}}}}}}}t�}�|�|_||�|_y||�|_Wnt k
r�YnX||�|_
||�|_|| �|_||
�|_
||�|_||�|_||
�|_||_y||�|_Wnt k
�r
YnX||_||�|_yt|�|_Wntk
�rF||_YnXy|j|�|_Wntk
�rt||_YnX||�|_||�|_y�|�|_Wn tt fk
�r�d|_YnX|fS)zInternal function.cs&y�|�Sttfk
r |SXdS)z?Tk changed behavior in 8.4.2, returning "??" rather more often.N)r}r�)rr)r�r r
�getint_eventrsz&Misc._substitute.<locals>.getint_eventr)r�
_subst_formatr0r�r�rK�serialrbrcr�rgrarPZtimerfrdrerNrOr`Z
keysym_numr6rr}r��widgetrZx_rootZy_rootr_)rDr�r�r|Znsign�br��hr'rrr2rfrdre�A�E�K�N�W�T�X�Y�D�er )r�r
rPlsT*
zMisc._substitutecCs(tj�\}}}|j�}|j|||�dS)zInternal function.N)�sys�exc_infor��report_callback_exception)rDr��val�tb�rootr r r
�_report_exception�szMisc._report_exceptioncGs`i}xV|jj|jj|��D]>}|jj|�}|ddd�f|dd�||ddd�<qW|S)z;Call Tcl configure command and return the result as a dict.rrN)r0r,r�)rDr�r$rdr r r
�
_getconfigure�s
2zMisc._getconfigurecGs2|jj|jj|��}|ddd�f|dd�S)Nrr)r0r,r�)rDr�rdr r r
�_getconfigure1�szMisc._getconfigure1cCs�|rt||f�}n|rt|�}|dkr:|jt|j|f��St|t�r^|jt|j|d|f��S|jjt|j|f�|j |��dS)zInternal function.Nr+)
r)r�rr�rrr�r0r�r�)rDrr$r�r r r
�
_configure�s
zMisc._configurecKs|jd||�S)z�Configure resources of a widget.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method keys.
� configure)r�)rDr$r�r r r
r��szMisc.configurecCs|jj|jdd|�S)z4Return the resource value for a KEY given as string.�cgetr+)r0r�r�)rDr4r r r
r��sz Misc.cgetcCs|j||i�dS)N)r�)rDr4rr r r
�__setitem__�szMisc.__setitem__cs*|jj��fdd��|jj|jd��D�S)z3Return a list of all resource names of this widget.cs g|]}�|�ddd��qS)rrNr )rLrd)r,r r
r��szMisc.keys.<locals>.<listcomp>r�)r0r,r�r�)rDr )r,r
ru�s
z Misc.keyscCs|jS)z+Return the window path name of this widget.)r�)rDr r r
rE�szMisc.__str__cCsd|jj|jj|jfS)Nz<%s.%s object %s>)r�rGrHr�)rDr r r
rv�sz
Misc.__repr__�_noarg_cCs:|tjkr"|j|jjdd|j��S|jjdd|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`r0r�r�)rD�flagr r r
�pack_propagate�s
zMisc.pack_propagatecs(�fdd��jj�jjdd�j��D�S)zHReturn a list of all slaves of this widget
in its packing order.csg|]}�j|��qSr )r�)rLrd)rDr r
r��sz$Misc.pack_slaves.<locals>.<listcomp>r��slaves)r0r,r�r�)rDr )rDr
�pack_slaves�s
zMisc.pack_slavescs(�fdd��jj�jjdd�j��D�S)zHReturn a list of all slaves of this widget
in its packing order.csg|]}�j|��qSr )r�)rLrd)rDr r
r��sz%Misc.place_slaves.<locals>.<listcomp>�placer�)r0r,r�r�)rDr )rDr
�place_slaves�s
zMisc.place_slavescCs|jjdd|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�anchorN)r0r�r�)rDr�r r r
�grid_anchorszMisc.grid_anchorcCsZdd|jf}|dk r(|dk r(|||f}|dk rD|dk rD|||f}|j|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�r*r0r�)rD�column�rowZcol2Zrow2r�r r r
� grid_bboxszMisc.grid_bboxcCsbt|ttjf�r^y4t|�}|s"dSd|kr6|jj|�S|jj|�SWnttfk
r\YnX|S)Nrd) rr�_tkinterZTcl_Objr0r�r�r}r�)rDrZsvaluer r r
�_gridconvvalueszMisc._gridconvvaluecCs�t|t�rL|rL|dd�dkr,|dd�}|dd�dkrDd|}|f}n|j||�}|s~t|j|jjd||j|�|jd�S|jjd||j|f|�}t|�dkr�|j|�SdS) zInternal function.rNrar+r�)r1rbrb) rrr�r5r0r�r�r�r)rDr��indexr$r��optionsrr r r
�_grid_configure*s"
zMisc._grid_configurecKs|jd|||�S)z�Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column),
weight (how much does additional space propagate to this column)
and pad (how much space to let additionally).�columnconfigure)r�)rDr�r$r�r r r
�grid_columnconfigure?szMisc.grid_columnconfigurecCs |j|jjdd|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��locationN)r*r0r�r�)rDrdrer r r
�
grid_locationGszMisc.grid_locationcCs:|tjkr"|j|jjdd|j��S|jjdd|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�N)r�r�r`r0r�r�)rDr�r r r
�grid_propagateNs
zMisc.grid_propagatecKs|jd|||�S)z�Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row),
weight (how much does additional space propagate to this row)
and pad (how much space to let additionally).�rowconfigure)r�)rDr�r$r�r r r
�grid_rowconfigureZszMisc.grid_rowconfigurecCs|j|jjdd|j��pdS)z<Return a tuple of the number of column and rows in the grid.r��sizeN)r*r0r�r�)rDr r r
� grid_sizebszMisc.grid_sizecsZf}|dk r|d|f}|dk r,|d|f}�fdd��jj�jjdd�jf|��D�S)zHReturn a list of all slaves of this widget
in its packing order.Nz-rowz-columncsg|]}�j|��qSr )r�)rLrd)rDr r
r�osz$Misc.grid_slaves.<locals>.<listcomp>r�r�)r0r,r�r�)rDr�r�r�r )rDr
�grid_slavesgs
zMisc.grid_slavescGsdd|f|}|jj|�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�N)r0r�)rD�virtual� sequencesr�r r r
� event_addvszMisc.event_addcGsdd|f|}|jj|�dS)z-Unbind a virtual event VIRTUAL from SEQUENCE.r��deleteN)r0r�)rDr�r�r�r r r
�event_delete}szMisc.event_deletecKsHdd|j|f}x(|j�D]\}}|d|t|�f}qW|jj|�dS)z�Generate an event SEQUENCE. Additional
keyword arguments specify parameter of the event
(e.g. x, y, rootx, rooty).r�Zgeneratez-%sN)r�r#rr0r�)rDrSr�r�r'r(r r r
�event_generate�szMisc.event_generatecCs|jj|jjdd|��S)zuReturn a list of all virtual events or the information
about the SEQUENCE bound to the virtual event VIRTUAL.r�r�)r0r,r�)rDr�r r r
�
event_info�szMisc.event_infocCs|jj|jjdd��S)z*Return a list of all existing image names.�image�names)r0r,r�)rDr r r
�image_names�szMisc.image_namescCs|jj|jjdd��S)z?Return a list of all available image types (e.g. photo bitmap).r��types)r0r,r�)rDr r r
�image_types�szMisc.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)rirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{)N)N)NNNN)NN)N)�rFrGrHrw�_last_child_idsr�r�r�r�r�r�r�Zwaitvarr�r�r�r�r�r�r�r�rcr�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�rrr�liftr rrrrrrrrrrrrr r!r"r#r%r'r(r)r+r,r-r.r/r0r1r3r4r5r6r7r8r9r:r;r=r>r@rArDrCrErFrGrHrIrJrKrLrrMrNrVrWrXrZr[r\r]r�r^r*r_r`r��propertyr�r�rgr�r��registerr�r}rrQrPr�r�r�r�r��configr��__getitem__r�rurErvr�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�>sR
(
< 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�rhr)rDr�rhrr r r
r��szCallWrapper.__init__cGsJy|jr|j|�}|j|�Stk
r0�Yn|jj�YnXdS)z3Apply first function SUBST to arguments, than FUNC.N)rhr�r~rr�)rDr�r r r
r��s
zCallWrapper.__call__N)rFrGrHrwr�r�r r r r
r��sr�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$|j|�SdS)z5Query and change the horizontal position of the view.�xviewN)r0r�r�r_)rDr�rr r r
r��szXView.xviewcCs|jj|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��movetoN)r0r�r�)rD�fractionr r r
�xview_moveto�szXView.xview_movetocCs|jj|jdd||�dS)z\Shift the x-view according to NUMBER which is measured in "units"
or "pages" (WHAT).r��scrollN)r0r�r�)rDrrRr r r
�xview_scroll�szXView.xview_scrollN)rFrGrHrwr�r�r�r r r r
r��sr�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$|j|�SdS)z3Query and change the vertical position of the view.�yviewN)r0r�r�r_)rDr�rr r r
r��szYView.yviewcCs|jj|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�N)r0r�r�)rDr�r r r
�yview_moveto�szYView.yview_movetocCs|jj|jdd||�dS)z\Shift the y-view according to NUMBER which is measured in
"units" or "pages" (WHAT).r�r�N)r0r�r�)rDrrRr r r
�yview_scroll�szYView.yview_scrollN)rFrGrHrwr�r�r�r r r r
r��sr�c@s�eZdZdZdBdd�ZeZdd�ZeZdCdd�ZeZ d d
�Z
e
ZdDdd�ZeZ
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.Nc Cs |j|jjdd|j||||��S)z�Instruct the window manager to set the aspect ratio (width/height)
of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
of the actual values if no argument is given.�wm�aspect)r*r0r�r�)rDZminNumerZminDenomZmaxNumerZmaxDenomr r r
� wm_aspect�szWm.wm_aspectcGsdd|jf|}|jj|�S)a�This subcommand returns or sets platform specific attributes
The first form returns a list of the platform specific flags and
their values. The second form returns the value for the specific
option. The third form sets one or more of the values. The values
are as follows:
On Windows, -disabled gets or sets whether the window is in a
disabled state. -toolwindow gets or sets the style of the window
to toolwindow (as defined in the MSDN). -topmost gets or sets
whether this is a topmost window (displays above all other
windows).
On Macintosh, XXXXX
On Unix, there are currently no special attribute values.
r��
attributes)r�r0r�)rDr�r r r
�
wm_attributes�szWm.wm_attributescCs|jjdd|j|�S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return
current value.r��client)r0r�r�)rDrCr r r
� wm_client�szWm.wm_clientcsZt|�dkr|f}dd�jf|}|r4�jj|�n"�fdd��jj�jj|��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|]}�j|��qSr )r�)rLrd)rDr r
r�sz)Wm.wm_colormapwindows.<locals>.<listcomp>N)rr�r0r�r,)rDZwlistr�r )rDr
�wm_colormapwindowss
zWm.wm_colormapwindowscCs|jjdd|j|�S)z�Store VALUE in WM_COMMAND property. It is the command
which shall be used to invoke the application. Return current
command if VALUE is None.r�r�)r0r�r�)rDrr r r
�
wm_commandsz
Wm.wm_commandcCs|jjdd|j�S)z�Deiconify this widget. If it was never mapped it will not be mapped.
On Windows it will raise this widget and give it the focus.r�� deiconify)r0r�r�)rDr r r
�wm_deiconifyszWm.wm_deiconifycCs|jjdd|j|�S)z�Set focus model to MODEL. "active" means that this widget will claim
the focus itself, "passive" means that the window manager shall give
the focus. Return current focus model if MODEL is None.r��
focusmodel)r0r�r�)rDZmodelr r r
�
wm_focusmodelszWm.wm_focusmodelcCs|jjdd|�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��forgetN)r0r�)rDr�r r r
� wm_forget"szWm.wm_forgetcCs|jjdd|j�S)zAReturn identifier for decorative frame of this widget if present.r��frame)r0r�r�)rDr r r
�wm_frame*szWm.wm_framecCs|jjdd|j|�S)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
current value if None is given.r�r)r0r�r�)rDZnewGeometryr r r
�wm_geometry.szWm.wm_geometryc Cs |j|jjdd|j||||��S)aInstruct the window manager that this widget shall only be
resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
number of grid units requested in Tk_GeometryRequest.r�r�)r*r0r�r�)rDZ baseWidthZ
baseHeightZwidthIncZ heightIncr r r
�wm_grid3s
z
Wm.wm_gridcCs|jjdd|j|�S)z~Set the group leader widgets for related widgets to PATHNAME. Return
the group leader of this widget if None is given.r��group)r0r�r�)rD�pathNamer r r
�wm_group>szWm.wm_groupcCs2|r|jjdd|jd|�S|jjdd|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��
iconbitmapz-defaultN)r0r�r�)rD�bitmap�defaultr r r
�
wm_iconbitmapCs zWm.wm_iconbitmapcCs|jjdd|j�S)zDisplay widget as icon.r��iconify)r0r�r�)rDr r r
�
wm_iconifyQsz
Wm.wm_iconifycCs|jjdd|j|�S)zVSet mask for the icon bitmap of this widget. Return the
mask if None is given.r��iconmask)r0r�r�)rDr�r r r
�wm_iconmaskUszWm.wm_iconmaskcCs|jjdd|j|�S)zSSet the name of the icon for this widget. Return the name if
None is given.r��iconname)r0r�r�)rDZnewNamer r r
�wm_iconnameZszWm.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�� iconphotoz-defaultN)r0r�r�)rDr�r�r r r
�wm_iconphoto_szWm.wm_iconphotocCs|j|jjdd|j||��S)z�Set the position of the icon of this widget to X and Y. Return
a tuple of the current values of X and X if None is given.r��iconposition)r*r0r�r�)rDrdrer r r
�wm_iconpositionxs
zWm.wm_iconpositioncCs|jjdd|j|�S)zgSet widget PATHNAME to be displayed instead of icon. Return the current
value if None is given.r��
iconwindow)r0r�r�)rDr�r r r
�
wm_iconwindow~szWm.wm_iconwindowcCs|jjdd|�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��manageN)r0r�)rDrr r r
� wm_manage�szWm.wm_managecCs|j|jjdd|j||��S)z�Set max WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given.r��maxsize)r*r0r�r�)rDrfrgr r r
�
wm_maxsize�s
z
Wm.wm_maxsizecCs|j|jjdd|j||��S)z�Set min WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given.r��minsize)r*r0r�r�)rDrfrgr r r
�
wm_minsize�s
z
Wm.wm_minsizecCs|j|jjdd|j|��S)z�Instruct the window manager to ignore this widget
if BOOLEAN is given with 1. Return the current value if None
is given.r��overrideredirect)r`r0r�r�)rDr�r r r
�wm_overrideredirect�s
zWm.wm_overrideredirectcCs|jjdd|j|�S)z�Instruct the window manager that the position of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program".r��positionfrom)r0r�r�)rD�whor r r
�wm_positionfrom�szWm.wm_positionfromcCs.t|�r|j|�}n|}|jjdd|j||�S)z�Bind function FUNC to command NAME for this widget.
Return the function bound to NAME if None is given. NAME could be
e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".r��protocol)rcr�r0r�r�)rDrCr�r�r r r
�wm_protocol�s
zWm.wm_protocolcCs|jjdd|j||�S)zyInstruct the window manager whether this width can be resized
in WIDTH or HEIGHT. Both values are boolean values.r�� resizable)r0r�r�)rDrfrgr r r
�wm_resizable�szWm.wm_resizablecCs|jjdd|j|�S)z�Instruct the window manager that the size of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program".r��sizefrom)r0r�r�)rDrr r r
�wm_sizefrom�szWm.wm_sizefromcCs|jjdd|j|�S)z�Query or set the state of this widget as one of normal, icon,
iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).r�rP)r0r�r�)rDZnewstater r r
�wm_state�szWm.wm_statecCs|jjdd|j|�S)zSet the title of this widget.r��title)r0r�r�)rDr�r r r
�wm_title�szWm.wm_titlecCs|jjdd|j|�S)z_Instruct the window manager that this widget is transient
with regard to widget MASTER.r�� transient)r0r�r�)rDr�r r r
�wm_transient�szWm.wm_transientcCs|jjdd|j�S)z�Withdraw this widget from the screen such that it is unmapped
and forgotten by the window manager. Re-draw it with wm_deiconify.r��withdraw)r0r�r�)rDr r r
�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)BrFrGrHrwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr
r rrrr
rrPrrrrrrr r r r
r��s�
r�c@sNeZdZdZdZddd�Zdd �Zd
d�Zdd
�Zdd�Z dd�Z
dd�ZdS)�TkzzToplevel widget of Tk which represents mostly the main window
of an application. It has an associated Tcl interpreter.rdNrrc
Cs�d|_i|_d|_d|_|dkrZddl}|jjtjd�}|jj |�\}}|dkrZ||}d} t
j|||| t|||�|_|r�|j
�tjjs�|j||�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.Nr�.py�.pyc)rr)r�r
� _tkloadedr0�os�path�basenamer��argv�splitextr��create�wantobjects�_loadtk�flags�ignore_environment�readprofile)
rD�
screenName�baseNamer��useTk�syncZuserZext�interactiver r r
r��s zTk.__init__cCs|js|jj�|j�dS)N)rr0�loadtkr!)rDr r r
r*�s
z Tk.loadtkcCs�d|_|jjd�}|tjkr.tdtj|f��t|jjd��}|tjkrZtdtj|f��|jdkrjg|_|jj dt
�|jj dt�|jjd�|jjd�t
r�tr�|a|jd|j�dS) Nr�
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)rr0r�r��
TK_VERSIONr-r�TCL_VERSIONr�r�r|r�rprxryr r�)rDr+r,r r r
r!�s$
z
Tk._loadtkcCsNxt|jj��D]}|j�qW|jjd|j�tj|�trJt |krJda dS)zhDestroy this and all descendants widgets. This will
end the application of this Tcl interpreter.r�N)
rr
�valuesr�r0r�r�r�rxry)rDr%r r r
r�
s
z
Tk.destroyc
Cs�ddl}d|jkr|jd}n|j}|jj|d|�}|jj|d|�}|jj|d|�}|jj|d|�}d|i} td| �|jj|�r�|jjd|�|jj|�r�tt |�j
�| �|jj|�r�|jjd|�|jj|�r�tt |�j
�| �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.pyrDzfrom tkinter import *�source)r�environ�curdirrr�exec�isfiler0r��open�read)
rDr&r�r�homeZ class_tclZclass_pyZbase_tclZbase_py�dirr r r
r$s$
zTk.readprofilecCs:ddl}tdtjd�|t_|t_|t_|j|||�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)rDr�r�r�r=r r r
r�(szTk.report_callback_exceptioncCst|j|�S)z3Delegate attribute access to the interpreter object)rmr0)rD�attrr r r
�__getattr__3szTk.__getattr__)NNrrrN)rFrGrHrwr�r�r*r!r�r$r�rDr r r r
r�s
rcCst||||�S)N)r)r%r&r�r'r r r
�TclFsrEc@sTeZdZdZifdd�ZeZZZdd�ZeZ dd�Z
e
Zej
ZZ
ejZZdS) �PackzQGeometry manager Pack.
Base class to use the methods pack_* in every widget.cKs$|jjdd|jf|j||��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)r0r�r�r�)rDr$r�r r r
�pack_configureMs
zPack.pack_configurecCs|jjdd|j�dS)z:Unmap this widget and do not use it for the packing order.r�r�N)r0r�r�)rDr r r
�pack_forgetaszPack.pack_forgetcCs8t|j|jjdd|j��}d|kr4|j|d�|d<|S)zEReturn information about the packing options
for this widget.r�r��in)r5r0r�r�rg)rD�dr r r
� pack_infoeszPack.pack_infoN)rFrGrHrwrGr�r�r�rHr�rKr�r�r�r�r�r�r r r r
rFIs
rFc@sJeZdZdZifdd�ZeZZZdd�ZeZ dd�Z
e
Zej
ZZ
dS) �PlacezSGeometry manager Place.
Base class to use the methods place_* in every widget.cKs$|jjdd|jf|j||��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�N)r0r�r�r�)rDr$r�r r r
�place_configurets
zPlace.place_configurecCs|jjdd|j�dS)zUnmap this widget.r�r�N)r0r�r�)rDr r r
�place_forget�szPlace.place_forgetcCs8t|j|jjdd|j��}d|kr4|j|d�|d<|S)zEReturn information about the placing options
for this widget.r�r�rI)r5r0r�r�rg)rDrJr r r
�
place_info�szPlace.place_infoN)rFrGrHrwrMr�r�r�rNr�rOr�r�r�r�r r r r
rLpsrLc@s�eZdZdZifdd�ZeZZZej Z
Z ejZZdd�Z
e
Zdd�Zdd �ZeZejZZejZZejZZejZZejZZd
S)�GridzQGeometry manager Grid.
Base class to use the methods grid_* in every widget.cKs$|jjdd|jf|j||��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�N)r0r�r�r�)rDr$r�r r r
�grid_configure�s
zGrid.grid_configurecCs|jjdd|j�dS)zUnmap this widget.r�r�N)r0r�r�)rDr r r
�grid_forget�szGrid.grid_forgetcCs|jjdd|j�dS)z0Unmap this widget but remember the grid options.r�r�N)r0r�r�)rDr r r
�grid_remove�szGrid.grid_removecCs8t|j|jjdd|j��}d|kr4|j|d�|d<|S)zSReturn information about the options
for positioning this widget in a grid.r�r�rI)r5r0r�r�rg)rDrJr r r
� grid_info�szGrid.grid_infoN)rFrGrHrwrQr�r�r�r�r�r�r�r�rRr�rSrTr�r�r�r�r�r�r�r�r�r�r�r r r r
rP�s
rPc@s<eZdZdZdd�Ziiffdd�Zdd�Zffdd �Zd
S)�
BaseWidgetzInternal class.cCs�tr|stst�at}||_|j|_d}d|kr>|d}|d=|s�|jjj�}|jdkr^i|_|jj |d�d}||j|<|dkr�d|f}nd||f}||_
|jdkr�d||_n|jd||_i|_|j
|jjkr�|jj|j
j
�||jj|j
<dS)z6Internal function. Sets up information about children.NrCrrz!%sz!%s%drd)rxryrr�r0r�rFrr�r�r�r�r
r�)rDr�r$rC�countr r r
�_setup�s8
zBaseWidget._setupc Cs�|rt||f�}||_tj|||�|jdkr4g|_dd�|j�D�}x|D]\}}||=qLW|jj||jf||j |��x|D]\}}|j
||�q�WdS)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME
and appropriate options.NcSs"g|]\}}t|t�r||f�qSr )rr)rLr'r(r r r
r��sz'BaseWidget.__init__.<locals>.<listcomp>)r)�
widgetNamerUrWr�r#r0r�r�r�r�) rDr�rXr$r��extra�classesr'r(r r r
r��s
zBaseWidget.__init__cCsXxt|jj��D]}|j�qW|jjd|j�|j|jjkrJ|jj|j=t j|�dS)z)Destroy this and all descendants widgets.r�N)
rr
r1r�r0r�r�r�r�r�)rDr%r r r
r��szBaseWidget.destroycCs|jj|j|f|�S)N)r0r�r�)rDrCr�r r r
�_do szBaseWidget._doN)rFrGrHrwrWr�r�r[r r r r
rU�s
!rUc@seZdZdZdS)�WidgetzxInternal class.
Base class for a widget which can be positioned with the geometry managers
Pack, Place or Grid.N)rFrGrHrwr r r r
r\ sr\c@seZdZdZdifdd�ZdS)�Toplevelz"Toplevel widget, e.g. for dialogs.Nc Ks�|rt||f�}f}xTdD]L}||kr||}|d
dkrLd|d d�}nd|}|||f}||=qWtj||d
|i|�|j�}|j|j��|j|j��|jd|j�d S)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.r2�class_rr?�colormaprrar+Nr<r.)r2r^rr?r_rbrb)r)rUr�r�r�rr r�) rDr�r$r�rYZwmkeyr��optr�r r r
r� s"
zToplevel.__init__)rFrGrHrwr�r r r r
r] sr]c@s.eZdZdZdifdd�Zdd�Zdd�ZdS) rIzButton widget.NcKstj||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�)rDr�r$r�r r r
r�. szButton.__init__cCs|jj|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.
�flashN)r0r�r�)rDr r r
raC s
zButton.flashcCs|jj|jd�S)aInvoke the command associated with the button.
The return value is the return value from the command,
or an empty string if there is no command associated with
the button. This command is ignored if the button's state
is disabled.
�invoke)r0r�r�)rDr r r
rbO sz
Button.invoke)rFrGrHrwr�rarbr r r r
rI, srIc@s�eZdZdZdifdd�Zdd�Zdd�Zd d
�Zdd�Zdtd
d�Z dd�Z
dd�Zdd�Zdd�Z
dudd�Zdvdd�Zdwdd�Zdxdd�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#dydCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dzdWdX�Z.e.Z/dYdZ�Z0e0Z1d[d\�Z2ifd]d^�Z3d_d`�Z4e4Z5Z6dadb�Z7dcdd�Z8d{dfdg�Z9dhdi�Z:djdk�Z;dldm�Z<dndo�Z=dpdq�Z>drds�Z?dS)|�Canvasz?Canvas widget to display graphical elements like lines or text.NcKstj||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.ZcanvasN)r\r�)rDr�r$r�r r r
r�[ s
zCanvas.__init__cGs|jj|jdf|�dS)zInternal function.�addtagN)r0r�r�)rDr�r r r
rdf sz
Canvas.addtagcCs|j|d|�dS)z*Add tag NEWTAG to all items above TAGORID.�aboveN)rd)rD�newtag�tagOrIdr r r
�addtag_abovei szCanvas.addtag_abovecCs|j|d�dS)zAdd tag NEWTAG to all items.rYN)rd)rDrfr r r
�
addtag_alll szCanvas.addtag_allcCs|j|d|�dS)z*Add tag NEWTAG to all items below TAGORID.�belowN)rd)rDrfrgr r r
�addtag_belowo szCanvas.addtag_belowcCs|j|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.�closestN)rd)rDrfrdre�halo�startr r r
�addtag_closestr szCanvas.addtag_closestcCs|j|d||||�dS)zLAdd tag NEWTAG to all items in the rectangle defined
by X1,Y1,X2,Y2.�enclosedN)rd)rDrf�x1�y1�x2�y2r r r
�addtag_enclosedx szCanvas.addtag_enclosedcCs|j|d||||�dS)zWAdd tag NEWTAG to all items which overlap the rectangle
defined by X1,Y1,X2,Y2.�overlappingN)rd)rDrfrqrrrsrtr r r
�addtag_overlapping| szCanvas.addtag_overlappingcCs|j|d|�dS)z)Add tag NEWTAG to all items with TAGORID.�withtagN)rd)rDrfrgr r r
�addtag_withtag� szCanvas.addtag_withtagcGs |j|jj|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�N)r*r0r�r�)rDr�r r r
r�� szCanvas.bboxcCs(|jj|jd||d�|r$|j|�dS)zbUnbind for all items with TAGORID for event SEQUENCE the
function identified with FUNCID.rWrhN)r0r�r�r�)rDrgrSrUr r r
�
tag_unbind� szCanvas.tag_unbindcCs|j|jd|f|||�S)a&Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.
An additional boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or whether it will
replace the previous function. See bind for the return value.rW)rVr�)rDrgrSr�r�r r r
�tag_bind� szCanvas.tag_bindcCs|jj|jj|jd||��S)zrReturn the canvas x coordinate of pixel position SCREENX rounded
to nearest multiple of GRIDSPACING units.�canvasx)r0r�r�r�)rDZscreenx�gridspacingr r r
r|� szCanvas.canvasxcCs|jj|jj|jd||��S)zrReturn the canvas y coordinate of pixel position SCREENY rounded
to nearest multiple of GRIDSPACING units.�canvasy)r0r�r�r�)rDZscreenyr}r r r
r~� szCanvas.canvasycs,�fdd��jj�jj�jdf|��D�S)z8Return a list of coordinates for the item given in ARGS.csg|]}�jj|��qSr )r0r�)rLrd)rDr r
r�� sz!Canvas.coords.<locals>.<listcomp>�coords)r0r,r�r�)rDr�r )rDr
r� s
z
Canvas.coordscCs\t|�}|d}t|ttf�r,|dd�}ni}|jj|jj|jd|f||j||����S)zInternal function.rNrrbrb) rrrrr0r�r�r�r�)rD�itemTyper�r�r$r r r
�_create� s
zCanvas._createcOs|jd||�S)z6Create arc shaped region with coordinates x1,y1,x2,y2.Zarc)r�)rDr�r�r r r
�
create_arc� szCanvas.create_arccOs|jd||�S)z%Create bitmap with coordinates x1,y1.r�)r�)rDr�r�r r r
�
create_bitmap� szCanvas.create_bitmapcOs|jd||�S)z)Create image item with coordinates x1,y1.r�)r�)rDr�r�r r r
�create_image� szCanvas.create_imagecOs|jd||�S)z-Create line with coordinates x1,y1,...,xn,yn.�line)r�)rDr�r�r r r
�create_line� szCanvas.create_linecOs|jd||�S)z)Create oval with coordinates x1,y1,x2,y2.Zoval)r�)rDr�r�r r r
�create_oval� szCanvas.create_ovalcOs|jd||�S)z0Create polygon with coordinates x1,y1,...,xn,yn.Zpolygon)r�)rDr�r�r r r
�create_polygon� szCanvas.create_polygoncOs|jd||�S)z.Create rectangle with coordinates x1,y1,x2,y2.Z rectangle)r�)rDr�r�r r r
�create_rectangle� szCanvas.create_rectanglecOs|jd||�S)z#Create text with coordinates x1,y1.�text)r�)rDr�r�r r r
�create_text� szCanvas.create_textcOs|jd||�S)z+Create window with coordinates x1,y1,x2,y2.r�)r�)rDr�r�r r r
�
create_window� szCanvas.create_windowcGs|jj|jdf|�dS)z�Delete characters of text items identified by tag or id in ARGS (possibly
several times) from FIRST to LAST character (including).�dcharsN)r0r�r�)rDr�r r r
r�� sz
Canvas.dcharscGs|jj|jdf|�dS)z<Delete items identified by all tag or ids contained in ARGS.r�N)r0r�r�)rDr�r r r
r�� sz
Canvas.deletecGs|jj|jdf|�dS)ziDelete tag or id given as last arguments in ARGS from items
identified by first argument in ARGS.�dtagN)r0r�r�)rDr�r r r
r�� szCanvas.dtagcGs |j|jj|jdf|��pfS)zInternal function.�find)r*r0r�r�)rDr�r r r
r�� szCanvas.findcCs|jd|�S)zReturn items above TAGORID.re)r�)rDrgr r r
�
find_above� szCanvas.find_abovecCs
|jd�S)zReturn all items.rY)r�)rDr r r
�find_all� szCanvas.find_allcCs|jd|�S)zReturn all items below TAGORID.rj)r�)rDrgr r r
�
find_below� szCanvas.find_belowcCs|jd||||�S)z�Return item which is closest to pixel at X, Y.
If several match take the top-most.
All items closer than HALO are considered overlapping (all are
closest). If START is specified the next below this tag is taken.rl)r�)rDrdrermrnr r r
�find_closest� szCanvas.find_closestcCs|jd||||�S)z=Return all items in rectangle defined
by X1,Y1,X2,Y2.rp)r�)rDrqrrrsrtr r r
�
find_enclosed� szCanvas.find_enclosedcCs|jd||||�S)zLReturn all items which overlap the rectangle
defined by X1,Y1,X2,Y2.rv)r�)rDrqrrrsrtr r r
�find_overlapping� szCanvas.find_overlappingcCs|jd|�S)zReturn all items with TAGORID.rx)r�)rDrgr r r
�find_withtag� szCanvas.find_withtagcGs|jj|jdf|�S)z.Set focus to the first item specified in ARGS.rc)r0r�r�)rDr�r r r
rc� szCanvas.focuscGs|jj|jj|jdf|��S)z=Return tags associated with the first item specified in ARGS.�gettags)r0r,r�r�)rDr�r r r
r�� szCanvas.gettagscGs|jj|jdf|�dS)zdSet cursor at position POS in the item identified by TAGORID.
In ARGS TAGORID must be first.�icursorN)r0r�r�)rDr�r r r
r�� szCanvas.icursorcGs|jj|jj|jdf|��S)z?Return position of cursor as integer in item specified in ARGS.r�)r0r�r�r�)rDr�r r r
r�
szCanvas.indexcGs|jj|jdf|�dS)zSInsert TEXT in item TAGORID at position POS. ARGS must
be TAGORID POS TEXT.�insertN)r0r�r�)rDr�r r r
r�
sz
Canvas.insertcCs|jj|jdf|d|f�S)z9Return the resource value for an OPTION for item TAGORID.�itemcgetr+)r0r�r�)rDrgr�r r r
r�
szCanvas.itemcgetcKs|jd|f||�S)z�Configure resources of an item TAGORID.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method without arguments.
�
itemconfigure)r�)rDrgr$r�r r r
r�
szCanvas.itemconfigurecGs|jj|jdf|�dS)zJLower an item TAGORID given in ARGS
(optional below another item).rN)r0r�r�)rDr�r r r
� tag_lower
szCanvas.tag_lowercGs|jj|jdf|�dS)z#Move an item TAGORID given in ARGS.�moveN)r0r�r�)rDr�r r r
r�
szCanvas.movecKs|jj|jdf|j||��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.�
postscript)r0r�r�r�)rDr$r�r r r
r�
szCanvas.postscriptcGs|jj|jdf|�dS)zJRaise an item TAGORID given in ARGS
(optional above another item).rN)r0r�r�)rDr�r r r
� tag_raise'
szCanvas.tag_raisecGs|jj|jdf|�dS)z9Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.�scaleN)r0r�r�)rDr�r r r
r�,
szCanvas.scalecCs|jj|jdd||�dS)z&Remember the current X, Y coordinates.�scan�markN)r0r�r�)rDrdrer r r
� scan_mark/
szCanvas.scan_mark�
cCs|jj|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��dragtoN)r0r�r�)rDrdreZgainr r r
�scan_dragto2
szCanvas.scan_dragtocCs|jj|jdd||�dS)zLAdjust the end of the selection near the cursor of an item TAGORID to index.�select�adjustN)r0r�r�)rDrgr�r r r
�
select_adjust7
szCanvas.select_adjustcCs|jj|jdd�dS)z,Clear the selection if it is in this widget.r�r�N)r0r�r�)rDr r r
�select_clear:
szCanvas.select_clearcCs|jj|jdd||�dS)z:Set the fixed end of a selection in item TAGORID to INDEX.r��fromN)r0r�r�)rDrgr�r r r
�select_from=
szCanvas.select_fromcCs|jj|jdd�pdS)z(Return the item which has the selection.r�rN)r0r�r�)rDr r r
�select_item@
szCanvas.select_itemcCs|jj|jdd||�dS)z=Set the variable end of a selection in item TAGORID to INDEX.r��toN)r0r�r�)rDrgr�r r r
� select_toC
szCanvas.select_tocCs|jj|jd|�pdS)z$Return the type of the item TAGORID.rN)r0r�r�)rDrgr r r
rF
szCanvas.type)NN)N)NNN)N)N)NN)N)r�)@rFrGrHrwr�rdrhrirkrorurwryr�rzr{r|r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rcr�r�r�r�r�r��
itemconfigr�rr�r�r�r�rr�r�r�r�r�r�r�r�rr r r r
rcY sx
rcc@sFeZdZdZdifdd�Zdd�Zdd�Zd d
�Zdd�Zd
d�Z dS)�Checkbuttonz7Checkbutton widget which is either in on- or off-state.NcKstj||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.�checkbuttonN)r\r�)rDr�r$r�r r r
r�L
s
zCheckbutton.__init__cCs|jj|jd�dS)zPut the button in off-state.�deselectN)r0r�r�)rDr r r
r�W
szCheckbutton.deselectcCs|jj|jd�dS)zFlash the button.raN)r0r�r�)rDr r r
raZ
szCheckbutton.flashcCs|jj|jd�S)z<Toggle the button and invoke a command if given as resource.rb)r0r�r�)rDr r r
rb]
szCheckbutton.invokecCs|jj|jd�dS)zPut the button in on-state.r�N)r0r�r�)rDr r r
r�`
szCheckbutton.selectcCs|jj|jd�dS)zToggle the button.�toggleN)r0r�r�)rDr r r
r�c
szCheckbutton.toggle)
rFrGrHrwr�r�rarbr�r�r r r r
r�J
sr�c@s�eZdZdZdifdd�Zddd�Zdd�Zd d
�Zdd�Zd
d�Z dd�Z
dd�Zdd�ZeZ
dd�ZeZdd�ZeZdd�ZeZdd�ZeZdd�ZeZdS) �Entryz1Entry widget which allows displaying simple text.NcKstj||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.�entryN)r\r�)rDr�r$r�r r r
r�i
szEntry.__init__cCs|jj|jd||�dS)z.Delete text from FIRST to LAST (not included).r�N)r0r�r�)rD�first�lastr r r
r�u
szEntry.deletecCs|jj|jd�S)zReturn the text.r�)r0r�r�)rDr r r
r�x
sz Entry.getcCs|jj|jd|�dS)zInsert cursor at INDEX.r�N)r0r�r�)rDr�r r r
r�{
sz
Entry.icursorcCs|jj|jj|jd|��S)zReturn position of cursor.r�)r0r�r�r�)rDr�r r r
r�~
szEntry.indexcCs|jj|jd||�dS)zInsert STRING at INDEX.r�N)r0r�r�)rDr�r�r r r
r��
szEntry.insertcCs|jj|jdd|�dS)z&Remember the current X, Y coordinates.r�r�N)r0r�r�)rDrdr r r
r��
szEntry.scan_markcCs|jj|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�N)r0r�r�)rDrdr r r
r��
szEntry.scan_dragtocCs|jj|jdd|�dS)z9Adjust the end of the selection near the cursor to INDEX.r�r�N)r0r�r�)rDr�r r r
�selection_adjust�
szEntry.selection_adjustcCs|jj|jdd�dS)z,Clear the selection if it is in this widget.r�r�N)r0r�r�)rDr r r
r��
szEntry.selection_clearcCs|jj|jdd|�dS)z*Set the fixed end of a selection to INDEX.r�r�N)r0r�r�)rDr�r r r
�selection_from�
szEntry.selection_fromcCs|jj|jj|jdd��S)zSReturn True if there are characters selected in the entry, False
otherwise.r�Zpresent)r0r�r�r�)rDr r r
�selection_present�
szEntry.selection_presentcCs|jj|jdd||�dS)z3Set the selection from START to END (not included).r��rangeN)r0r�r�)rDrn�endr r r
�selection_range�
szEntry.selection_rangecCs|jj|jdd|�dS)z-Set the variable end of a selection to INDEX.r�r�N)r0r�r�)rDr�r r r
�selection_to�
szEntry.selection_to)N)rFrGrHrwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zselect_presentr�Zselect_ranger�r�r r r r
r�g
s*
r�c@seZdZdZdifdd�ZdS)�FramezFFrame widget which may contain other widgets and can have a 3D border.NcKs^t||f�}f}d|kr,d|df}|d=nd|krFd|df}|d=tj||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.r^z-classrr�N)r)r\r�)rDr�r$r�rYr r r
r��
szFrame.__init__)rFrGrHrwr�r r r r
r��
sr�c@seZdZdZdifdd�ZdS)�Labelz0Label widget which can display text and bitmaps.NcKstj||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
�labelN)r\r�)rDr�r$r�r r r
r��
szLabel.__init__)rFrGrHrwr�r r r r
r��
sr�c@s�eZdZdZdifdd�Zdd�Zdd�Zd d
�Zd)dd�Zd*d
d�Z dd�Z
dd�Zdd�Zdd�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.NcKstj||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.ZlistboxN)r\r�)rDr�r$r�r r r
r��
szListbox.__init__cCs|jj|jd|�dS)z"Activate item identified by INDEX.�activateN)r0r�r�)rDr�r r r
r��
szListbox.activatecCs|j|jj|jd|��pdS)zxReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
which encloses the item identified by the given index.r�N)r*r0r�r�)rDr�r r r
r��
szListbox.bboxcCs|j|jj|jd��pfS)z.Return the indices of currently selected item.�curselection)r*r0r�r�)rDr r r
r��
szListbox.curselectioncCs|jj|jd||�dS)z+Delete items from FIRST to LAST (included).r�N)r0r�r�)rDr�r�r r r
r��
szListbox.deletecCs:|dk r$|jj|jj|jd||��S|jj|jd|�SdS)z0Get list of items from FIRST to LAST (included).Nr�)r0r,r�r�)rDr�r�r r r
r��
szListbox.getcCs*|jj|jd|�}|dkrdS|jj|�S)z+Return index of item identified with INDEX.r�r�N)r0r�r�r�)rDr�rsr r r
r��
sz
Listbox.indexcGs|jj|jd|f|�dS)zInsert ELEMENTS at INDEX.r�N)r0r�r�)rDr��elementsr r r
r��
szListbox.insertcCs|jj|jj|jd|��S)z5Get index of item which is nearest to y coordinate Y.�nearest)r0r�r�r�)rDrer r r
r��
szListbox.nearestcCs|jj|jdd||�dS)z&Remember the current X, Y coordinates.r�r�N)r0r�r�)rDrdrer r r
r��
szListbox.scan_markcCs|jj|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�N)r0r�r�)rDrdrer r r
r��
szListbox.scan_dragtocCs|jj|jd|�dS)z"Scroll such that INDEX is visible.�seeN)r0r�r�)rDr�r r r
r�szListbox.seecCs|jj|jdd|�dS)z-Set the fixed end oft the selection to INDEX.r�r�N)r0r�r�)rDr�r r r
�selection_anchorszListbox.selection_anchorcCs|jj|jdd||�dS)z2Clear the selection from FIRST to LAST (included).r�r�N)r0r�r�)rDr�r�r r r
r�
s
zListbox.selection_clearcCs|jj|jj|jdd|��S)z+Return 1 if INDEX is part of the selection.r�Zincludes)r0r�r�r�)rDr�r r r
�selection_includesszListbox.selection_includescCs|jj|jdd||�dS)ziSet the selection from FIRST to LAST (included) without
changing the currently selected elements.r�r�N)r0r�r�)rDr�r�r r r
�
selection_setszListbox.selection_setcCs|jj|jj|jd��S)z-Return the number of elements in the listbox.r�)r0r�r�r�)rDr r r
r�szListbox.sizecCs|jj|jdf|d|f�S)z4Return the resource value for an ITEM and an OPTION.r�r+)r0r�r�)rDr�r�r r r
r�szListbox.itemcgetcKs|jd|f||�S)a9Configure resources of an ITEM.
The values for resources are specified as keyword arguments.
To get an overview about the allowed keyword arguments
call the method without arguments.
Valid resource names: background, bg, foreground, fg,
selectbackground, selectforeground.r�)r�)rDr�r$r�r r r
r� szListbox.itemconfigure)N)N)N)N)N)rFrGrHrwr�r�r�r�r�r�r�r�r�r�r�r�r�Z
select_anchorr�r�r�Zselect_includesr�Z
select_setr�r�r�r�r r r r
r��
s2
r�c@seZdZdZdifdd�Zd6dd�Zdd �Zifd
d�Zifdd
�Zifdd�Z ifdd�Z
ifdd�Zifdd�Zifdd�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.NcKstj||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.�menuN)r\r�)rDr�r$r�r r r
r�-sz
Menu.__init__rhcCs|jjd|j|||�dS)z/Post the menu at position X,Y with entry ENTRY.�tk_popupN)r0r�r�)rDrdrer�r r r
r�5sz
Menu.tk_popupcCs|jj|jd|�dS)zActivate entry at INDEX.r�N)r0r�r�)rDr�r r r
r�8sz
Menu.activatecKs$|jj|jd|f|j||��dS)zInternal function.r�N)r0r�r�r�)rDr�r$r�r r r
r�;szMenu.addcKs|jd|p|�dS)zAdd hierarchical menu item.�cascadeN)r�)rDr$r�r r r
�add_cascade?szMenu.add_cascadecKs|jd|p|�dS)zAdd checkbutton menu item.r�N)r�)rDr$r�r r r
�add_checkbuttonBszMenu.add_checkbuttoncKs|jd|p|�dS)zAdd command menu item.r�N)r�)rDr$r�r r r
�add_commandEszMenu.add_commandcKs|jd|p|�dS)zAddd radio menu item.�radiobuttonN)r�)rDr$r�r r r
�add_radiobuttonHszMenu.add_radiobuttoncKs|jd|p|�dS)zAdd separator.� separatorN)r�)rDr$r�r r r
�
add_separatorKszMenu.add_separatorcKs&|jj|jd||f|j||��dS)zInternal function.r�N)r0r�r�r�)rDr�r�r$r�r r r
r�NszMenu.insertcKs|j|d|p|�dS)z$Add hierarchical menu item at INDEX.r�N)r�)rDr�r$r�r r r
�insert_cascadeRszMenu.insert_cascadecKs|j|d|p|�dS)z#Add checkbutton menu item at INDEX.r�N)r�)rDr�r$r�r r r
�insert_checkbuttonUszMenu.insert_checkbuttoncKs|j|d|p|�dS)zAdd command menu item at INDEX.r�N)r�)rDr�r$r�r r r
�insert_commandXszMenu.insert_commandcKs|j|d|p|�dS)zAddd radio menu item at INDEX.r�N)r�)rDr�r$r�r r r
�insert_radiobutton[szMenu.insert_radiobuttoncKs|j|d|p|�dS)zAdd separator at INDEX.r�N)r�)rDr�r$r�r r r
�insert_separator^szMenu.insert_separatorcCs�|dkr|}|j|�|j|�}}|dks2|dkr:d\}}xBt||d�D]0}d|j|�krJt|j|d��}|rJ|j|�qJW|jj|jd||�dS)z7Delete menu items between INDEX1 and INDEX2 (included).Nrrr�r�rb)rrb) r�r��entryconfigr� entrycgetr�r0r�r�)rD�index1�index2Z
num_index1Z
num_index2rsr%r r r
r�aszMenu.deletecCs|jj|jd|d|�S)z=Return the resource value of a menu item for OPTION at INDEX.r�r+)r0r�r�)rDr�r�r r r
r�pszMenu.entrycgetcKs|jd|f||�S)zConfigure a menu item at INDEX.�entryconfigure)r�)rDr�r$r�r r r
r�sszMenu.entryconfigurecCs*|jj|jd|�}|dkrdS|jj|�S)z4Return the index of a menu item identified by INDEX.r�r�N)r0r�r�r�)rDr�rsr r r
r�wsz
Menu.indexcCs|jj|jd|�S)zRInvoke a menu item identified by INDEX and execute
the associated command.rb)r0r�r�)rDr�r r r
rb|szMenu.invokecCs|jj|jd||�dS)zDisplay a menu at position X,Y.�postN)r0r�r�)rDrdrer r r
r��sz Menu.postcCs|jj|jd|�S)z*Return the type of the menu item at INDEX.r)r0r�r�)rDr�r r r
r�sz Menu.typecCs|jj|jd�dS)z
Unmap a menu.�unpostN)r0r�r�)rDr r r
r��szMenu.unpostcCs|jj|jj|jd|��S)zNReturn the x-position of the leftmost pixel of the menu item
at INDEX.� xposition)r0r�r�r�)rDr�r r r
r��szMenu.xpositioncCs|jj|jj|jd|��S)zEReturn the y-position of the topmost pixel of the menu item at INDEX.� yposition)r0r�r�r�)rDr�r r r
r��szMenu.yposition)rh)N)N)rFrGrHrwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rbr�rr�r�r�r r r r
r�+s6
r�c@seZdZdZdifdd�ZdS)�
Menubuttonz(Menubutton widget, obsolete since Tk8.0.NcKstj||d||�dS)N�
menubutton)r\r�)rDr�r$r�r r r
r��szMenubutton.__init__)rFrGrHrwr�r r r r
r��sr�c@seZdZdZdifdd�ZdS)�MessagezKMessage widget to display multiline text. Obsolete since Label does it too.NcKstj||d||�dS)N�message)r\r�)rDr�r$r�r r r
r��szMessage.__init__)rFrGrHrwr�r r r r
r��sr�c@s>eZdZdZdifdd�Zdd�Zdd�Zd d
�Zdd�ZdS)
�RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.NcKstj||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.r�N)r\r�)rDr�r$r�r r r
r��s
zRadiobutton.__init__cCs|jj|jd�dS)zPut the button in off-state.r�N)r0r�r�)rDr r r
r��szRadiobutton.deselectcCs|jj|jd�dS)zFlash the button.raN)r0r�r�)rDr r r
ra�szRadiobutton.flashcCs|jj|jd�S)z<Toggle the button and invoke a command if given as resource.rb)r0r�r�)rDr r r
rb�szRadiobutton.invokecCs|jj|jd�dS)zPut the button in on-state.r�N)r0r�r�)rDr r r
r��szRadiobutton.select) rFrGrHrwr�r�rarbr�r r r r
r��sr�c@s@eZdZdZdifdd�Zdd�Zdd�Zd
d d
�Zdd�ZdS)�Scalez1Scale widget which can display a numerical scale.NcKstj||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�N)r\r�)rDr�r$r�r r r
r��s zScale.__init__c
CsD|jj|jd�}y|jj|�Stttfk
r>|jj|�SXdS)z*Get the current value as integer or float.r�N)r0r�r�r�r}r!r�r�)rDrr r r
r��s
z Scale.getcCs|jj|jd|�dS)zSet the value to VALUE.r�N)r0r�r�)rDrr r r
r��sz Scale.setcCs|j|jj|jd|��S)z�Return a tuple (X,Y) of the point along the centerline of the
trough that corresponds to VALUE or the current value if None is
given.r)r*r0r�r�)rDrr r r
r�szScale.coordscCs|jj|jd||�S)zcReturn where the point X,Y lies. Valid return values are "slider",
"though1" and "though2".�identify)r0r�r�)rDrdrer r r
r��szScale.identify)N) rFrGrHrwr�r�r�rr�r r r r
r��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.NcKstj||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 scrollbarN)r\r�)rDr�r$r�r r r
r��s zScrollbar.__init__cCs|jj|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.r�N)r0r�r�)rDr�r r r
r��szScrollbar.activatecCs|jj|jj|jd||��S)znReturn the fractional change of the scrollbar setting if it
would be moved by DELTAX or DELTAY pixels.r_)r0r�r�r�)rDZdeltaxZdeltayr r r
r_�szScrollbar.deltacCs|jj|jj|jd||��S)zRReturn the fractional value which corresponds to a slider
position of X,Y.r�)r0r�r�r�)rDrdrer r r
r��szScrollbar.fractioncCs|jj|jd||�S)zYReturn the element under position X,Y as one of
"arrow1","slider","arrow2" or "".r�)r0r�r�)rDrdrer r r
r��szScrollbar.identifycCs|j|jj|jd��S)zZReturn the current fractional values (upper and lower end)
of the slider position.r�)r_r0r�r�)rDr r r
r��sz
Scrollbar.getcCs|jj|jd||�dS)ziSet the fractional values of the slider position (upper and
lower ends as value between 0 and 1).r�N)r0r�r�)rDr�r�r r r
r��sz
Scrollbar.set)N)rFrGrHrwr�r�r_r�r�r�r�r r r r
r��s
r�c@s�eZdZdZdifdd�Zdd�Zdd�Zd d
�Zdkdd�Zdld
d�Z dd�Z
dmdd�Zdd�Zdndd�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.NcKstj||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�N)r\r�)rDr�r$r�r r r
r�sz
Text.__init__cCs|j|jj|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�N)r*r0r�r�)rDr�r r r
r�sz Text.bboxcCs|jj|jj|jd|||��S)z�Return whether between index INDEX1 and index INDEX2 the
relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.�compare)r0r�r�r�)rDr��opr�r r r
r�#szText.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|]}|jd�sd|�qS)r+z-%s)�
startswith)rL�argr r r
r�4szText.count.<locals>.<listcomp>rVN�)r0r�r�r)rDr�r�r�rr r r
rV(sz
Text.countcCs6|dkr |jj|jj|jd��S|jj|jd|�dS)zjTurn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN.N�debug)r0r�r�r�)rDr�r r r
r�;sz
Text.debugcCs|jj|jd||�dS)z?Delete the characters between INDEX1 and INDEX2 (not included).r�N)r0r�r�)rDr�r�r r r
r�AszText.deletecCs|j|jj|jd|��S)z�Return tuple (x,y,width,height,baseline) giving the bounding box
and baseline position of the visible part of the line containing
the character at INDEX.� dlineinfo)r*r0r�r�)rDr�r r r
r�DszText.dlineinfoc
Ks�g}d}d}|s$g}|fdd�}|}zzt|t�s>|j|�}}|d|g7}x"|D]} || rP|jd| �qPW|j|�|r�|j|�|jj|jdf|��|S|r�|j|�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|j|||f�dS)N)rp)r4rr�rr r r
�
append_triple^sz Text.dump.<locals>.append_triplez-commandr+�dump)rrr�rpr0r�r�r�)
rDr�r�r�r�r�Z func_namerr�r4r r r
r�Is*
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
�edit)r0r�r�)rDr�r r r
r�qs
z Text.editcCs|jd|�S)a;Get or Set the modified flag
If arg is not specified, returns the modified
flag of the widget. The insert, delete, edit undo and
edit redo commands or the user can set or clear the
modified flag. If boolean is specified, sets the
modified flag of the widget to arg.
Zmodified)r�)rDr�r r r
�
edit_modified�s zText.edit_modifiedcCs
|jd�S)aRedo 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.
Zredo)r�)rDr r r
� edit_redo�szText.edit_redocCs
|jd�S)z(Clears the undo and redo stacks
�reset)r�)rDr r r
�
edit_reset�szText.edit_resetcCs
|jd�S)znInserts a separator (boundary) on the undo stack.
Does nothing when the undo option is false
r�)r�)rDr r r
�edit_separator�szText.edit_separatorcCs
|jd�S)aDUndoes the last edit action
If the undo option is true. An edit action is defined
as all the insert and delete commands that are recorded
on the undo stack in between two separators. Generates
an error when the undo stack is empty. Does nothing
when the undo option is false
Zundo)r�)rDr r r
� edit_undo�s zText.edit_undocCs|jj|jd||�S)z5Return the text from INDEX1 to INDEX2 (not included).r�)r0r�r�)rDr�r�r r r
r��szText.getcCsJ|dd�dkrd|}|dd�dkr4|dd�}|jj|jdd||�S) z9Return the value of OPTION of an embedded image at INDEX.Nrr+rar�r�rbrb)r0r�r�)rDr�r�r r r
�
image_cget�s
zText.image_cgetcKs|jdd|f||�S)z%Configure an embedded image at INDEX.r�r�)r�)rDr�r$r�r r r
�image_configure�szText.image_configurecKs"|jj|jdd|f|j||���S)z"Create an embedded image at INDEX.r�r)r0r�r�r�)rDr�r$r�r r r
�image_create�szText.image_createcCs|jj|jdd�S)z3Return all names of embedded images in this widget.r�r�)r0r�r�)rDr r r
r��szText.image_namescCst|jj|jd|��S)z1Return the index in the form line.char for INDEX.r�)rr0r�r�)rDr�r r r
r��sz
Text.indexcGs|jj|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�N)r0r�r�)rDr��charsr�r r r
r��szText.insertcCs|jj|jdd||f�S)z�Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
Return the current value if None is given for DIRECTION.r�Zgravity)r0r�r�)rD�markName� directionr r r
�mark_gravity�szText.mark_gravitycCs|jj|jj|jdd��S)zReturn all mark names.r�r�)r0r,r�r�)rDr r r
�
mark_names�szText.mark_namescCs|jj|jdd||�dS)z0Set mark MARKNAME before the character at INDEX.r�r�N)r0r�r�)rDrr�r r r
�mark_set�sz
Text.mark_setcGs|jj|jddf|�dS)zDelete all marks in MARKNAMES.r�ZunsetN)r0r�r�)rDZ markNamesr r r
�
mark_unset�szText.mark_unsetcCs|jj|jdd|�pdS)z-Return the name of the next mark after INDEX.r��nextN)r0r�r�)rDr�r r r
� mark_next�szText.mark_nextcCs|jj|jdd|�pdS)z2Return the name of the previous mark before INDEX.r�ZpreviousN)r0r�r�)rDr�r r r
�
mark_previous�szText.mark_previouscKs&|jj|jdd|f|j||���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.�peerrN)r0r�r�r�)rDZnewPathNamer$r�r r r
�peer_create�szText.peer_createcCs|jj|jj|jdd��S)zYReturns a list of peers of this widget (this does not include
the widget itself).rr�)r0r,r�r�)rDr r r
�
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.rN)r0r�r�)rDr�r�rr�r r r
r�szText.replacecCs|jj|jdd||�dS)z&Remember the current X, Y coordinates.r�r�N)r0r�r�)rDrdrer r r
r��szText.scan_markcCs|jj|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�N)r0r�r�)rDrdrer r r
r��szText.scan_dragtocCs�|jdg}|r|jd�|r&|jd�|r4|jd�|rB|jd�|rP|jd�|
r^|jd�| rv|jd�|j| �|r�|d d
kr�|jd�|j|�|j|�|r�|j|�t|jjt|���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+z--)r�rprr0r�r)rDr�r�Z stopindexZforwardsZ backwards�exactZregexpZnocaserVZelider�r r r
r�s.
zText.searchcCs|jj|jd|�dS)z3Scroll such that the character at INDEX is visible.r�N)r0r�r�)rDr�r r r
r�
szText.seecGs |jj|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�N)r0r�r�)rD�tagNamer�r�r r r
�tag_add
szText.tag_addcCs*|jj|jdd||d�|r&|j|�dS)zgUnbind for all characters with TAGNAME for event SEQUENCE the
function identified with FUNCID.rrWrhN)r0r�r�r�)rDrrSrUr r r
rz
szText.tag_unbindcCs|j|jdd|f|||�S)a+Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.
An additional boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or whether it will
replace the previous function. See bind for the return value.rrW)rVr�)rDrrSr�r�r r r
r{
sz
Text.tag_bindcCsJ|dd�dkrd|}|dd�dkr4|dd�}|jj|jdd||�S) z+Return the value of OPTION for tag TAGNAME.Nrr+rarr�rbrb)r0r�r�)rDrr�r r r
�tag_cget!
s
z
Text.tag_cgetcKs|jdd|f||�S)zConfigure a tag TAGNAME.rr�)r�)rDrr$r�r r r
�
tag_configure(
szText.tag_configurecGs|jj|jddf|�dS)zDelete all tags in TAGNAMES.rr�N)r0r�r�)rDZtagNamesr r r
�
tag_delete,
szText.tag_deletecCs|jj|jdd||�dS)z`Change the priority of tag TAGNAME such that it is lower
than the priority of BELOWTHIS.rrN)r0r�r�)rDrrr r r
r�/
szText.tag_lowercCs|jj|jj|jdd|��S)zReturn a list of all tag names.rr�)r0r,r�r�)rDr�r r r
� tag_names3
szText.tag_namescCs |jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched forward from INDEX1.rZ nextrange)r0r,r�r�)rDrr�r�r r r
�
tag_nextrange7
szText.tag_nextrangecCs |jj|jj|jdd|||��S)z�Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched backwards from INDEX1.rZ prevrange)r0r,r�r�)rDrr�r�r r r
�
tag_prevrange=
szText.tag_prevrangecCs|jj|jdd||�dS)zaChange the priority of tag TAGNAME such that it is higher
than the priority of ABOVETHIS.rrN)r0r�r�)rDrrr r r
r�C
szText.tag_raisecCs|jj|jj|jdd|��S)z7Return a list of ranges of text which have tag TAGNAME.rZranges)r0r,r�r�)rDrr r r
�
tag_rangesH
szText.tag_rangescCs|jj|jdd|||�dS)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.rr�N)r0r�r�)rDrr�r�r r r
�
tag_removeL
szText.tag_removecCsJ|dd�dkrd|}|dd�dkr4|dd�}|jj|jdd||�S) z:Return the value of OPTION of an embedded window at INDEX.Nrr+rar�r�rbrb)r0r�r�)rDr�r�r r r
�window_cgetP
s
zText.window_cgetcKs|jdd|f||�S)z&Configure an embedded window at INDEX.r�r�)r�)rDr�r$r�r r r
�window_configureW
szText.window_configurecKs&|jj|jdd|f|j||��dS)zCreate a window at INDEX.r�rN)r0r�r�r�)rDr�r$r�r r r
�
window_create[
szText.window_createcCs|jj|jj|jdd��S)z4Return all names of embedded windows in this widget.r�r�)r0r,r�r�)rDr r r
�window_names`
szText.window_namescGs|jj|jddf|�dS)zObsolete function, use see.r�z
-pickplaceN)r0r�r�)rDrRr r r
�yview_pickplaced
szText.yview_pickplace)N)N)NN)N)N)N)N)NNNNNNNN)N)N)N)N)N)N)N)N)N)N):rFrGrHrwr�r�r�rVr�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�rrrrr r
rr
rr�r�rr�rrzr{rrZ
tag_configrr�rrrr�rrrrZ
window_configrrrr r r r
r�sr
(
r�c@s"eZdZdZddd�Zdd�ZdS)�_setitz>Internal class. It wraps the command in the widget OptionMenu.NcCs||_||_||_dS)N)�
_setit__value�_setit__var�_setit__callback)rD�varrr�r r r
r�k
sz_setit.__init__cGs*|jj|j�|jr&|j|jf|��dS)N)r!r�r r")rDr�r r r
r�o
sz_setit.__call__)N)rFrGrHrwr�r�r r r r
ri
s
rc@s(eZdZdZdd�Zdd�Zdd�ZdS) �
OptionMenuz?OptionMenu which allows the user to select a value from a menu.c
Os�d|dtddd�}tj||d|�d|_t|ddd �}|_|j|_|jd
�}d
|kr\|d
=|rtt d|j
�d��|j|t|||�d�x"|D]} |j| t|| |�d�q�W||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%)ZborderwidthZtextvariableZindicatoronZreliefr�Zhighlightthicknessr�Z
tk_optionMenur�r)rCZtearoffr�zunknown option -)r�r�N)
ZRAISEDr\r�rXr��_OptionMenu__menur�Zmenunamer�r�rur�r)
rDr�r�rr1�kwargsr�r�r�r(r r r
r�v
s$
zOptionMenu.__init__cCs|dkr|jStj||�S)Nr�)r%r\r�)rDrCr r r
r��
szOptionMenu.__getitem__cCstj|�d|_dS)z,Destroy this widget and the associated menu.N)r�r�r%)rDr r r
r��
s
zOptionMenu.destroyN)rFrGrHrwr�r�r�r r r r
r$t
sr$c@sheZdZdZdZdidfdd�Zdd�Zdd �Zd
d�Zdd
�Z dd�Z
e
Zdd�Zdd�Z
dd�ZdS)�ImagezBase class for images.rNc Ks�d|_|st}|std��t|d|�|_|sFtjd7_dtjf}|r\|r\t||f�}n|rd|}f}x6|j�D]*\}}t |�r�|j
|�}|d||f}qrW|jjdd||f|�||_dS)NzToo early to create imager0rz pyimage%rr+r�r)rCryr-rmr0r'�_last_idr)r#rcr�r�) rDZimgtyperCr$r�r�r�r'r(r r r
r��
s(
zImage.__init__cCs|jS)N)rC)rDr r r
rE�
sz
Image.__str__cCs6|jr2y|jjdd|j�Wntk
r0YnXdS)Nr�r�)rCr0r�r�)rDr r r
r��
s
z
Image.__del__cCs|jj|jdd||�dS)Nr�r+)r0r�rC)rDr4rr r r
r��
szImage.__setitem__cCs|jj|jdd|�S)Nr�r+)r0r�rC)rDr4r r r
r��
szImage.__getitem__cKszf}xZt|�j�D]J\}}|dk r|ddkr:|dd�}t|�rL|j|�}|d||f}qW|jj|jdf|�dS)zConfigure the image.Nrrar+r�rbrb)r)r#rcr�r0r�rC)rDr�rr'r(r r r
r��
s
zImage.configurecCs|jj|jjdd|j��S)zReturn the height of the image.r�rg)r0r�r�rC)rDr r r
rg�
szImage.heightcCs|jjdd|j�S)z7Return the type of the image, e.g. "photo" or "bitmap".r�r)r0r�rC)rDr r r
r�
sz
Image.typecCs|jj|jjdd|j��S)zReturn the width of the image.r�rf)r0r�r�rC)rDr r r
rf�
szImage.width)rFrGrHrwr(r�rEr�r�r�r�r�rgrrfr r r r
r'�
s
r'c@speZdZdZdidfdd�Zdd�Zdd�Zd d
�Zdd�Zddd�Z ddd�Z
dd�Zddd�Zddd�Z
dS)�
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)r'r�)rDrCr$r�r�r r r
r��
szPhotoImage.__init__cCs|jj|jd�dS)zDisplay a transparent image.�blankN)r0r�rC)rDr r r
r*�
szPhotoImage.blankcCs|jj|jdd|�S)zReturn the value of OPTION.r�r+)r0r�rC)rDr�r r r
r��
szPhotoImage.cgetcCs|jj|jdd|�S)Nr�r+)r0r�rC)rDr4r r r
r��
szPhotoImage.__getitem__cCs"t|jd�}|jj|d|j�|S)z;Return a new PhotoImage with the same image as this widget.)r��copy)r)r0r�rC)rD� destImager r r
r+�
szPhotoImage.copyrhcCs4t|jd�}|dkr|}|jj|d|jd||�|S)z�Return a new PhotoImage with the same image as this widget
but zoom it with a factor of x in the X direction and y in the Y
direction. If y is not given, the default value is the same as x.
)r�rhr+z-zoom)r)r0r�rC)rDrdrer,r r r
�zoom�
s
zPhotoImage.zoomcCs4t|jd�}|dkr|}|jj|d|jd||�|S)z�Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel. If y is not given, the
default value is the same as x.
)r�rhr+z
-subsample)r)r0r�rC)rDrdrer,r r r
� subsample�
s
zPhotoImage.subsamplecCs|jj|jd||�S)z8Return the color (red, green, blue) of the pixel at X,Y.r�)r0r�rC)rDrdrer r r
r��
szPhotoImage.getcCsH|jd|f}|r8|ddkr(|dd�}|dt|�}|jj|�dS)zzPut row formatted colors to image starting from
position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))�putr�-torN)r0)rCrr0r�)rDr�r�r�r r r
r/�
szPhotoImage.putcCs@|jd|f}|r|d|f}|r0|dt|�}|jj|�dS)zRWrite image to file FILENAME in FORMAT starting from
position FROM_COORDS.�writez-format�-fromN)r2)rCrr0r�)rD�filename�formatZfrom_coordsr�r r r
r1szPhotoImage.write)rh)rh)N)NN)rFrGrHrwr�r*r�r�r+r-r.r�r/r1r r r r
r)�
s
r)c@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.r�N)r'r�)rDrCr$r�r�r r r
r�szBitmapImage.__init__)rFrGrHrwr�r r r r
r5sr5cCstjjtjjdd��S)Nr�r�)ryr0r,r�r r r r
r�sr�cCstjjtjjdd��S)Nr�r�)ryr0r,r�r r r r
r�sr�c@s�eZdZdZdifdd�Zdd�Zd#dd�Zd d
�Zdd�Zd
d�Z dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd$d!d"�ZdS)%�Spinboxzspinbox widget.NcKstj||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,
ZspinboxN)r\r�)rDr�r$r�r r r
r�#szSpinbox.__init__cCs|j|jj|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�N)r*r0r�r�)rDr�r r r
r�@szSpinbox.bboxcCs|jj|jd||�S)aWDelete one or more elements of the spinbox.
First is the index of the first character to delete,
and last is the index of the character just after
the last one to delete. If last isn't specified it
defaults to first+1, i.e. a single character is
deleted. This command returns an empty string.
r�)r0r�r�)rDr�r�r r r
r�Ns zSpinbox.deletecCs|jj|jd�S)zReturns the spinbox's stringr�)r0r�r�)rDr r r
r�YszSpinbox.getcCs|jj|jd|�S)z�Alter the position of the insertion cursor.
The insertion cursor will be displayed just before
the character given by index. Returns an empty string
r�)r0r�r�)rDr�r r r
r�]szSpinbox.icursorcCs|jj|jd||�S)z{Returns the name of the widget at position x, y
Return value is one of: none, buttondown, buttonup, entry
r�)r0r�r�)rDrdrer r r
r�eszSpinbox.identifycCs|jj|jd|�S)z;Returns the numerical index corresponding to index
r�)r0r�r�)rDr�r r r
r�lsz
Spinbox.indexcCs|jj|jd||�S)zDInsert string s at index
Returns an empty string.
r�)r0r�r�)rDr�rrr r r
r�qszSpinbox.insertcCs|jj|jd|�S)z�Causes the specified element to be invoked
The element could be buttondown or buttonup
triggering the action associated with it.
rb)r0r�r�)rD�elementr r r
rbxszSpinbox.invokecGs |j|jj|jdf|��pfS)zInternal function.r�)r*r0r�r�)rDr�r r r
r��szSpinbox.scancCs|jd|�S)z�Records x and the current view in the spinbox window;
used in conjunction with later scan dragto commands.
Typically this command is associated with a mouse button
press in the widget. It returns an empty string.
r�)r�)rDrdr r r
r��szSpinbox.scan_markcCs|jd|�S)a�Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in the widget, to
produce the effect of dragging the spinbox at high speed
through the window. The return value is an empty string.
r�)r�)rDrdr r r
r��s
zSpinbox.scan_dragtocGs |j|jj|jdf|��pfS)zInternal function.r�)r*r0r�r�)rDr�r r r
r��szSpinbox.selectioncCs|jd|�S)a�Locate the end of the selection nearest to the character
given by index,
Then adjust that end of the selection to be at index
(i.e including but not going beyond index). The other
end of the selection is made the anchor point for future
select to commands. If the selection isn't currently in
the spinbox, then a new selection is created to include
the characters between index and the most recent selection
anchor point, inclusive.
r�)r�)rDr�r r r
r��szSpinbox.selection_adjustcCs
|jd�S)zsClear the selection
If the selection isn't in this widget then the
command has no effect.
r�)r�)rDr r r
r��szSpinbox.selection_clearcCs|jj|jdd|�S)z�Sets or gets the currently selected element.
If a spinbutton element is specified, it will be
displayed depressed.
r�r7)r0r�r�)rDr7r r r
�selection_element�szSpinbox.selection_element)N)N)rFrGrHrwr�r�r�r�r�r�r�r�rbr�r�r�r�r�r�r8r r r r
r6!s"
r6c@seZdZdZdifdd�ZdS)�
LabelFramezlabelframe widget.NcKstj||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
labelframeN)r\r�)rDr�r$r�r r r
r��szLabelFrame.__init__)rFrGrHrwr�r r r r
r9�sr9c@s�eZdZdZdifdd�Zdd�Zdd�ZeZd d
�Zdd�Z d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd!dd�ZeZdd �ZdS)"�PanedWindowzpanedwindow widget.NcKstj||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,
ZpanedwindowN)r\r�)rDr�r$r�r r r
r��szPanedWindow.__init__cKs"|jj|jd|f|j|��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�N)r0r�r�r�)rDrr�r r r
r��szPanedWindow.addcCs|jj|jd|�dS)z�Remove the pane containing child from the panedwindow
All geometry management options for child will be forgotten.
r�N)r0r�r�)rDrr r r
r��szPanedWindow.removecCs|jj|jd||�S)a�Identify the panedwindow component at point x, y
If the point is over a sash or a sash handle, the result
is a two element list containing the index of the sash or
handle, and a word indicating whether it is over a sash
or a handle, such as {0 sash} or {2 handle}. If the point
is over any other part of the panedwindow, the result is
an empty list.
r�)r0r�r�)rDrdrer r r
r��s
zPanedWindow.identifycGs |j|jj|jdf|��pfS)zInternal function.�proxy)r*r0r�r�)rDr�r r r
r;szPanedWindow.proxycCs
|jd�S)zBReturn the x and y pair of the most recent proxy location
�coord)r;)rDr r r
�proxy_coord
szPanedWindow.proxy_coordcCs
|jd�S)z+Remove the proxy from the display.
r�)r;)rDr r r
�proxy_forgetszPanedWindow.proxy_forgetcCs|jd||�S)z:Place the proxy at the given x and y coordinates.
r�)r;)rDrdrer r r
�proxy_placeszPanedWindow.proxy_placecGs |j|jj|jdf|��pfS)zInternal function.�sash)r*r0r�r�)rDr�r r r
r@szPanedWindow.sashcCs|jd|�S)aAReturn the current x and y pair for the sash given by index.
Index must be an integer between 0 and 1 less than the
number of panes in the panedwindow. The coordinates given are
those of the top left corner of the region containing the sash.
pathName sash dragto index x y This command computes the
difference between the given coordinates and the coordinates
given to the last sash coord command for the given sash. It then
moves that sash the computed difference. The return value is the
empty string.
r<)r@)rDr�r r r
�
sash_coordszPanedWindow.sash_coordcCs|jd|�S)zRecords x and y for the sash given by index;
Used in conjunction with later dragto commands to move the sash.
r�)r@)rDr�r r r
� sash_mark,szPanedWindow.sash_markcCs|jd|||�S)z?Place the sash given by index at the given coordinates
r�)r@)rDr�rdrer r r
�
sash_place3szPanedWindow.sash_placecCs|jj|jdf|d|f�S)zwQuery a management option for window.
Option may be any value allowed by the paneconfigure subcommand
�panecgetr+)r0r�r�)rDrr�r r r
rD8szPanedWindow.panecgetcKsh|dkr|r|j|jd|�St|t�rD|rD|j|jd|d|�S|jj|jd|f|j||��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�r0r�r�)rDrgr$r�r r r
rE@sDzPanedWindow.paneconfigurecCs|jj|jj|jd��S)z+Returns an ordered list of the child panes.�panes)r0r,r�r�)rDr r r
rF�szPanedWindow.panes)N)rFrGrHrwr�r�r�r�r�r;r=r>r?r@rArBrCrDrEZ
paneconfigrFr r r r
r:�s$
Kr:cCs�t�}dt}|d7}t||d�}|j�t|d|fdd�d�}|j�||_t|d|jd�}|j�|j�|j�|j �|j
�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�)r�r r r
�<lambda>�sz_test.<locals>.<lambda>)r�r�ZQUIT)r�
TclVersionr�r�rIrGr�r�rr�r�)r�r�r�rGr^r r r
�_test�srJ�__main__)TN)r)r)NNrr)Urw�enumr�r�r�Ztkinter.constants�rer �floatr/Z TkVersionr0rIZREADABLEZWRITABLEZ EXCEPTION�compiler�ASCIIrrrrr r)r5r�Enumr6rKrxryrzr|r�r�r�r�r�r�r�r�rnr�r�r�r�r�r�r�r�rrErFrLrPrUr\r]rIrcr�r�r�r�r�r�r�r�r�r�r�r�rr$r'r)r5r�r�r6r9r:rJrFr r r r
�<module>s�
+P
1
fvw
',/>-rA[g!,g%9@?
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists