/ lib / tkinter / __init__.pyc
__init__.pyc
   1  o

   2  ���c3��@s$dZddlZddlZddlZddlZejZddlTddlZdZe	ej
   3  �Ze	ej�Z
ejZejZejZe�d�Ze�dej�Zdd�Zd	d
   4  �Zdd�ZzejZWn	eyXYnwd
d�ZzejZWn	eykYnwd�dd�ZGdd�deej�ZGdd�d�Zdada dd�Z!d�dd�Z"dd�Z#dd�Z$dd�Z%d�d d!�Z&da'Gd"d#�d#�Z(Gd$d%�d%e(�Z)Gd&d'�d'e(�Z*Gd(d)�d)e(�Z+Gd*d+�d+e(�Z,d�d,d-�Z-e.Z/e	Z0d.d/�Z1Gd0d1�d1�Z2Gd2d3�d3�Z3Gd4d5�d5�Z4Gd6d7�d7�Z5Gd8d9�d9�Z6Gd:d;�d;e2e6�Z7d�d=d>�Z8Gd?d@�d@�Z9GdAdB�dB�Z:GdCdD�dD�Z;GdEdF�dFe2�Z<GdGdH�dHe<e9e:e;�Z=GdIdJ�dJe<e6�Z>GdKdL�dLe=�Z?GdMdN�dNe=e4e5�Z@daAGdOdP�dPe=�ZBGdQdR�dRe=e4�ZCGdSdT�dTe=�ZDGdUdV�dVe=�ZEGdWdX�dXe=e4e5�ZFGdYdZ�dZe=�ZGGd[d\�d\e=�ZHGd]d^�d^e=�ZIGd_d`�d`e=�ZJGdadb�dbe=�ZKGdcdd�dde=�ZLGdedf�dfe=e4e5�ZMGdgdh�dh�ZNGdidj�djeH�ZOGdkdl�dl�ZPGdmdn�dneP�ZQGdodp�dpeP�ZRdqdr�ZSdsdt�ZTGdudv�dve=e4�ZUGdwdx�dxe=�ZVGdydz�dze=�ZWd{d|�ZXd}d~�eY��Z�D�Z[e\dk�reX�dSdS)�a8Wrapper functions for Tcl/Tk.
   5  
   6  Tkinter provides classes which allow the display, positioning and
   7  control of widgets. Toplevel widgets are Tk and Toplevel. Other
   8  widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
   9  Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
  10  LabelFrame and PanedWindow.
  11  
  12  Properties of the widgets are specified with keyword arguments.
  13  Keyword arguments have the same name as the corresponding resource
  14  under Tk.
  15  
  16  Widgets are positioned with one of the geometry managers Place, Pack
  17  or Grid. These managers can be called with methods place, pack, grid
  18  available in every Widget.
  19  
  20  Actions are bound to events by resources (e.g. keyword argument
  21  command) or with the method bind.
  22  
  23  Example (Hello, World):
  24  import tkinter
  25  from tkinter.constants import *
  26  tk = tkinter.Tk()
  27  frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
  28  frame.pack(fill=BOTH,expand=1)
  29  label = tkinter.Label(frame, text="Hello, World")
  30  label.pack(fill=X, expand=1)
  31  button = tkinter.Button(frame,text="Exit",command=tk.destroy)
  32  button.pack(side=BOTTOM)
  33  tk.mainloop()
  34  �N)�*�z([\\{}])z([\s])cCsd�tt|��S)�Internal function.� )�join�map�
  35  _stringify��value�r�xC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py�_join8�r
cCs�t|ttf�r&t|�dkrt|d�}t�|�rd|}|Sdt|�}|St|�}|s0d}|St�|�rSt�	d|�}|�
  36  dd�}t�	d|�}|ddkrQd	|}|S|ddks^t�|�rbd|}|S)
  37  rrrz{%s}z{}z\\\1�
  38  z\n�"�\)�
  39  isinstance�list�tuple�lenr�	_magic_re�searchr
�str�sub�replace�	_space_rer	rrrr=s,
  40  ��
  41  
  42  ��rcCs@d}|D]}t|ttf�r|t|�}q|dur||f}q|S)rrN)rrr�_flatten)�seq�res�itemrrrrVs
  43  �rcCs�t|t�r|St|td�tf�r|Si}t|�D]/}z|�|�WqttfyG}ztd|�|�	�D]\}}|||<q4WYd}~qd}~ww|S)rNz_cnfmerge: fallback due to:)
  44  r�dict�typerr�update�AttributeError�	TypeError�print�items)�cnfs�cnf�c�msg�k�vrrr�	_cnfmergees 
  45  
  46  
  47  ���r-Tc	Csz|�|�}t|�drtd��t|�}i}t||�D] \}}t|�}|r0|ddkr0|dd�}|r6||�}|||<q|S)aReturn a properly formatted dict built from Tcl list pairs.
  48  
  49      If cut_minus is True, the supposed '-' prefix will be removed from
  50      keys. If conv is specified, it is used to convert values.
  51  
  52      Tcl list is expected to contain an even number of elements.
  53      �zNTcl list representing a dict is expected to contain an even number of elementsr�-rN)�	splitlistr�RuntimeError�iter�zipr)	�tkr,�	cut_minus�conv�t�itr �keyr
  54  rrr�
  55  _splitdict{s
  56  
  57  r:c@s�eZdZdZeZdZdZeZdZdZ	dZ
  58  dZdZd	Z
d
  59  ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)e*j+Z+d&S)'�	EventType�2�3�4�5�6�7�8�9�10�11�12�13�14�15�16�17�18�19�20�21�22�23�24�25�26�27�28�29�30�31�32�33�34�35�36�37�38N),�__name__�
  60  __module__�__qualname__�KeyPress�Key�
  61  KeyRelease�ButtonPress�Button�
ButtonRelease�Motion�Enter�Leave�FocusIn�FocusOut�Keymap�Expose�GraphicsExpose�NoExpose�
  62  Visibility�Create�Destroy�Unmap�Map�
  63  MapRequest�Reparent�	Configure�ConfigureRequest�Gravity�
ResizeRequest�	Circulate�CirculateRequest�Property�SelectionClear�SelectionRequest�	Selection�Colormap�
ClientMessage�Mapping�VirtualEvent�Activate�
  64  Deactivate�
  65  MouseWheelr�__str__rrrrr;�sR
  66  r;c@seZdZdZdd�ZdS)�Eventa�Container for the properties of an event.
  67  
  68      Instances of this type are generated if one of the following events occurs:
  69  
  70      KeyPress, KeyRelease - for keyboard events
  71      ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events
  72      Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate,
  73      Colormap, Gravity, Reparent, Property, Destroy, Activate,
  74      Deactivate - for window events.
  75  
  76      If a callback function for one of these events is registered
  77      using bind, bind_all, bind_class, or tag_bind, the callback is
  78      called with an Event as first argument. It will have the
  79      following attributes (in braces are the event types for which
  80      the attribute is valid):
  81  
  82          serial - serial number of event
  83      num - mouse button pressed (ButtonPress, ButtonRelease)
  84      focus - whether the window has the focus (Enter, Leave)
  85      height - height of the exposed window (Configure, Expose)
  86      width - width of the exposed window (Configure, Expose)
  87      keycode - keycode of the pressed key (KeyPress, KeyRelease)
  88      state - state of the event as a number (ButtonPress, ButtonRelease,
  89                              Enter, KeyPress, KeyRelease,
  90                              Leave, Motion)
  91      state - state as a string (Visibility)
  92      time - when the event occurred
  93      x - x-position of the mouse
  94      y - y-position of the mouse
  95      x_root - x-position of the mouse on the screen
  96               (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
  97      y_root - y-position of the mouse on the screen
  98               (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
  99      char - pressed character (KeyPress, KeyRelease)
 100      send_event - see X/Windows documentation
 101      keysym - keysym of the event as a string (KeyPress, KeyRelease)
 102      keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
 103      type - type of the event as a number
 104      widget - widget in which the event occurred
 105      delta - delta of wheel movement (MouseWheel)
 106      csdd�|j��D��|js�d=n|jdkrt|j��d<t|dd�s&�d=|jdkr/�d=n>t|jt�rm|j}d	}g}t|�D]\}}|d
 107  |>@rO|�	|�q@|d
 108  t
 109  |�>d
 110  @}|s_|sf|�	t|��d�|��d<|j
dkru�d=d
}dt|jd|j�d��fdd�|D��fS)NcSsi|]\}}|dkr||�qS)�??r��.0r+r,rrr�
 111  <dictcomp>�sz"Event.__repr__.<locals>.<dictcomp>�charr��
 112  send_eventTr�state)
�Shift�Lock�Control�Mod1�Mod2�Mod3�Mod4�Mod5�Button1�Button2�Button3�Button4�Button5r�|�delta)r�r��keysym�keycoder��numr��focus�x�y�width�heightz<%s event%s>�name�c3s(�|]}|�vrd|�|fVqdS)z %s=%sNr)r�r+��attrsrr�	<genexpr>
s�&z!Event.__repr__.<locals>.<genexpr>)�__dict__r&r��repr�getattrr�r�int�	enumerate�appendr�hexrr�r!)�selfr��mods�s�i�n�keysrr�r�__repr__�s8
 113  
 114  
 115  �
 116  �zEvent.__repr__N)rarbrc�__doc__r�rrrrr��s*r�cCsdadabdS)z�Inhibit setting of default root window.
 117  
 118      Call this function to inhibit that the first instance of
 119      Tk is used for windows without an explicit parent window.
 120      FN)�_support_default_root�
_default_rootrrrr�
NoDefaultRootsr�cCs>tstd��tdur|rtd|�d���t�}t|usJ�tS)N�INo master specified and tkinter is configured to not support default rootz
Too early to z: no default root window)r�r1r��Tk)�what�rootrrr�_get_default_root#sr�cCsLtstd��t}|dur$tsJ�dat�}datdusJ�|��d|_|S)Nr�FT)r�r1r�r��withdraw�
 121  _temporary�r�rrr�_get_temp_root/sr�cCs4t|dd�rz|��WdStyYdSwdS)Nr�F)r��destroy�TclError��masterrrr�_destroy_temp_root@s��r�cCsdS�rNr)�errrrr�_tkerrorHsr�cCs,z	t|�}Wt|��tyYt|��w)zBInternal function. Calling it will raise the exception SystemExit.)r��
 122  ValueError�
 123  SystemExit)�coderrr�_exitMs
 124  ��r�c@s�eZdZdZdZdZdZddd�Zdd�Zdd	�Z	d
 125  d�Z
 126  e
 127  Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZdd�Zdd�Zdd�ZdS)�Variablez�Class to define value holders for e.g. buttons.
 128  
 129      Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations
 130      that constrain the type of the value returned from get().r�NcCs�|dur
t|t�s
td��|durtd�}|��|_|j|_|r$||_ndtt	�|_t	d7a	|dur:|�
 131  |�dS|j�|j�dd|j��sO|�
 132  |j
�dSdS)a.Construct a variable
 133  
 134          MASTER can be given as master widget.
 135          VALUE is an optional value (defaults to "")
 136          NAME is an optional Tcl name (defaults to PY_VARnum).
 137  
 138          If NAME matches an existing variable and VALUE is omitted
 139          then the existing value is retained.
 140          Nzname must be a stringzcreate variable�PY_VARr�info�exists)rrr$r��_rootr4�_tk�_namer��_varnum�
 141  initialize�
 142  getboolean�call�_default�r�r�r
 143  r�rrr�__init__bs

 144  �zVariable.__init__cCsf|jdurdS|j�|j�dd|j��r|j�|j�|jdur1|jD]}|j�|�q#d|_dSdS)zUnset the variable in Tcl.Nr�r�)r�r�r�r��globalunsetvar�_tclCommands�
deletecommand�r�r�rrr�__del__�s
 145  
 146  
 147  
 148  �zVariable.__del__cC�|jS)z'Return the name of the variable in Tcl.)r��r�rrrr���zVariable.__str__cCs|j�|j|�S�zSet the variable to VALUE.)r��globalsetvarr��r�r
 149  rrr�set�rzVariable.setcCs|j�|j�S)zReturn value of variable.)r��globalgetvarr�r�rrr�get��zVariable.getcCs�t|d|j�j}tt|��}z|j}Wn	tyYnwz||j}Wn	ty-Ynw|j�	||�|j
 150  dur=g|_
 151  |j
 152  �|�|S�N)�CallWrapperr��__call__r��id�__func__r#rar��
createcommandr�r�)r��callback�f�cbnamerrr�	_register�s"
 153  ��
 154  zVariable._registercCs(|�|�}|j�ddd|j||f�|S)a#Define a trace callback for the variable.
 155  
 156          Mode is one of "read", "write", "unset", or a list or tuple of
 157          such strings.
 158          Callback must be a function which is called when the variable is
 159          read, written or unset.
 160  
 161          Return the name of the callback.
 162          �trace�add�variable�r�r�r�r��r��moder�r�rrr�	trace_add�s
 163  
 164  
 165  
 166  �zVariable.trace_addcCsx|j�ddd|j||�|��D]\}}|j�|�d|kr!dSq|j�|�z	|j�|�WdSty;YdSw)aDelete the trace callback for a variable.
 167  
 168          Mode is one of "read", "write", "unset" or a list or tuple of
 169          such strings.  Must be same as were specified in trace_add().
 170          cbname is the name of the callback returned from trace_add().
 171          r��removerrN)	r�r�r��
 172  trace_infor0r�r�rr��r�rr��m�carrr�trace_remove�s���zVariable.trace_removec
 173  s4|jj��fdd�t��|j�ddd|j���D�S)z&Return all trace callback information.csg|]
 174  \}}�|�|f�qSrrr��r0rr�
 175  <listcomp>�sz'Variable.trace_info.<locals>.<listcomp>r�r�r)r�r0rr�r�r�rrrr�s�zVariable.trace_infocCs$|�|�}|j�dd|j||�|S)a�Define a trace callback for the variable.
 176  
 177          MODE is one of "r", "w", "u" for read, write, undefine.
 178          CALLBACK must be a function which is called when
 179          the variable is read, written or undefined.
 180  
 181          Return the name of the callback.
 182  
 183          This deprecated method wraps a deprecated Tcl method that will
 184          likely be removed in the future.  Use trace_add() instead.
 185          r�rrrrrr�trace_variable�s
 186  
zVariable.trace_variablecCs�|j�dd|j||�|j�|�d}|��D]\}}|j�|�d|kr(dSq|j�|�z	|j�|�WdStyBYdSw)aSDelete the trace callback for a variable.
 187  
 188          MODE is one of "r", "w", "u" for read, write, undefine.
 189          CBNAME is the name of the callback returned from trace_variable or trace.
 190  
 191          This deprecated method wraps a deprecated Tcl method that will
 192          likely be removed in the future.  Use trace_remove() instead.
 193          r��vdeleterN)	r�r�r�r0rr�r�rr�rrrr�
trace_vdelete�s
 194  ��zVariable.trace_vdeletec�(�fdd��j��j�dd�j��D�S)z�Return all trace callback information.
 195  
 196          This deprecated method wraps a deprecated Tcl method that will
 197          likely be removed in the future.  Use trace_info() instead.
 198          c�g|]}�j�|��qSr)r�r0�r�r�r�rrr�z(Variable.trace_vinfo.<locals>.<listcomp>r��vinfo)r�r0r�r�r�rr�r�trace_vinfo�s�zVariable.trace_vinfocCs6t|t�stS|j|jko|jj|jjko|j|jkSr�)rr��NotImplementedr��	__class__rar�)r��otherrrr�__eq__s
 199  �
 200  �zVariable.__eq__�NNN)rarbrcr�r�r�r�r�r�r�r�r�r�r�rr
 201  rr
r�rrrrrrrr�Ys(
 202  
 203  r�c@�&eZdZdZdZddd�Zdd�ZdS)	�	StringVarz#Value holder for strings variables.r�NcC�t�||||�dS)a6Construct a string variable.
 204  
 205          MASTER can be given as master widget.
 206          VALUE is an optional value (defaults to "")
 207          NAME is an optional Tcl name (defaults to PY_VARnum).
 208  
 209          If NAME matches an existing variable and VALUE is omitted
 210          then the existing value is retained.
 211          N�r�r�r�rrrr��
 212  zStringVar.__init__cCs$|j�|j�}t|t�r|St|�S)z#Return value of variable as string.)r�r�r�rrr�rrrr�s
 213  z
StringVar.getr�rarbrcr�r�r�r�rrrrr�
 214  
 215  rc@r)	�IntVarz#Value holder for integer variables.rNcCr)a7Construct an integer variable.
 216  
 217          MASTER can be given as master widget.
 218          VALUE is an optional value (defaults to 0)
 219          NAME is an optional Tcl name (defaults to PY_VARnum).
 220  
 221          If NAME matches an existing variable and VALUE is omitted
 222          then the existing value is retained.
 223          Nrr�rrrr�*rzIntVar.__init__c	CsD|j�|j�}z|j�|�WSttfy!t|j�|��YSw)z/Return the value of the variable as an integer.)r�r�r��getintr$r�r��	getdoubler�rrrr�6s�z
 224  IntVar.getrr rrrrr"&r!r"c@r)	�	DoubleVarz!Value holder for float variables.gNcCr)a6Construct a float variable.
 225  
 226          MASTER can be given as master widget.
 227          VALUE is an optional value (defaults to 0.0)
 228          NAME is an optional Tcl name (defaults to PY_VARnum).
 229  
 230          If NAME matches an existing variable and VALUE is omitted
 231          then the existing value is retained.
 232          Nrr�rrrr�CrzDoubleVar.__init__cCs|j�|j�|j��S)z,Return the value of the variable as a float.)r�r$r�r�r�rrrr�O�z
DoubleVar.getrr rrrrr%?r!r%c@s2eZdZdZdZd
 233  dd�Zdd�ZeZdd	�ZdS)�
 234  BooleanVarz#Value holder for boolean variables.FNcCr)a:Construct a boolean variable.
 235  
 236          MASTER can be given as master widget.
 237          VALUE is an optional value (defaults to False)
 238          NAME is an optional Tcl name (defaults to PY_VARnum).
 239  
 240          If NAME matches an existing variable and VALUE is omitted
 241          then the existing value is retained.
 242          Nrr�rrrr�XrzBooleanVar.__init__cCs|j�|j|j�|��Sr�)r�r�r�r�r�rrrr�d�zBooleanVar.setcCs0z|j�|j�|j��WStytd��w)z+Return the value of the variable as a bool.� invalid literal for getboolean())r�r�r�r�r�r�r�rrrr�js
 243  �zBooleanVar.getr)	rarbrcr�r�r�r�r�r�rrrrr'Ts
 244  r'cCstd�j�|�dS)zRun the main loop of Tcl.zrun the main loopN)r�r4�mainloop)r�rrrr*r�r*cCs*z	td�j�|�WStytd��w)z$Convert Tcl object to True or False.zuse getboolean()r))r�r4r�r�r��r�rrrr�|s
 245  �r�c@s�eZdZdZdZdZdd�Zdd�Z�d1dd�Zd	d
 246  �Z	dd�Z
 247  �d2dd�ZeZ�d1dd�Z
�d1dd�Z�d3dd�Z�d2dd�Zdd�Zdd�Zdd�Zdd �ZeZd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z�d1d/d0�Zd1d2�Zd3d4�Z�d4d6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(�d1dHdI�Z)dJdK�Z*dLdM�Z+�d1dNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/dVdW�Z0dXdY�Z1dZd[�Z2�d1d\d]�Z3�d1d^d_�Z4e4Z5�d4d`da�Z6�d4dbdc�Z7ddde�Z8dfdg�Z9dhdi�Z:djdk�Z;�d4dldm�Z<dndo�Z=dpdq�Z>drds�Z?dtdu�Z@dvdw�ZAdxdy�ZB�d4dzd{�ZCd|d}�ZDd~d�ZEd�d��ZFd�d��ZG�d4d�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^�d5d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d„Zfd�dĄZgd�dƄZhd�dȄZid�dʄZj�d1d�d̄Zk�d6d�dτZl�d7d�dфZm�d1d�dӄZn�d7d�dՄZod�dׄZp�d7d�dلZqd�dۄZr�d4d�d݄Zsd�d߄Ztd�d�Zud�d�Zvd�d�Zwd�d�Zxeyd�d��Zz�d1d�d�Z{d�d�Z|e|Z}�d8d�d�Z~e~Zd�d�Z�d�Z�d�e��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z��d1d�d��Z�e�Z��d�d�Z�e�Z��d�d�Z��d�d�Z��d�d�Z��d�d	�Z��d
 248  gZ�e�f�d�d�Z�e�Z��d
�d�Z�e�Z��d�d�Z��d1�d�d�Z�e�Z��d9�d�d�Z�e�Z��d�d�Z��d�d�Z�if�d�d�Z�e�Z��d�d�Z�e�f�d�d�Z�if�d�d �Z�e�Z��d!�d"�Z�e�Z��d:�d#�d$�Z��d%�d&�Z��d'�d(�Z��d)�d*�Z��d1�d+�d,�Z��d-�d.�Z��d/�d0�Z�dS(;�MisczRInternal class.
 249  
 250      Base class which defines methods common for interior widgets.NcCs0|jdur|jD]}|j�|�qd|_dSdS)zkInternal function.
 251  
 252          Delete all Tcl commands created for
 253          this widget in the Tcl interpreter.N)r�r4r�r�rrrr��s
 254  
 255  
 256  
 257  �zMisc.destroycCs4|j�|�z	|j�|�WdStyYdSw)zDInternal function.
 258  
 259          Delete the Tcl command provided in NAME.N)r4r�r�rr�r�rrrr��s�zMisc.deletecommandcC�|j�|j�dd|��S)z�Set Tcl internal variable, whether the look and feel
 260          should adhere to Motif.
 261  
 262          A parameter of 1 means adhere to Motif (e.g. no color
 263          change if mouse passes over slider).
 264          Returns the set value.r��tk_strictMotif)r4r�r��r��booleanrrrr/�s�zMisc.tk_strictMotifcC�|j�d�dS)zDChange the color scheme to light brown as used in Tk 3.6 and before.�	tk_bisqueN�r4r�r�rrrr3�rzMisc.tk_bisquecOs(|j�dt|�tt|�����dS)aSet a new color scheme for all widget elements.
 265  
 266          A single color as argument will cause that all colors of Tk
 267          widget elements are derived from this.
 268          Alternatively several keyword parameters and its associated
 269          colors can be given. The following keywords are valid:
 270          activeBackground, foreground, selectColor,
 271          activeForeground, highlightBackground, selectBackground,
 272          background, highlightColor, selectForeground,
 273          disabledForeground, insertBackground, troughColor.)�
tk_setPaletteN)r4r�rrr&�r��args�kwrrrr5�s
 274  �
 275  �zMisc.tk_setPaletter�cC�|j�dd|�dS)z�Wait until the variable is modified.
 276  
 277          A parameter of type IntVar, StringVar, DoubleVar or
 278          BooleanVar must be given.�tkwaitrNr4r�rrr�
wait_variable��zMisc.wait_variablecC�"|dur|}|j�dd|j�dS)zQWait until a WIDGET is destroyed.
 279  
 280          If no parameter is given self is used.Nr:�window�r4r��_w�r�r>rrr�wait_window�szMisc.wait_windowcCr=)zxWait until the visibility of a WIDGET changes
 281          (e.g. it appears).
 282  
 283          If no parameter is given self is used.Nr:�
 284  visibilityr?rArrr�wait_visibility�szMisc.wait_visibility�1cCs|j�||�dS)zSet Tcl variable NAME to VALUE.N)r4�setvar)r�r�r
 285  rrrrF��zMisc.setvarcCs|j�|�S)z"Return value of Tcl variable NAME.)r4�getvarr�rrrrH��zMisc.getvarc
 286  C�4z|j�|�WSty}ztt|���d}~wwr�)r4r#r�r�r�r�r��excrrrr#����zMisc.getintc
 287  CrJr�)r4r$r�r�rrKrrrr$�rMzMisc.getdoublecCs&z|j�|�WStytd��w)zPReturn a boolean value for Tcl boolean values true and false given as parameter.r))r4r�r�r�)r�r�rrrr��s
 288  �zMisc.getbooleancCs|j�d|j�dS)z�Direct input focus to this widget.
 289  
 290          If the application currently does not have the focus
 291          this widget will get the focus if the application gets
 292          the focus through the window manager.r�Nr?r�rrr�	focus_set��zMisc.focus_setcC�|j�dd|j�dS)ztDirect input focus to this widget even if the
 293          application does not have the focus. Use with
 294          caution!r�z-forceNr?r�rrr�focus_forceszMisc.focus_forcecCs&|j�d�}|dks|sdS|�|�S)z�Return the widget which has currently the focus in the
 295          application.
 296  
 297          Use focus_displayof to allow working with several
 298          displays. Return None if application does not have
 299          the focus.r��noneN)r4r��
_nametowidgetr�rrr�	focus_gets
 300  zMisc.focus_getcC�,|j�dd|j�}|dks|sdS|�|�S)z�Return the widget which has currently the focus on the
 301          display where this widget is located.
 302  
 303          Return None if the application does not have the focus.r��
 304  -displayofrRN�r4r�r@rSr�rrr�focus_displayofs
 305  zMisc.focus_displayofcCrU)zyReturn the widget which would have the focus if top level
 306          for this widget gets the focus from the window manager.r�z-lastforrRNrWr�rrr�
focus_lastfors
 307  zMisc.focus_lastforcCr2)zXThe widget under mouse will get automatically focus. Can not
 308          be disabled easily.�tk_focusFollowsMouseNr4r�rrrrZ!�zMisc.tk_focusFollowsMousecC�"|j�d|j�}|sdS|�|�S)anReturn the next widget in the focus order which follows
 309          widget which has currently the focus.
 310  
 311          The focus order first goes to the next child, then to
 312          the children of the child recursively and then to the
 313          next sibling which is higher in the stacking order.  A
 314          widget is omitted if it has the takefocus resource set
 315          to 0.�tk_focusNextNrWr�rrrr]&s	
 316  zMisc.tk_focusNextcCr\)zHReturn previous widget in the focus order. See tk_focusNext for details.�tk_focusPrevNrWr�rrrr^3s
 317  zMisc.tk_focusPrevcsr�dur
�j�d|�dS����fdd�}z�j|_Wnty+t��j|_Ynw��|���j�d|��S)aCall function once after given time.
 318  
 319          MS specifies the time in milliseconds. FUNC gives the
 320          function which shall be called. Additional parameters
 321          are given as parameters to the function call.  Return
 322          identifier to cancel scheduling with after_cancel.N�aftercsTz���Wz����WdStyYdSwz����Wwty)Ywwr�)r�r�r�r7�funcr�r�rr�callitEs
 323  ���zMisc.after.<locals>.callit)r4r�rar#r!r�)r��msrar7rbrr`rr_9s�
 324  z
 325  Misc.aftercGs|jd|g|�R�S)z�Call FUNC once if the Tcl main loop has no event to
 326          process.
 327  
 328          Return an identifier to cancel the scheduling with
 329          after_cancel.�idle)r_)r�rar7rrr�
 330  after_idleUrOzMisc.after_idlecCsb|std��z|j�dd|�}|j�|�d}|�|�Wn	ty&Ynw|j�dd|�dS)z�Cancel scheduling of function identified with ID.
 331  
 332          Identifier returned by after or after_idle must be
 333          given as first parameter.
 334          z?id must be a valid identifier returned from after or after_idler_r�r�cancelN)r�r4r�r0r�r�)r�r��data�scriptrrr�after_cancel]s�zMisc.after_cancelrcCs|j�d|�|��dS)zRing a display's bell.)�bellN)r4r��
 335  _displayof�r��	displayofrrrrjn�z	Misc.bellcKsbd|vr&|jdkr&zd|d<|j�d|�|��WSty%|d=Ynw|j�d|�|��S)a�Retrieve data from the clipboard on window's display.
 336  
 337          The window keyword defaults to the root window of the Tkinter
 338          application.
 339  
 340          The type keyword specifies the form in which the data is
 341          to be returned and should be an atom name such as STRING
 342          or FILE_NAME.  Type defaults to STRING, except on X11, where the default
 343          is to try UTF8_STRING and fall back to STRING.
 344  
 345          This command is equivalent to:
 346  
 347          selection_get(CLIPBOARD)
 348          r!�x11�UTF8_STRING)�	clipboardr�)�_windowingsystemr4r��_optionsr��r�r8rrr�
clipboard_getss
 349  �zMisc.clipboard_getcK�,d|vr	|j|d<|j�d|�|��dS)z�Clear the data in the Tk clipboard.
 350  
 351          A widget specified for the optional displayof keyword
 352          argument specifies the target display.rm)rq�clearN�r@r4r�rsrtrrr�clipboard_clear�szMisc.clipboard_clearcKs4d|vr	|j|d<|j�d|�|�d|f�dS)z�Append STRING to the Tk clipboard.
 353  
 354          A widget specified at the optional displayof keyword
 355          argument specifies the target display. The clipboard
 356          can be retrieved with selection_get.rm)rqr��--Nrx)r��stringr8rrr�clipboard_append�s
 357  �zMisc.clipboard_appendcCs$|j�dd|j�}|s
dS|�|�S)zOReturn widget which has currently the grab in this application
 358          or None.�grab�currentNrWr�rrr�grab_current�s
 359  zMisc.grab_currentcCrP)z.Release grab for this widget if currently set.r}�releaseNr?r�rrr�grab_release�r&zMisc.grab_releasecCrP)zwSet grab for this widget.
 360  
 361          A grab directs all events to this and descendant
 362          widgets in the application.r}r�Nr?r�rrr�grab_set��z
Misc.grab_setcCs|j�ddd|j�dS)z�Set global grab for this widget.
 363  
 364          A global grab directs all events to this and
 365          descendant widgets on the display. Use with caution -
 366          other applications do not get events anymore.r}r�z-globalNr?r�rrr�grab_set_global��zMisc.grab_set_globalcCs"|j�dd|j�}|dkrd}|S)zYReturn None, "local" or "global" if this widget has
 367          no, a local or a global grab.r}�statusrRNr?)r�r�rrr�grab_status�szMisc.grab_statuscCs|j�dd|||�dS)z�Set a VALUE (second parameter) for an option
 368          PATTERN (first parameter).
 369  
 370          An optional third parameter gives the numeric priority
 371          (defaults to 80).�optionr�Nr4)r��patternr
 372  �priorityrrr�
 373  option_add�r�zMisc.option_addcC�|j�dd�dS)zPClear the option database.
 374  
 375          It will be reloaded if option_add is called.r�rwNr4r�rrr�option_clear��zMisc.option_clearcC�|j�dd|j||�S)z�Return the value for an option NAME for this widget
 376          with CLASSNAME.
 377  
 378          Values with higher priority override lower values.r�r�r?)r�r��	classNamerrr�
 379  option_get�r�zMisc.option_getcCs|j�dd||�dS)zvRead file FILENAME into the option database.
 380  
 381          An optional second parameter gives the numeric
 382          priority.r��readfileNr4)r��fileNamer�rrr�option_readfile�r�zMisc.option_readfilecKrv)zClear the current X selection.rm)�	selectionrwNrxrtrrr�selection_clear�szMisc.selection_clearcKstd|vr	|j|d<d|vr/|jdkr/zd|d<|j�d|�|��WSty.|d=Ynw|j�d|�|��S)a�Return the contents of the current X selection.
 383  
 384          A keyword parameter selection specifies the name of
 385          the selection and defaults to PRIMARY.  A keyword
 386          parameter displayof specifies a widget on the display
 387          to use. A keyword parameter type specifies the form of data to be
 388          fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
 389          before STRING.rmr!rorp)r�r�)r@rrr4r�rsr�rtrrr�
selection_get�s	
 390  �zMisc.selection_getcKs.|�|�}|j�d|�|�|j|f�dS)aSpecify a function COMMAND to call if the X
 391          selection owned by this widget is queried by another
 392          application.
 393  
 394          This function must return the contents of the
 395          selection. The function will be called with the
 396          arguments OFFSET and LENGTH which allows the chunking
 397          of very long selections. The following keyword
 398          parameters can be provided:
 399          selection - name of the selection (default PRIMARY),
 400          type - type of the selection (e.g. STRING, FILE_NAME).)r��handleN)r�r4r�rsr@)r��commandr8r�rrr�selection_handle�s
 401  
 402  �zMisc.selection_handlecKs"|j�d|�|�|jf�dS)z�Become owner of X selection.
 403  
 404          A keyword parameter selection specifies the name of
 405          the selection (default PRIMARY).�r��ownN)r4r�rsr@rtrrr�
selection_owns
 406  �
 407  �zMisc.selection_owncKs:d|vr	|j|d<|j�d|�|��}|sdS|�|�S)z�Return owner of X selection.
 408  
 409          The following keyword parameter can
 410          be provided:
 411          selection - name of the selection (default PRIMARY),
 412          type - type of the selection (e.g. STRING, FILE_NAME).rmr�N)r@r4r�rsrS)r�r8r�rrr�selection_own_get	s
 413  zMisc.selection_own_getcGs|j�d||f|�S)zDSend Tcl command CMD to different interpreter INTERP to be executed.�sendr4)r��interp�cmdr7rrrr�r&z	Misc.sendcC�|j�d|j|�dS)z(Lower this widget in the stacking order.�lowerNr?)r��	belowThisrrrr�r&z
 414  Misc.lowercCr�)z(Raise this widget in the stacking order.�raiseNr?)r��	aboveThisrrr�tkraiser&zMisc.tkraisecCs(d|�|�|f}|j�|j�|��S)z*Return integer which represents atom NAME.)�winfo�atom)rkr4r#r�)r�r�rmr7rrr�
 415  winfo_atom#szMisc.winfo_atomcC� d|�|�|f}|j�|�S)z'Return name of atom with identifier ID.)r��atomname�rkr4r��r�r�rmr7rrr�winfo_atomname(���zMisc.winfo_atomnamecC�|j�|j�dd|j��S)z7Return number of cells in the colormap for this widget.r��cells�r4r#r�r@r�rrr�winfo_cells.��zMisc.winfo_cellsc	CsNg}|j�|j�dd|j��D]}z
 416  |�|�|��Wqty$Yqw|S)z?Return a list of all widgets which are children of this widget.r��children)r4r0r�r@r�rS�KeyError)r��result�childrrr�winfo_children3s��zMisc.winfo_childrencC�|j�dd|j�S)z(Return window class name of this widget.r��classr?r�rrr�winfo_class@rGzMisc.winfo_classcCr�)z?Return True if at the last color request the colormap was full.r��colormapfull�r4r�r�r@r�rrr�winfo_colormapfullDr�zMisc.winfo_colormapfullcCs4d|�|�||f}|j�|�}|sdS|�|�S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.)r��
 417  containingN)rkr4r�rS)r��rootX�rootYrmr7r�rrr�winfo_containingIs��
 418  zMisc.winfo_containingcCr�)z$Return the number of bits per pixel.r��depthr�r�rrr�winfo_depthQrnzMisc.winfo_depthcCr�)z"Return true if this widget exists.r�r�r�r�rrr�winfo_existsUr�zMisc.winfo_existscC�|j�|j�dd|j|��S)zWReturn the number of pixels for the given distance NUMBER
 419          (e.g. "3c") as float.r��fpixels�r4r$r�r@�r��numberrrr�
winfo_fpixelsZ�
 420  �zMisc.winfo_fpixelscCr�)zFReturn geometry string for this widget in the form "widthxheight+X+Y".r��geometryr?r�rrr�winfo_geometry`rGzMisc.winfo_geometrycCr�)zReturn height of this widget.r�r�r�r�rrr�winfo_heightdr�zMisc.winfo_heightcCst|j�dd|j�d�S)z%Return identifier ID for this widget.r�r�r)r�r4r�r@r�rrr�winfo_idir(z
Misc.winfo_idcCs"d|�|�}|j�|j�|��S)z9Return the name of all Tcl interpreters for this display.)r��interps)rkr4r0r�)r�rmr7rrr�
winfo_interpsmszMisc.winfo_interpscCr�)z%Return true if this widget is mapped.r��ismappedr�r�rrr�winfo_ismappedrr�zMisc.winfo_ismappedcCr�)z/Return the window manager name for this widget.r��managerr?r�rrr�
winfo_managerwrGzMisc.winfo_managercCr�)zReturn the name of this widget.r�r�r?r�rrr�
 421  winfo_name{rGzMisc.winfo_namecCr�)z-Return the name of the parent of this widget.r��parentr?r�rrr�winfo_parentrGzMisc.winfo_parentcCr�)z.Return the pathname of the widget given by ID.)r��pathnamer�r�rrr�winfo_pathname�r�zMisc.winfo_pathnamecCr�)z'Rounded integer value of winfo_fpixels.r��pixelsr�r�rrr�winfo_pixels���zMisc.winfo_pixelscCr�)z:Return the x coordinate of the pointer on the root window.r��pointerxr�r�rrr�winfo_pointerx�r�zMisc.winfo_pointerxcC�|�|j�dd|j��S)zHReturn a tuple of x and y coordinates of the pointer on the root window.r��	pointerxy��_getintsr4r�r@r�rrr�winfo_pointerxy�s�zMisc.winfo_pointerxycCr�)z:Return the y coordinate of the pointer on the root window.r��pointeryr�r�rrr�winfo_pointery�r�zMisc.winfo_pointerycCr�)z'Return requested height of this widget.r��	reqheightr�r�rrr�winfo_reqheight�r�zMisc.winfo_reqheightcCr�)z&Return requested width of this widget.r��reqwidthr�r�rrr�winfo_reqwidth�r�zMisc.winfo_reqwidthcC�|�|j�dd|j|��S)zNReturn a tuple of integer RGB values in range(65536) for color in this widget.r��rgbr�)r��colorrrr�	winfo_rgb�s�zMisc.winfo_rgbcCr�)zSReturn x coordinate of upper left corner of this widget on the
 422          root window.r��rootxr�r�rrr�winfo_rootx���zMisc.winfo_rootxcCr�)zSReturn y coordinate of upper left corner of this widget on the
 423          root window.r��rootyr�r�rrr�winfo_rooty�r�zMisc.winfo_rootycCr�)z&Return the screen name of this widget.r��screenr?r�rrr�winfo_screen�rGzMisc.winfo_screencCr�)zTReturn the number of the cells in the colormap of the screen
 424          of this widget.r��screencellsr�r�rrr�winfo_screencells�r�zMisc.winfo_screencellscCr�)z\Return the number of bits per pixel of the root window of the
 425          screen of this widget.r��screendepthr�r�rrr�winfo_screendepth�r�zMisc.winfo_screendepthcCr�)zXReturn the number of pixels of the height of the screen of this widget
 426          in pixel.r��screenheightr�r�rrr�winfo_screenheight�r�zMisc.winfo_screenheightcCr�)zUReturn the number of pixels of the height of the screen of
 427          this widget in mm.r��screenmmheightr�r�rrr�winfo_screenmmheight�r�zMisc.winfo_screenmmheightcCr�)zTReturn the number of pixels of the width of the screen of
 428          this widget in mm.r��
screenmmwidthr�r�rrr�winfo_screenmmwidth�r�zMisc.winfo_screenmmwidthcCr�)z�Return one of the strings directcolor, grayscale, pseudocolor,
 429          staticcolor, staticgray, or truecolor for the default
 430          colormodel of this screen.r��screenvisualr?r�rrr�winfo_screenvisual�r�zMisc.winfo_screenvisualcCr�)zWReturn the number of pixels of the width of the screen of
 431          this widget in pixel.r��screenwidthr�r�rrr�winfo_screenwidth�r�zMisc.winfo_screenwidthcCr�)zxReturn information of the X-Server of the screen of this widget in
 432          the form "XmajorRminor vendor vendorVersion".r��serverr?r�rrr�winfo_server��zMisc.winfo_servercCr�)z*Return the toplevel widget of this widget.r��toplevel)rSr4r�r@r�rrr�winfo_toplevel�s
 433  �zMisc.winfo_toplevelcCr�)zBReturn true if the widget and all its higher ancestors are mapped.r��viewabler�r�rrr�winfo_viewable�r�zMisc.winfo_viewablecCr�)z�Return one of the strings directcolor, grayscale, pseudocolor,
 434          staticcolor, staticgray, or truecolor for the
 435          colormodel of this widget.r��visualr?r�rrr�winfo_visual�r�zMisc.winfo_visualcCr�)z7Return the X identifier for the visual for this widget.r��visualidr?r�rrr�winfo_visualid�rGzMisc.winfo_visualidFcsH�j�dd�j|rdnd�}�fdd��j�|�D�}�fdd�|D�S)z�Return a list of all visuals available for the screen
 436          of this widget.
 437  
 438          Each item in the list consists of a visual name (see winfo_visual), a
 439          depth and if includeids is true is given also the X identifier.r��visualsavailable�
 440  includeidsNcrr)r4r0rr�rrrrz/Misc.winfo_visualsavailable.<locals>.<listcomp>c�g|]}��|��qSr)�_Misc__winfo_parseitemrr�rrr�)r4r�r@r0)r�rrgrr�r�winfo_visualsavailable�s
 441  
 442  �zMisc.winfo_visualsavailablecCs$|dd�tt|j|dd���S)rNr)rr�_Misc__winfo_getint)r�r7rrr�__winfo_parseitem
 443  s$zMisc.__winfo_parseitemcCs
 444  t|d�S)rr)r��r�r�rrr�__winfo_getint�
 445  zMisc.__winfo_getintcCr�)z�Return the height of the virtual root window associated with this
 446          widget in pixels. If there is no virtual root window return the
 447          height of the screen.r��vrootheightr�r�rrr�winfo_vrootheight��zMisc.winfo_vrootheightcCr�)z�Return the width of the virtual root window associated with this
 448          widget in pixel. If there is no virtual root window return the
 449          width of the screen.r��
 450  vrootwidthr�r�rrr�winfo_vrootwidthrzMisc.winfo_vrootwidthcCr�)ziReturn the x offset of the virtual root relative to the root
 451          window of the screen of this widget.r��vrootxr�r�rrr�winfo_vrootx r�zMisc.winfo_vrootxcCr�)ziReturn the y offset of the virtual root relative to the root
 452          window of the screen of this widget.r��vrootyr�r�rrr�winfo_vrooty&r�zMisc.winfo_vrootycCr�)z Return the width of this widget.r�r�r�r�rrr�winfo_width,r�zMisc.winfo_widthcCr�)zVReturn the x coordinate of the upper left corner of this widget
 453          in the parent.r�r�r�r�rrr�winfo_x1r�zMisc.winfo_xcCr�)zVReturn the y coordinate of the upper left corner of this widget
 454          in the parent.r�r�r�r�rrr�winfo_y7r�zMisc.winfo_ycCr2)zEEnter event loop until all pending events have been processed by Tcl.r"Nr4r�rrrr"=rzMisc.updatecCr�)z�Enter event loop until all idle callbacks have been called. This
 455          will update the display of windows but not process events caused by
 456          the user.r"�	idletasksNr4r�rrr�update_idletasksAr�zMisc.update_idletaskscCs6|dur|j�|j�d|j��S|j�d|j|�dS)a,Set or get the list of bindtags for this widget.
 457  
 458          With no argument return the list of all bindtags associated with
 459          this widget. With a list of strings as argument the bindtags are
 460          set to this list. The bindtags determine in which order events are
 461          processed (see bind).N�bindtags�r4r0r�r@)r��tagListrrrr+Gs
 462  �z
Misc.bindtagsrcCs�t|t�r|j�|||f�dS|r3|�||j|�}d|r dp!d||jf}|j�|||f�|S|r>|j�||f�S|j�|j�|��S)rz"%sif {"[%s %s]" == "break"} break
 463  �+r�N)rrr4r�r��_substitute�_subst_format_strr0)r�r��sequencerar��needcleanup�funcidr�rrr�_bindTs 
 464  
 465  �
 466  ��z
 467  Misc._bindcCs|�d|jf|||�S)aOBind to this widget at event SEQUENCE a call to function FUNC.
 468  
 469          SEQUENCE is a string of concatenated event
 470          patterns. An event pattern is of the form
 471          <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
 472          of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
 473          Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
 474          B3, Alt, Button4, B4, Double, Button5, B5 Triple,
 475          Mod1, M1. TYPE is one of Activate, Enter, Map,
 476          ButtonPress, Button, Expose, Motion, ButtonRelease
 477          FocusIn, MouseWheel, Circulate, FocusOut, Property,
 478          Colormap, Gravity Reparent, Configure, KeyPress, Key,
 479          Unmap, Deactivate, KeyRelease Visibility, Destroy,
 480          Leave and DETAIL is the button number for ButtonPress,
 481          ButtonRelease and DETAIL is the Keysym for KeyPress and
 482          KeyRelease. Examples are
 483          <Control-Button-1> for pressing Control and mouse button 1 or
 484          <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
 485          An event pattern can also be a virtual event of the form
 486          <<AString>> where AString can be arbitrary. This
 487          event can be generated by event_generate.
 488          If events are concatenated they must appear shortly
 489          after each other.
 490  
 491          FUNC will be called if the event sequence occurs with an
 492          instance of Event as argument. If the return value of FUNC is
 493          "break" no further bound function is invoked.
 494  
 495          An additional boolean parameter ADD specifies whether FUNC will
 496          be called additionally to the other bound function or whether
 497          it will replace the previous function.
 498  
 499          Bind will return an identifier to allow deletion of the bound function with
 500          unbind without memory leak.
 501  
 502          If FUNC or SEQUENCE is omitted the bound function or list
 503          of bound events are returned.�bind�r4r@�r�r1rar�rrrr5fs'z	Misc.bindcCs*|j�d|j|d�|r|�|�dSdS)zWUnbind for this widget for event SEQUENCE  the
 504          function identified with FUNCID.r5r�N�r4r�r@r�)r�r1r3rrr�unbind�s�zMisc.unbindcCs|�d|||d�S)aBind to all widgets at an event SEQUENCE a call to function FUNC.
 505          An additional boolean parameter ADD specifies whether FUNC will
 506          be called additionally to the other bound function or whether
 507          it will replace the previous function. See bind for the return value.)r5�allr�r4r7rrr�bind_all��z
Misc.bind_allcCs|j�dd|d�dS)z8Unbind for all widgets for event SEQUENCE all functions.r5r:r�Nr4)r�r1rrr�
 508  unbind_all�r&zMisc.unbind_allcCs|�d|f|||d�S)a=Bind to widgets with bindtag CLASSNAME at event
 509          SEQUENCE a call of function FUNC. An additional
 510          boolean parameter ADD specifies whether FUNC will be
 511          called additionally to the other bound function or
 512          whether it will replace the previous function. See bind for
 513          the return value.r5rr;)r�r�r1rar�rrr�
 514  bind_class��zMisc.bind_classcCs|j�d||d�dS)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE
 515          all functions.r5r�Nr4)r�r�r1rrr�unbind_class��zMisc.unbind_classcCs|j�|�dS)zCall the mainloop of Tk.N)r4r*)r�r�rrrr*�rz
Misc.mainloopcCs|j��dS)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r4�quitr�rrrrC�r�z	Misc.quitcC�"|rtt|jj|j�|���SdSr�)rrr4r#r0�r�r{rrrr����z
Misc._getintscCrDr�)rrr4r$r0rErrr�_getdoubles�rFzMisc._getdoublescCs|r|j�|�SdSr�)r4r�rErrr�_getboolean�s�zMisc._getbooleancCs"|rd|fS|durd|jfSdS)rrVNr�r@rlrrrrk�s
 516  
 517  zMisc._displayofcCs<z|��jWSty|j�dd�}|��_|YSw)rr4�windowingsystem)r��_windowingsystem_cachedr#r4r�)r��wsrrrrr�s��zMisc._windowingsystemcCs�|r	t||f�}nt|�}d}|��D]T\}}|durg|ddkr'|dd�}t|�r1|�|�}n.t|ttf�r_g}|D]}t|t�rK|�t	|��q<t|t	�rX|�t
 518  |��q<nd�|�}|d||f}q|S)rrN������_rr/)r-r&�callabler�rrrr�r�rrr)r�r(r8rr+r,�nvrrrrrs�s*
 519  
 520  
 521  �z
Misc._optionscCsPt|��d�}|}|ds|��}|dd�}|D]}|s |S|j|}q|S)zPReturn the Tkinter instance of a widget identified by
 522          its Tcl name NAME.�.rrN)r�splitr�r�)r�r��wr�rrr�nametowidget�s�zMisc.nametowidgetcCs�t|||�j}tt|��}z|j}Wn	tyYnwz||j}Wn	ty,Ynw|j�||�|rD|j	dur>g|_	|j	�
 523  |�|S)z�Return a newly created Tcl function. If this
 524          function is called, the Python function FUNC will
 525          be executed. An optional function SUBST can
 526          be given which will be executed before FUNC.N)r�r�r�r�r�r#rar4r�r�r�)r�ra�substr2r�r�rrrr�s$
 527  ��
 528  zMisc._registercCs"|}|jdur|j}|jdus|Sr�r�)r�rSrrrr�sz
 529  Misc._root)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%Drcs�t|�t|j�kr|S|jj}|jj��fdd�}|\}}}}}}	}
 530  }}}
}}}}}}}}}t�}�|�|_||�|_z||�|_Wn	t	yKYnw||�|_
 531  ||�|_||	�|_||
 532  �|_
||�|_||�|_||
�|_||_z||�|_Wn	t	y�Ynw||_||�|_zt|�|_Wnty�||_Ynwz|�|�|_Wnty�||_Ynw||�|_||�|_z	�|�|_W|fStt	fy�d|_Y|fSw)rc	s&z�|�WSttfy|YSw)z?Tk changed behavior in 8.4.2, returning "??" rather more often.)r�r�r,�r#rr�getint_event.s
 533  
 534  �z&Misc._substitute.<locals>.getint_eventr)r�
_subst_formatr4r�r#r��serialr�r�r�r�r�r��timer�r�r�r�r�r��
 535  keysym_numr;r!r�rS�widgetr��x_root�y_rootr�)r�r7r�rW�nsign�br��hr+r�r7rSr�r��A�E�K�N�W�T�X�Y�D�errVrr/(sR*
 536  
 537  
 538  
 539  
 540  
 541  
 542  
 543  
 544  
 545  
 546  �
 547  �
 548  
 549  ��zMisc._substitutecCs(t��\}}}|��}|�|||�dSr�)�sys�exc_infor��report_callback_exception)r�rL�val�tbr�rrr�_report_exceptioneszMisc._report_exceptioncGs\i}|j�|jj|��D]}|j�|�}|ddd�f|dd�||ddd�<q|S)z;Call Tcl configure command and return the result as a dict.rrN�r4r0r�)r�r7r(r�rrr�
_getconfigureks
 550  0zMisc._getconfigurecGs2|j�|jj|��}|ddd�f|dd�S)Nrrrr)r�r7r�rrr�_getconfigure1sszMisc._getconfigure1cCs�|r	t||f�}n|rt|�}|dur|�t|j|f��St|t�r/|�t|j|d|f��S|j�t|j|f�|�	|��dS)rNr/)
 551  r-rsrr@rrrtr4r�rs)r�r�r(r8rrr�
 552  _configurews
 553  $zMisc._configurecK�|�d||�S)z�Configure resources of a widget.
 554  
 555          The values for resources are specified as keyword
 556          arguments. To get an overview about
 557          the allowed keyword arguments call the method keys.
 558          �	configure�ru�r�r(r8rrrrw�szMisc.configurecC�|j�|jdd|�S)z4Return the resource value for a KEY given as string.�cgetr/r?�r�r9rrrr{�r&z	Misc.cgetcCs|�||i�dSr�)rw�r�r9r
 559  rrr�__setitem__�szMisc.__setitem__cs*|jj��fdd��|j�|jd��D�S)z3Return a list of all resource names of this widget.cs g|]}�|�ddd��qS)rrNrrrrrr�s zMisc.keys.<locals>.<listcomp>rwr,r�rrrr��s
 560  �z	Misc.keyscCr�)z+Return the window path name of this widget.rIr�rrrr��r�zMisc.__str__cCsd|jj|jj|jfS)Nz<%s.%s object %s>)rrbrcr@r�rrrr��s�z
Misc.__repr__�_noarg_cC�:|tjur|�|j�dd|j��S|j�dd|j|�dS)aSet or get the status for propagation of geometry information.
 561  
 562          A boolean argument specifies whether the geometry information
 563          of the slaves will determine the size of this widget. If no argument
 564          is given the current setting will be returned.
 565          �pack�	propagateN�r-rrHr4r�r@�r��flagrrr�pack_propagate��
 566  
 567  
 568  �zMisc.pack_propagatecr)�HReturn a list of all slaves of this widget
 569          in its packing order.crr�rSrr�rrr�rz$Misc.pack_slaves.<locals>.<listcomp>r��slavesr,r�rr�r�pack_slaves�s
 570  
 571  ��zMisc.pack_slavescr)r�crrr�rr�rrr�rz%Misc.place_slaves.<locals>.<listcomp>�placer�r,r�rr�r�place_slaves�s
 572  ���zMisc.place_slavescCs|j�dd|j|�dS)z�The anchor value controls how to place the grid within the
 573          master when no row/column has any weight.
 574  
 575          The default anchor is nw.�grid�anchorNr?)r�r�rrr�grid_anchor��zMisc.grid_anchorcCsZdd|jf}|dur|dur|||f}|dur"|dur"|||f}|�|jj|��p,dS)a�Return a tuple of integer coordinates for the bounding
 576          box of this widget controlled by the geometry manager grid.
 577  
 578          If COLUMN, ROW is given the bounding box applies from
 579          the cell with row and column 0 to the specified
 580          cell. If COL2 and ROW2 are given the bounding box
 581          starts at that cell.
 582  
 583          The returned integers specify the offset of the upper left
 584          corner in the master widget and the width and height.
 585          r��bboxN)r@r�r4r�)r��column�row�col2�row2r7rrr�	grid_bbox�szMisc.grid_bboxc	Csdt|ttjf�r0zt|�}|sWdSd|vr|j�|�WS|j�|�WSttfy/Y|Sw|S)NrQ)	rr�_tkinter�Tcl_Objr4r$r#r�r�)r�r
 586  �svaluerrr�_gridconvvalue�s�zMisc._gridconvvaluecCs�t|t�r%|s%|dd�dkr|dd�}|dd�dkr!d|}|f}n|�||�}|s>t|j|j�d||j|�|jd�S|j�d||j|f|�}t|�dkrV|�|�SdS)rrMNrNrr/r�)r6)	rrrsr:r4r�r@r�r)r�r��indexr(r8�optionsrrrr�_grid_configure�s*���
 587  �zMisc._grid_configurecK�|�d|||�S)z�Configure column INDEX of a grid.
 588  
 589          Valid resources are minsize (minimum size of the column),
 590          weight (how much does additional space propagate to this column)
 591          and pad (how much space to let additionally).�columnconfigure�r��r�r�r(r8rrr�grid_columnconfigure
�zMisc.grid_columnconfigurec	Cs |�|j�dd|j||��pdS)z�Return a tuple of column and row which identify the cell
 592          at which the pixel at position X and Y inside the master
 593          widget is located.r��locationNr��r�r�r�rrr�
grid_locations���zMisc.grid_locationcCr�)aSet or get the status for propagation of geometry information.
 594  
 595          A boolean argument specifies whether the geometry information
 596          of the slaves will determine the size of this widget. If no argument
 597          is given, the current setting will be returned.
 598          r�r�Nr�r�rrr�grid_propagater�zMisc.grid_propagatecKr�)z�Configure row INDEX of a grid.
 599  
 600          Valid resources are minsize (minimum size of the row),
 601          weight (how much does additional space propagate to this row)
 602          and pad (how much space to let additionally).�rowconfigurer�r�rrr�grid_rowconfigure,r�zMisc.grid_rowconfigurecCs|�|j�dd|j��p
dS)z<Return a tuple of the number of column and rows in the grid.r��sizeNr�r�rrr�	grid_size6s
 603  ��zMisc.grid_sizecsZd}|dur|d|f}|dur|d|f}�fdd��j��j�dd�jf|��D�S)	r�rNz-rowz-columncrrr�rr�rrrErz$Misc.grid_slaves.<locals>.<listcomp>r�r�r,)r�r�r�r7rr�r�grid_slaves=s
 604  ��zMisc.grid_slavescG�dd|f|}|j�|�dS)z�Bind a virtual event VIRTUAL (of the form <<Name>>)
 605          to an event SEQUENCE such that the virtual event is triggered
 606          whenever SEQUENCE occurs.�eventr�Nr4�r��virtual�	sequencesr7rrr�	event_addLszMisc.event_addcGr�)z-Unbind a virtual event VIRTUAL from SEQUENCE.r��deleteNr4r�rrr�event_deleteSszMisc.event_deletecKsDdd|j|f}|��D]\}}|d|t|�f}q|j�|�dS)z�Generate an event SEQUENCE. Additional
 607          keyword arguments specify parameter of the event
 608          (e.g. x, y, rootx, rooty).r��generate�-%sN)r@r&rr4r�)r�r1r8r7r+r,rrr�event_generateXszMisc.event_generatecCr.)zuReturn a list of all virtual events or the information
 609          about the SEQUENCE bound to the virtual event VIRTUAL.r�r�rr)r�r�rrr�
 610  event_infoa��zMisc.event_infocC�|j�|j�dd��S)z*Return a list of all existing image names.�image�namesrrr�rrr�image_namesir&zMisc.image_namescCr�)z?Return a list of all available image types (e.g. photo bitmap).r��typesrrr�rrr�image_typesmr&zMisc.image_typesr�)r�)r�rE�r�F)rr)Nr�NNNN�NN)�rarbrcr��_last_child_idsr�r�r�r/r3r5r;�waitvarrBrDrFrHr#r$r�rNr�rQrTrXrYrZr]r^r_rerirjruryr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��liftr�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�rrrrrrr
rrrrrrr!r#r%r&r'r(r"r*r+r4r5r9r<r>r?rAr*rCr�rGrHrk�propertyrrrsrTrSr��registerr�rXrr0r/rqrsrtrurw�configr{�__getitem__r~r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr-�sR
 611  		


)
 612  
 613  	
 614  =
	

 615  
	r-c@s eZdZdZdd�Zdd�ZdS)r�zwInternal class. Stores function to call when some user
 616      defined Tcl function is called e.g. after an event occurred.cCs||_||_||_dS)z(Store FUNC, SUBST and WIDGET as members.N)rarUr\)r�rarUr\rrrr�vs
 617  zCallWrapper.__init__cGsBz|jr	|j|�}|j|�WSty�|j��YdS)z3Apply first function SUBST to arguments, than FUNC.N)rUrar�r\rq�r�r7rrrr�|s
 618  zCallWrapper.__call__N�rarbrcr�r�r�rrrrr�rsr�c@�(eZdZdZdd�Zdd�Zdd�ZdS)	�XViewzXMix-in class for querying and changing the horizontal position
 619      of a widget's window.cG�*|jj|jdg|�R�}|s|�|�SdS)z5Query and change the horizontal position of the view.�xviewN�r4r�r@rG�r�r7rrrrr���
 620  �zXView.xviewcC�|j�|jdd|�dS)zsAdjusts the view in the window so that FRACTION of the
 621          total width of the canvas is off-screen to the left.r��movetoNr?�r��fractionrrr�xview_moveto��zXView.xview_movetocC�|j�|jdd||�dS)z\Shift the x-view according to NUMBER which is measured in "units"
 622          or "pages" (WHAT).r��scrollNr?�r�r�r�rrr�xview_scroll��zXView.xview_scrollN)rarbrcr�r�r�r�rrrrr���
 623  r�c@r�)	�YViewzVMix-in class for querying and changing the vertical position
 624      of a widget's window.cGr�)z3Query and change the vertical position of the view.�yviewNr�r�rrrr��r�zYView.yviewcCr�)zsAdjusts the view in the window so that FRACTION of the
 625          total height of the canvas is off-screen to the top.r�r�Nr?r�rrr�yview_moveto�r�zYView.yview_movetocCr�)z\Shift the y-view according to NUMBER which is measured in
 626          "units" or "pages" (WHAT).r�r�Nr?r�rrr�yview_scroll�r�zYView.yview_scrollN)rarbrcr�r�r�r�rrrrr��r�r�c@s�eZdZdZ		dBdd�ZeZdd�ZeZdCdd�ZeZ	d	d
 627  �Z
 628  e
 629  ZdCdd�ZeZ
d
d�ZeZdCdd�ZeZdd�ZeZdd�ZeZdCdd�ZeZ		dBdd�ZeZdCdd�ZeZdDdd�ZeZdd�ZeZdCdd �Z e Z!dCd!d"�Z"e"Z#dEd$d%�Z$e$Z%dDd&d'�Z&e&Z'dCd(d)�Z(e(Z)d*d+�Z*e*Z+dDd,d-�Z,e,Z-dDd.d/�Z.e.Z/dCd0d1�Z0e0Z1dCd2d3�Z2e2Z3dDd4d5�Z4e4Z5dDd6d7�Z6e6Z7dCd8d9�Z8e8Z9dCd:d;�Z:e:Z;dCd<d=�Z<e<Z=dCd>d?�Z>e>Z?d@dA�Z@e@ZAdS)F�WmzAProvides functions for the communication with the window manager.NcC� |�|j�dd|j||||��S)z�Instruct the window manager to set the aspect ratio (width/height)
 630          of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
 631          of the actual values if no argument is given.�wm�aspectr�)r��minNumer�minDenom�maxNumer�maxDenomrrr�	wm_aspect�s��zWm.wm_aspectcGsdd|jf|}|j�|�S)a�This subcommand returns or sets platform specific attributes
 632  
 633          The first form returns a list of the platform specific flags and
 634          their values. The second form returns the value for the specific
 635          option. The third form sets one or more of the values. The values
 636          are as follows:
 637  
 638          On Windows, -disabled gets or sets whether the window is in a
 639          disabled state. -toolwindow gets or sets the style of the window
 640          to toolwindow (as defined in the MSDN). -topmost gets or sets
 641          whether this is a topmost window (displays above all other
 642          windows).
 643  
 644          On Macintosh, XXXXX
 645  
 646          On Unix, there are currently no special attribute values.
 647          r��
 648  attributes)r@r4r�r�rrr�
wm_attributes�szWm.wm_attributescC�|j�dd|j|�S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return
 649          current value.r��clientr?r�rrr�	wm_client��zWm.wm_clientcsXt|�dkr	|f}dd�jf|}|r�j�|�dS�fdd��j��j�|��D�S)z�Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
 650          of this widget. This list contains windows whose colormaps differ from their
 651          parents. Return current list of widgets if WLIST is empty.rr��colormapwindowscrrr�rr�rrr�s�z)Wm.wm_colormapwindows.<locals>.<listcomp>N)rr@r4r�r0)r��wlistr7rr�r�wm_colormapwindows�s
 652  �zWm.wm_colormapwindowscCr�)z�Store VALUE in WM_COMMAND property. It is the command
 653          which shall be used to invoke the application. Return current
 654          command if VALUE is None.r�r�r?r�rrr�
 655  wm_command��z
Wm.wm_commandcCr�)z�Deiconify this widget. If it was never mapped it will not be mapped.
 656          On Windows it will raise this widget and give it the focus.r��	deiconifyr?r�rrr�wm_deiconify�r	zWm.wm_deiconifycCr�)z�Set focus model to MODEL. "active" means that this widget will claim
 657          the focus itself, "passive" means that the window manager shall give
 658          the focus. Return current focus model if MODEL is None.r��
 659  focusmodelr?)r��modelrrr�
wm_focusmodel�r�zWm.wm_focusmodelcCr9)aAThe window will be unmapped from the screen and will no longer
 660          be managed by wm. toplevel windows will be treated like frame
 661          windows once they are no longer managed by wm, however, the menu
 662          option configuration will be remembered and the menus will return
 663          once the widget is managed again.r��forgetNr4rArrr�	wm_forgetrOzWm.wm_forgetcCr�)zAReturn identifier for decorative frame of this widget if present.r��framer?r�rrr�wm_framerGzWm.wm_framecCr�)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
 664          current value if None is given.r�r�r?)r��newGeometryrrr�wm_geometryr�zWm.wm_geometrycCr�)aInstruct the window manager that this widget shall only be
 665          resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
 666          height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
 667          number of grid units requested in Tk_GeometryRequest.r�r�r�)r��	baseWidth�
 668  baseHeight�widthInc�	heightIncrrr�wm_grids
 669  �z
 670  Wm.wm_gridcCr�)z~Set the group leader widgets for related widgets to PATHNAME. Return
 671          the group leader of this widget if None is given.r��groupr?�r��pathNamerrr�wm_group*r�zWm.wm_groupcCs.|r
|j�dd|jd|�S|j�dd|j|�S)a�Set bitmap for the iconified widget to BITMAP. Return
 672          the bitmap if None is given.
 673  
 674          Under Windows, the DEFAULT parameter can be used to set the icon
 675          for the widget and any descendants that don't have an icon set
 676          explicitly.  DEFAULT can be the relative path to a .ico file
 677          (example: root.iconbitmap(default='myicon.ico') ).  See Tk
 678          documentation for more information.r��
 679  iconbitmap�-defaultr?)r��bitmap�defaultrrr�
wm_iconbitmap1s	zWm.wm_iconbitmapcCr�)zDisplay widget as icon.r��iconifyr?r�rrr�
 680  wm_iconifyArGz
Wm.wm_iconifycCr�)zVSet mask for the icon bitmap of this widget. Return the
 681          mask if None is given.r��iconmaskr?)r�rrrr�wm_iconmaskGr�zWm.wm_iconmaskcCr�)zSSet the name of the icon for this widget. Return the name if
 682          None is given.r��iconnamer?)r��newNamerrr�wm_iconnameNr�zWm.wm_iconnameFcGsB|r|jjdd|jdg|�R�dS|jjdd|jg|�R�dS)a�Sets the titlebar icon for this window based on the named photo
 683          images passed through args. If default is True, this is applied to
 684          all future created toplevels as well.
 685  
 686          The data in the images is taken as a snapshot at the time of
 687          invocation. If the images are later changed, this is not reflected
 688          to the titlebar icons. Multiple images are accepted to allow
 689          different images sizes to be provided. The window manager may scale
 690          provided icons to an appropriate size.
 691  
 692          On Windows, the images are packed into a Windows icon structure.
 693          This will override an icon specified to wm_iconbitmap, and vice
 694          versa.
 695  
 696          On X, the images are arranged into the _NET_WM_ICON X property,
 697          which most modern window managers support. An icon specified by
 698          wm_iconbitmap may exist simultaneously.
 699  
 700          On Macintosh, this currently does nothing.r��	iconphotorNr?)r�rr7rrr�wm_iconphotoUs zWm.wm_iconphotoc	C�|�|j�dd|j||��S)z�Set the position of the icon of this widget to X and Y. Return
 701          a tuple of the current values of X and X if None is given.r��iconpositionr�r�rrr�wm_iconpositionps
 702  �zWm.wm_iconpositioncCr�)zgSet widget PATHNAME to be displayed instead of icon. Return the current
 703          value if None is given.r��
 704  iconwindowr?r
 705  rrr�
wm_iconwindowxr�zWm.wm_iconwindowcCr9)z�The widget specified will become a stand alone top-level window.
 706          The window will be decorated with the window managers title bar,
 707          etc.r��manageNr4)r�r\rrr�	wm_manager�zWm.wm_managec	Cr)z�Set max WIDTH and HEIGHT for this widget. If the window is gridded
 708          the values are given in grid units. Return the current values if None
 709          is given.r��maxsizer��r�r�r�rrr�
 710  wm_maxsize��
 711  �z
Wm.wm_maxsizec	Cr)z�Set min WIDTH and HEIGHT for this widget. If the window is gridded
 712          the values are given in grid units. Return the current values if None
 713          is given.r��minsizer�r#rrr�
 714  wm_minsize�r%z
Wm.wm_minsizecCr�)z�Instruct the window manager to ignore this widget
 715          if BOOLEAN is given with 1. Return the current value if None
 716          is given.r��overrideredirect)rHr4r�r@r0rrr�wm_overrideredirect�s
 717  
 718  �zWm.wm_overrideredirectcCr�)z�Instruct the window manager that the position of this widget shall
 719          be defined by the user if WHO is "user", and by its own policy if WHO is
 720          "program".r��positionfromr?�r��whorrr�wm_positionfrom�r�zWm.wm_positionfromcCs.t|�r
 721  |�|�}n|}|j�dd|j||�S)z�Bind function FUNC to command NAME for this widget.
 722          Return the function bound to NAME if None is given. NAME could be
 723          e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".r��protocol)rOr�r4r�r@)r�r�rar�rrr�wm_protocol�s�zWm.wm_protocolcCr�)zyInstruct the window manager whether this width can be resized
 724          in WIDTH or HEIGHT. Both values are boolean values.r��	resizabler?r#rrr�wm_resizable�rBzWm.wm_resizablecCr�)z�Instruct the window manager that the size of this widget shall
 725          be defined by the user if WHO is "user", and by its own policy if WHO is
 726          "program".r��sizefromr?r+rrr�wm_sizefrom�r�zWm.wm_sizefromcCr�)z�Query or set the state of this widget as one of normal, icon,
 727          iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).r�r�r?)r��newstaterrr�wm_state�r�zWm.wm_statecCr�)zSet the title of this widget.r��titler?rErrr�wm_title�r+zWm.wm_titlecCr�)z_Instruct the window manager that this widget is transient
 728          with regard to widget MASTER.r��	transientr?)r�r�rrr�wm_transient�r�zWm.wm_transientcCr�)z�Withdraw this widget from the screen such that it is unmapped
 729          and forgotten by the window manager. Re-draw it with wm_deiconify.r�r�r?r�rrr�wm_withdraw�r	zWm.wm_withdrawr�r�r�r�)Brarbrcr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�rr�rr	rr
rrrrrrrrrrrrr!r r$r"r'r&r)r(r-r*r/r.r1r0r3r2r5r�r7r6r9r8r:r�rrrrr��s�
 730  �
 731  
 732  
 733  
 734  
 735  �
 736  
 737  
 738  
 739  
 740  
 741  
 742  
 743  
 744  
 745  
 746  
 747  
 748  
 749  
 750  
 751  
 752  r�c@sReZdZdZdZ		ddd�Zdd	�Zd
 753  d�Zdd
�Zdd�Z	dd�Z
 754  dd�ZdS)r�zzToplevel widget of Tk which represents mostly the main window
 755      of an application. It has an associated Tcl interpreter.rQNTFc
 756  
 757  Cs�d|_i|_d|_d|_|dur-ddl}|j�tjd�}|j�	|�\}}|dvr-||}d}	t
 758  �||||	t|||�|_|rB|�
�tjjsN|�||�dSdS)aAReturn a new top level widget on screen SCREENNAME. A new Tcl interpreter will
 759          be created. BASENAME will be used for the identification of the profile file (see
 760          readprofile).
 761          It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
 762          is the name of the widget class.NFr)z.pyz.pyc)r�r��	_tkloadedr4�os�path�basenamerl�argv�splitextr��create�wantobjects�_loadtk�flags�ignore_environment�readprofile)
 763  r��
 764  screenName�baseNamer��useTk�sync�user<�ext�interactiverrrr��s"�zTk.__init__cCs |js|j��|��dSdSr�)r;r4�loadtkrCr�rrrrN	s
 765  �z	Tk.loadtkcCs�d|_|j�d�}|tjkrtdtj|f��t|j�d��}|tjkr-tdtj|f��|jdur5g|_|j�	dt
 766  �|j�	dt�|j�d�|j�d�t
rWtdurW|a|�d|j�dS)	NT�
 767  tk_versionz4tk.h version (%s) doesn't match libtk.a version (%s)�tcl_versionz6tcl.h version (%s) doesn't match libtcl.a version (%s)�tkerror�exit�WM_DELETE_WINDOW)r;r4rHr��
 768  TK_VERSIONr1r�TCL_VERSIONr�r�r�r�r�r�r�r.r�)r�rOrPrrrrC	s(
 769  �
 770  �
 771  z
 772  Tk._loadtkcCsRt|j���D]}|��q|j�d|j�t�|�tr%t	|ur'da	dSdSdS)zhDestroy this and all descendants widgets. This will
 773          end the application of this Tcl interpreter.r�N)
 774  rr��valuesr�r4r�r@r-r�r��r�r)rrrr�!	s
 775  �z
 776  Tk.destroyc
 777  Cs�ddl}d|jvr|jd}n|j}|j�|d|�}|j�|d|�}|j�|d|�}|j�|d|�}d|i}	td|	�|j�|�rL|j�d|�|j�|�r[tt	|��
 778  �|	�|j�|�rh|j�d|�|j�|�rytt	|��
 779  �|	�dSdS)	z�Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into
 780          the Tcl Interpreter and calls exec on the contents of .BASENAME.py and
 781          .CLASSNAME.py if such a file exists in the home directory.rN�HOMEz.%s.tclz.%s.pyr�zfrom tkinter import *�source)r<�environ�curdirr=r�exec�isfiler4r��open�read)
 782  r�rHr�r<�home�	class_tcl�class_py�base_tcl�base_py�dirrrrrF+	s$
 783  �zTk.readprofilecCs:ddl}tdtjd�|t_|t_|t_|�|||�dS)z�Report callback exception on sys.stderr.
 784  
 785          Applications may want to override this internal function, and
 786          should when sys.stderr is None.rNzException in Tkinter callback)�file)�	tracebackr%rl�stderr�	last_type�
 787  last_value�last_traceback�print_exception)r�rLrorprgrrrrnA	szTk.report_callback_exceptioncCst|j|�S)z3Delegate attribute access to the interpreter object)r�r4)r��attrrrr�__getattr__M	rIzTk.__getattr__)NNr�TFN)rarbrcr�r@r�rNrCr�rFrnrnrrrrr��s
 788  �
 789  r�FcCst||||�Sr�)r�)rGrHr�rIrrr�Tcl`	sroc@sTeZdZdZifdd�ZeZZZdd�ZeZ	dd�Z
 790  e
 791  Zej
ZZ
ejZZdS)	�PackzQGeometry manager Pack.
 792  
 793      Base class to use the methods pack_* in every widget.cK�$|j�dd|jf|�||��dS)a(Pack a widget in the parent widget. Use as options:
 794          after=widget - pack it after you have packed widget
 795          anchor=NSEW (or subset) - position widget according to
 796                                    given direction
 797          before=widget - pack it before you will pack widget
 798          expand=bool - expand widget if parent size grows
 799          fill=NONE or X or Y or BOTH - fill widget if widget grows
 800          in=master - use master to contain this widget
 801          in_=master - see 'in' option description
 802          ipadx=amount - add internal padding in x direction
 803          ipady=amount - add internal padding in y direction
 804          padx=amount - add padding in x direction
 805          pady=amount - add padding in y direction
 806          side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.
 807          r�rwN�r4r�r@rsryrrr�pack_configurei	s
 808  
 809  
 810  ��zPack.pack_configurecCrP)z:Unmap this widget and do not use it for the packing order.r�r�Nr?r�rrr�pack_forget	r&zPack.pack_forgetcC�8t|j|j�dd|j��}d|vr|�|d�|d<|S)zEReturn information about the packing options
 811          for this widget.r�r��in�r:r4r�r@rT�r��drrr�	pack_info�	�zPack.pack_infoN)rarbrcr�rsr�rwr�rtr�rzr�r-r�r�r�r�rrrrrpd	s
 812  rpc@sJeZdZdZifdd�ZeZZZdd�ZeZ	dd�Z
 813  e
 814  Zej
ZZ
dS)	�PlacezSGeometry manager Place.
 815  
 816      Base class to use the methods place_* in every widget.cKrq)a Place a widget in the parent widget. Use as options:
 817          in=master - master relative to which the widget is placed
 818          in_=master - see 'in' option description
 819          x=amount - locate anchor of this widget at position x of master
 820          y=amount - locate anchor of this widget at position y of master
 821          relx=amount - locate anchor of this widget between 0.0 and 1.0
 822                        relative to width of master (1.0 is right edge)
 823          rely=amount - locate anchor of this widget between 0.0 and 1.0
 824                        relative to height of master (1.0 is bottom edge)
 825          anchor=NSEW (or subset) - position anchor according to given direction
 826          width=amount - width of this widget in pixel
 827          height=amount - height of this widget in pixel
 828          relwidth=amount - width of this widget between 0.0 and 1.0
 829                            relative to width of master (1.0 is the same width
 830                            as the master)
 831          relheight=amount - height of this widget between 0.0 and 1.0
 832                             relative to height of master (1.0 is the same
 833                             height as the master)
 834          bordermode="inside" or "outside" - whether to take border width of
 835                                             master widget into account
 836          r�rwNrrryrrr�place_configure�	s
 837  
 838  
 839  ��zPlace.place_configurecCrP)�Unmap this widget.r�r�Nr?r�rrr�place_forget�	r&zPlace.place_forgetcCru)zEReturn information about the placing options
 840          for this widget.r�r�rvrwrxrrr�
 841  place_info�	r{zPlace.place_infoN)rarbrcr�r}r�rwr�rr�r�r�r-r�r�rrrrr|�	sr|c@s�eZdZdZifdd�ZeZZZej	Z
 842  Z	ejZZdd�Z
e
Zdd�Zdd	�ZeZejZZejZZejZZejZZejZZd
 843  S)�GridzQGeometry manager Grid.
 844  
 845      Base class to use the methods grid_* in every widget.cKrq)aPosition a widget in the parent widget in a grid. Use as options:
 846          column=number - use cell identified with given column (starting with 0)
 847          columnspan=number - this widget will span several columns
 848          in=master - use master to contain this widget
 849          in_=master - see 'in' option description
 850          ipadx=amount - add internal padding in x direction
 851          ipady=amount - add internal padding in y direction
 852          padx=amount - add padding in x direction
 853          pady=amount - add padding in y direction
 854          row=number - use cell identified with given row (starting with 0)
 855          rowspan=number - this widget will span several rows
 856          sticky=NSEW - if cell is larger on which sides will this
 857                        widget stick to the cell boundary
 858          r�rwNrrryrrr�grid_configure�	s
 859  
 860  
 861  ��zGrid.grid_configurecCrP)r~r�r�Nr?r�rrr�grid_forget�	r&zGrid.grid_forgetcCrP)z0Unmap this widget but remember the grid options.r�rNr?r�rrr�grid_remove�	r&zGrid.grid_removecCru)zSReturn information about the options
 862          for positioning this widget in a grid.r�r�rvrwrxrrr�	grid_info�	r{zGrid.grid_infoN)rarbrcr�r�r�rwr�r-r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��	s 
 863  
 864  
 865  
 866  
 867  
 868  r�c@s:eZdZdZdd�Ziidfdd�Zdd�Zdd	d
 869  �ZdS)
�
 870  BaseWidgetzInternal class.cCs�|durt�}||_|j|_d}d|vr|d}|d=|sI|jj��}|jdur+i|_|j�|d�d}||j|<|dkrCd|f}nd||f}||_|j	dkrWd||_	n|j	d||_	i|_
 871  |j|jj
 872  vrr|jj
 873  |j��||jj
 874  |j<dS)z6Internal function. Sets up information about children.Nr�rrz!%sz!%s%drQ)r�r�r4rrar�r�r�r�r@r�r�)r�r�r(r��countrrr�_setup�	s2
 875  
 876  
 877  zBaseWidget._setuprc	Cs�|rt||f�}||_|�||�|jdurg|_dd�|��D�}|D]\}}||=q$|j�||jf||�|��|D]
 878  \}}|�	||�q>dS)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME
 879          and appropriate options.NcSs"g|]
\}}t|t�r||f�qSr)rr!r�rrrr&
 880  s"z'BaseWidget.__init__.<locals>.<listcomp>)
 881  r-�
 882  widgetNamer�r�r&r4r�r@rsrw)	r�r�r�r(r8�extra�classesr+r,rrrr�
 883  s
 884  ��zBaseWidget.__init__cCsTt|j���D]}|��q|j�d|j�|j|jjvr#|jj|j=t	�|�dS)z)Destroy this and all descendants widgets.r�N)
 885  rr�rVr�r4r�r@r�r�r-rWrrrr�.
 886  s
 887  zBaseWidget.destroycCs|j�|j|f|�Sr�r?)r�r�r7rrr�_do6
 888  r&zBaseWidget._doN)r)rarbrcr�r�r�r�r�rrrrr��	sr�c@seZdZdZdS)�WidgetzxInternal class.
 889  
 890      Base class for a widget which can be positioned with the geometry managers
 891      Pack, Place or Grid.N)rarbrcr�rrrrr�;
 892  sr�c@�eZdZdZdifdd�ZdS)�Toplevelz"Toplevel widget, e.g. for dialogs.Nc	Ks�|rt||f�}d}dD]&}||vr2||}|ddkr%d|dd�}nd|}|||f}||=qt�||d|i|�|��}|�|���|�|���|�d|j�dS)	a%Construct a toplevel widget with the parent MASTER.
 893  
 894          Valid resource names: background, bd, bg, borderwidth, class,
 895          colormap, container, cursor, height, highlightbackground,
 896          highlightcolor, highlightthickness, menu, relief, screen, takefocus,
 897          use, visual, width.r)r��class_r�r�colormaprMrNr/Nr
 898  rS)r-r�r�r�rr6r.r�)	r�r�r(r8r��wmkeyro�optr�rrrr�F
 899  s �zToplevel.__init__�rarbrcr�r�rrrrr�C
 900  �r�c@s.eZdZdZdifdd�Zdd�Zdd�ZdS)	rhzButton widget.NcK�t�||d||�dS)aUConstruct a button widget with the parent MASTER.
 901  
 902          STANDARD OPTIONS
 903  
 904              activebackground, activeforeground, anchor,
 905              background, bitmap, borderwidth, cursor,
 906              disabledforeground, font, foreground
 907              highlightbackground, highlightcolor,
 908              highlightthickness, image, justify,
 909              padx, pady, relief, repeatdelay,
 910              repeatinterval, takefocus, text,
 911              textvariable, underline, wraplength
 912  
 913          WIDGET-SPECIFIC OPTIONS
 914  
 915              command, compound, default, height,
 916              overrelief, state, width
 917          �buttonN�r�r��r�r�r(r8rrrr�d
 918  szButton.__init__cC�|j�|jd�dS)a_Flash the button.
 919  
 920          This is accomplished by redisplaying
 921          the button several times, alternating between active and
 922          normal colors. At the end of the flash the button is left
 923          in the same normal/active state as when the command was
 924          invoked. This command is ignored if the button's state is
 925          disabled.
 926          �flashNr?r�rrrr�y
 927  rzButton.flashcC�|j�|jd�S)aInvoke the command associated with the button.
 928  
 929          The return value is the return value from the command,
 930          or an empty string if there is no command associated with
 931          the button. This command is ignored if the button's state
 932          is disabled.
 933          �invoker?r�rrrr��
 934  sz
Button.invoke)rarbrcr�r�r�r�rrrrrha
 935  s
 936  rhc@seZdZdZdifdd�Zdd�Zdd�Zd	d
 937  �Zdd�Zdwd
d�Z	dd�Z
 938  dd�Zdd�Zdd�Z
dxdd�Zdydd�Zdxdd�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#dwdCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dxdWdX�Z.e.Z/dYdZ�Z0e0Z1d[d\�Z2dzd^d_�Z3ifd`da�Z4dbdc�Z5e5Z6Z7ddde�Z8dfdg�Z9d{didj�Z:dkdl�Z;dmdn�Z<dodp�Z=dqdr�Z>dsdt�Z?dudv�Z@dS)|�Canvasz?Canvas widget to display graphical elements like lines or text.NcKr�)aConstruct a canvas widget with the parent MASTER.
 939  
 940          Valid resource names: background, bd, bg, borderwidth, closeenough,
 941          confine, cursor, height, highlightbackground, highlightcolor,
 942          highlightthickness, insertbackground, insertborderwidth,
 943          insertofftime, insertontime, insertwidth, offset, relief,
 944          scrollregion, selectbackground, selectborderwidth, selectforeground,
 945          state, takefocus, width, xscrollcommand, xscrollincrement,
 946          yscrollcommand, yscrollincrement.�canvasNr�r�rrrr��
 947  �
 948  zCanvas.__init__cG�|j�|jdf|�dS)r�addtagNr?r�rrrr��
 949  rnz
Canvas.addtagcC�|�|d|�dS)z*Add tag NEWTAG to all items above TAGORID.�aboveN�r��r��newtag�tagOrIdrrr�addtag_above�
 950  rGzCanvas.addtag_abovecCs|�|d�dS)zAdd tag NEWTAG to all items.r:Nr�)r�r�rrr�
 951  addtag_all�
 952  rzCanvas.addtag_allcCr�)z*Add tag NEWTAG to all items below TAGORID.�belowNr�r�rrr�addtag_below�
 953  rGzCanvas.addtag_belowcC�|�|d||||�dS)z�Add tag NEWTAG to item which is closest to pixel at X, Y.
 954          If several match take the top-most.
 955          All items closer than HALO are considered overlapping (all are
 956          closest). If START is specified the next below this tag is taken.�closestNr�)r�r�r�r��halo�startrrr�addtag_closest�
 957  r�zCanvas.addtag_closestcCr�)zLAdd tag NEWTAG to all items in the rectangle defined
 958          by X1,Y1,X2,Y2.�enclosedNr��r�r��x1�y1�x2�y2rrr�addtag_enclosed�
 959  r�zCanvas.addtag_enclosedcCr�)zWAdd tag NEWTAG to all items which overlap the rectangle
 960          defined by X1,Y1,X2,Y2.�overlappingNr�r�rrr�addtag_overlapping�
 961  r�zCanvas.addtag_overlappingcCr�)z)Add tag NEWTAG to all items with TAGORID.�withtagNr�r�rrr�addtag_withtag�
 962  rGzCanvas.addtag_withtagcG� |�|j�|jdf|��pdS)z|Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
 963          which encloses all items with tags specified as arguments.r�Nr�r�rrrr��
 964  s
 965  ��zCanvas.bboxcCs,|j�|jd||d�|r|�|�dSdS)zbUnbind for all items with TAGORID for event SEQUENCE  the
 966          function identified with FUNCID.r5r�Nr8)r�r�r1r3rrr�
 967  tag_unbind�
 968  s�zCanvas.tag_unbindcCs|�|jd|f|||�S)a&Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.
 969  
 970          An additional boolean parameter ADD specifies whether FUNC will be
 971          called additionally to the other bound function or whether it will
 972          replace the previous function. See bind for the return value.r5r6)r�r�r1rar�rrr�tag_bind�
 973  s�zCanvas.tag_bindcC�|j�|j�|jd||��S)zrReturn the canvas x coordinate of pixel position SCREENX rounded
 974          to nearest multiple of GRIDSPACING units.�canvasxr�)r��screenx�gridspacingrrrr��
 975  r�zCanvas.canvasxcCr�)zrReturn the canvas y coordinate of pixel position SCREENY rounded
 976          to nearest multiple of GRIDSPACING units.�canvasyr�)r��screenyr�rrrr��
 977  r�zCanvas.canvasycs,�fdd��j��j��jdf|��D�S)z8Return a list of coordinates for the item given in ARGS.crr)r4r$rr�rrr�
 978  rz!Canvas.coords.<locals>.<listcomp>�coordsr,r�rr�rr��
 979  s
 980  
 981  ��z
Canvas.coordsc	Cs^t|�}|d}t|ttf�r|dd�}ni}|j�|jj|jd|g||�||��R��S)rrMNrA)	rrr rr4r#r�r@rs)r��itemTyper7r8r(rrr�_create�
 982  s�
 983  �zCanvas._createcOrv)z6Create arc shaped region with coordinates x1,y1,x2,y2.�arc�r�r6rrr�
 984  create_arc�
 985  r�zCanvas.create_arccOrv)z%Create bitmap with coordinates x1,y1.rr�r6rrr�
create_bitmap�
 986  r�zCanvas.create_bitmapcOrv)z)Create image item with coordinates x1,y1.r�r�r6rrr�create_imager�zCanvas.create_imagecOrv)z-Create line with coordinates x1,y1,...,xn,yn.�liner�r6rrr�create_liner�zCanvas.create_linecOrv)z)Create oval with coordinates x1,y1,x2,y2.�ovalr�r6rrr�create_oval	r�zCanvas.create_ovalcOrv)z0Create polygon with coordinates x1,y1,...,xn,yn.�polygonr�r6rrr�create_polygon
r�zCanvas.create_polygoncOrv)z.Create rectangle with coordinates x1,y1,x2,y2.�	rectangler�r6rrr�create_rectangler�zCanvas.create_rectanglecOrv)z#Create text with coordinates x1,y1.�textr�r6rrr�create_textr�zCanvas.create_textcOrv)z+Create window with coordinates x1,y1,x2,y2.r>r�r6rrr�
create_windowr�zCanvas.create_windowcGr�)z�Delete characters of text items identified by tag or id in ARGS (possibly
 987          several times) from FIRST to LAST character (including).�dcharsNr?r�rrrr�r�z
Canvas.dcharscGr�)z<Delete items identified by all tag or ids contained in ARGS.r�Nr?r�rrrr�"rnz
Canvas.deletecGr�)ziDelete tag or id given as last arguments in ARGS from items
 988          identified by first argument in ARGS.�dtagNr?r�rrrr�&r�zCanvas.dtagcGr�)r�findrr�r�rrrr�+�
 989  ��zCanvas.findcC�|�d|�S)zReturn items above TAGORID.r��r��r�r�rrr�
 990  find_above0rIzCanvas.find_abovecC�
 991  |�d�S)zReturn all items.r:r�r�rrr�find_all4rzCanvas.find_allcCr�)zReturn all items below TAGORID.r�r�r�rrr�
 992  find_below8rIzCanvas.find_belowcC�|�d||||�S)z�Return item which is closest to pixel at X, Y.
 993          If several match take the top-most.
 994          All items closer than HALO are considered overlapping (all are
 995          closest). If START is specified the next below this tag is taken.r�r�)r�r�r�r�r�rrr�find_closest<r=zCanvas.find_closestcCr�)z=Return all items in rectangle defined
 996          by X1,Y1,X2,Y2.r�r��r�r�r�r�r�rrr�
find_enclosedCr	zCanvas.find_enclosedcCr�)zLReturn all items which overlap the rectangle
 997          defined by X1,Y1,X2,Y2.r�r�r�rrr�find_overlappingHr	zCanvas.find_overlappingcCr�)zReturn all items with TAGORID.r�r�r�rrr�find_withtagMrIzCanvas.find_withtagcGs|j�|jdf|�S)z.Set focus to the first item specified in ARGS.r�r?r�rrrr�Qr&zCanvas.focuscG�|j�|j�|jdf|��S)z=Return tags associated with the first item specified in ARGS.�gettagsr,r�rrrr�U��zCanvas.gettagscGr�)zdSet cursor at position POS in the item identified by TAGORID.
 998          In ARGS TAGORID must be first.�icursorNr?r�rrrr�Zr�zCanvas.icursorcGr�)z?Return position of cursor as integer in item specified in ARGS.r�r�r�rrrr�_szCanvas.indexcGr�)zSInsert TEXT in item TAGORID at position POS. ARGS must
 999          be TAGORID POS TEXT.�insertNr?r�rrrr�cr�z
Canvas.insertcC�|j�|jdf|d|f�S)z9Return the resource value for an OPTION for item TAGORID.�itemcgetr/r?)r�r�r�rrrr�hr�zCanvas.itemcgetcK�|�d|f||�S)z�Configure resources of an item TAGORID.
1000  
1001          The values for resources are specified as keyword
1002          arguments. To get an overview about
1003          the allowed keyword arguments call the method without arguments.
1004          �
itemconfigurerx�r�r�r(r8rrrr�mszCanvas.itemconfigurecGr�)zJLower an item TAGORID given in ARGS
1005          (optional below another item).r�Nr?r�rrr�	tag_lower|r�zCanvas.tag_lowercGr�)z#Move an item TAGORID given in ARGS.�moveNr?r�rrrr��rnzCanvas.mover�cCs|j�|jd|||�dS)a}Move the items given by TAGORID in the canvas coordinate
1006          space so that the first coordinate pair of the bottommost
1007          item with tag TAGORID is located at position (X,Y).
1008          X and Y may be the empty string, in which case the
1009          corresponding coordinate will be unchanged. All items matching
1010          TAGORID remain in the same positions relative to each other.r�Nr?)r�r�r�r�rrrr��sz
Canvas.movetocKs|j�|jdf|�||��S)z�Print the contents of the canvas to a postscript
1011          file. Valid options: colormap, colormode, file, fontmap,
1012          height, pageanchor, pageheight, pagewidth, pagex, pagey,
1013          rotate, width, x, y.�
1014  postscriptrrryrrrr��s
1015  �zCanvas.postscriptcGr�)zJRaise an item TAGORID given in ARGS
1016          (optional above another item).r�Nr?r�rrr�	tag_raise�r�zCanvas.tag_raisecGr�)z9Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.�scaleNr?r�rrrr��rnzCanvas.scalecCr��z&Remember the current X, Y coordinates.�scan�markNr?r�rrr�	scan_mark�rnzCanvas.scan_mark�
1017  cC�|j�|jdd|||�dS)z�Adjust the view of the canvas to GAIN times the
1018          difference between X and Y and the coordinates given in
1019          scan_mark.r��dragtoNr?)r�r�r��gainrrr�scan_dragto�szCanvas.scan_dragtocCr�)zLAdjust the end of the selection near the cursor of an item TAGORID to index.�select�adjustNr?�r�r�r�rrr�
select_adjust�rnzCanvas.select_adjustcC�|j�|jdd�dS)�,Clear the selection if it is in this widget.rrwNr?r�rrr�select_clear�r&zCanvas.select_clearcCr�)z:Set the fixed end of a selection in item TAGORID to INDEX.r�fromNr?rrrr�select_from�rnzCanvas.select_fromcCs|j�|jdd�p
1020  dS)z(Return the item which has the selection.rrNr?r�rrr�select_item�r&zCanvas.select_itemcCr�)z=Set the variable end of a selection in item TAGORID to INDEX.r�toNr?rrrr�	select_to�rnzCanvas.select_tocC�|j�|jd|�p
1021  dS)z$Return the type of the item TAGORID.r!Nr?r�rrrr!�r&zCanvas.typer�r�r)r�r�)r�)Ararbrcr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
1022  itemconfigr�r�r�r�r�r�r�r�r�r�rrrr
1023  rr
r!rrrrr��
1024  s|
1025  
1026  
1027  
1028  	
1029  
1030  
1031  	
1032  	
1033  r�csVeZdZdZdifdd�Z�fdd�Zdd�Zd	d
1034  �Zdd�Zd
d�Z	dd�Z
1035  �ZS)�Checkbuttonz7Checkbutton widget which is either in on- or off-state.NcKr�)aConstruct a checkbutton widget with the parent MASTER.
1036  
1037          Valid resource names: activebackground, activeforeground, anchor,
1038          background, bd, bg, bitmap, borderwidth, command, cursor,
1039          disabledforeground, fg, font, foreground, height,
1040          highlightbackground, highlightcolor, highlightthickness, image,
1041          indicatoron, justify, offvalue, onvalue, padx, pady, relief,
1042          selectcolor, selectimage, state, takefocus, text, textvariable,
1043          underline, variable, width, wraplength.�checkbuttonNr�r�rrrr��r�zCheckbutton.__init__csB|�d�s|jj��}td7ad|�t��|d<t��||�dS)Nr�r�!)r�rrar��_checkbutton_count�superr�)r�r�r(r��rrrr��s
1044  
1045  zCheckbutton._setupcCr��zPut the button in off-state.�deselectNr?r�rrrr�r+zCheckbutton.deselectcCr��zFlash the button.r�Nr?r�rrrr��r+zCheckbutton.flashcCr��z<Toggle the button and invoke a command if given as resource.r�r?r�rrrr��rzCheckbutton.invokecCr��zPut the button in on-state.rNr?r�rrrr�r+zCheckbutton.selectcCr�)zToggle the button.�toggleNr?r�rrrr�r+zCheckbutton.toggle)rarbrcr�r�r�rr�r�rr�
__classcell__rrrrr�src@s�eZdZdZdifdd�Zddd�Zdd�Zd	d
1046  �Zdd�Zd
d�Z	dd�Z
1047  dd�Zdd�ZeZ
dd�ZeZdd�ZeZdd�ZeZdd�ZeZdd�ZeZdS) �Entryz1Entry widget which allows displaying simple text.NcKr�)aConstruct an entry widget with the parent MASTER.
1048  
1049          Valid resource names: background, bd, bg, borderwidth, cursor,
1050          exportselection, fg, font, foreground, highlightbackground,
1051          highlightcolor, highlightthickness, insertbackground,
1052          insertborderwidth, insertofftime, insertontime, insertwidth,
1053          invalidcommand, invcmd, justify, relief, selectbackground,
1054          selectborderwidth, selectforeground, show, state, takefocus,
1055          textvariable, validate, validatecommand, vcmd, width,
1056          xscrollcommand.�entryNr�r�rrrr��szEntry.__init__cC�|j�|jd||�dS)z.Delete text from FIRST to LAST (not included).r�Nr?�r��first�lastrrrr�r(zEntry.deletecCr�)zReturn the text.r�r?r�rrrr�rz	Entry.getcC�|j�|jd|�dS)zInsert cursor at INDEX.r�Nr?�r�r�rrrr�r&z
Entry.icursorcC�|j�|j�|jd|��S)zReturn position of cursor.r�r�r$rrrr���zEntry.indexcCr)zInsert STRING at INDEX.r�Nr?)r�r�r{rrrr�r(zEntry.insertcCr�r�r?rrrrr�r(zEntry.scan_markcCr�)z�Adjust the view of the canvas to 10 times the
1057          difference between X and Y and the coordinates given in
1058          scan_mark.r�r�Nr?rrrrr�zEntry.scan_dragtocCr�)z9Adjust the end of the selection near the cursor to INDEX.r�rNr?r$rrr�selection_adjust#r(zEntry.selection_adjustcCr)rr�rwNr?r�rrrr�)r&zEntry.selection_clearcCr�)�*Set the fixed end of a selection to INDEX.r�r	Nr?r$rrr�selection_from/r(zEntry.selection_fromcC�|j�|j�|jdd��S)zSReturn True if there are characters selected in the entry, False
1059          otherwise.r��presentr�r�rrr�selection_present5r�zEntry.selection_presentcCr�)�3Set the selection from START to END (not included).r��rangeNr?�r�r��endrrr�selection_range=rnzEntry.selection_rangecCr�)�-Set the variable end of a selection to INDEX.r�rNr?r$rrr�selection_toCr(zEntry.selection_tor�)rarbrcr�r�r�r�r�r�r�r�rr(rr�rr*r
1060  r-�select_presentr2�select_ranger4r
rrrrr�s,
1061  
rc@r�)�FramezFFrame widget which may contain other widgets and can have a 3D border.NcKs^t||f�}d}d|vrd|df}|d=n
d|vr#d|df}|d=t�||d|i|�dS)aConstruct a frame widget with the parent MASTER.
1062  
1063          Valid resource names: background, bd, bg, borderwidth, class,
1064          colormap, container, cursor, height, highlightbackground,
1065          highlightcolor, highlightthickness, relief, takefocus, visual, width.rr�z-classr�rN)r-r�r�)r�r�r(r8r�rrrr�MszFrame.__init__r�rrrrr7Jr�r7c@r�)�Labelz0Label widget which can display text and bitmaps.NcKr�)a�Construct a label widget with the parent MASTER.
1066  
1067          STANDARD OPTIONS
1068  
1069              activebackground, activeforeground, anchor,
1070              background, bitmap, borderwidth, cursor,
1071              disabledforeground, font, foreground,
1072              highlightbackground, highlightcolor,
1073              highlightthickness, image, justify,
1074              padx, pady, relief, takefocus, text,
1075              textvariable, underline, wraplength
1076  
1077          WIDGET-SPECIFIC OPTIONS
1078  
1079              height, state, width
1080  
1081          �labelNr�r�rrrr�aszLabel.__init__r�rrrrr8^r�r8c@s�eZdZdZdifdd�Zdd�Zdd�Zd	d
1082  �Zd)dd�Zd)d
d�Z	dd�Z
1083  dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZeZd)dd�ZeZdd �ZeZd)d!d"�ZeZd#d$�Zd%d&�Zd)d'd(�ZeZdS)*�Listboxz3Listbox widget which can display a list of strings.NcKr�)a�Construct a listbox widget with the parent MASTER.
1084  
1085          Valid resource names: background, bd, bg, borderwidth, cursor,
1086          exportselection, fg, font, foreground, height, highlightbackground,
1087          highlightcolor, highlightthickness, relief, selectbackground,
1088          selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
1089          width, xscrollcommand, yscrollcommand, listvariable.�listboxNr�r�rrrr�yr@zListbox.__init__cCr#)z"Activate item identified by INDEX.�activateNr?r$rrrr<�r&zListbox.activatecC�|�|j�|jd|��p
dS)zxReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
1090          which encloses the item identified by the given index.r�Nr�r$rrrr���zListbox.bboxcCs|�|j�|jd��pdS)z.Return the indices of currently selected item.�curselectionrr�r�rrrr?�rnzListbox.curselectioncCr)z+Delete items from FIRST to LAST (included).r�Nr?r rrrr��r(zListbox.deletecCs6|dur|j�|j�|jd||��S|j�|jd|�S)z0Get list of items from FIRST to LAST (included).Nr�r,r rrrr��s
1091  
1092  �zListbox.getcC�*|j�|jd|�}|dkrdS|j�|�S)z+Return index of item identified with INDEX.r�rRN�r4r�r@r#�r�r�r�rrrr���z
Listbox.indexcGs|j�|jd|f|�dS)zInsert ELEMENTS at INDEX.r�Nr?)r�r��elementsrrrr���zListbox.insertcCr%)z5Get index of item which is nearest to y coordinate Y.�nearestr�)r�r�rrrrF�r&zListbox.nearestcCr�r�r?r�rrrr��rnzListbox.scan_markcCr�)z�Adjust the view of the listbox to 10 times the
1093          difference between X and Y and the coordinates given in
1094          scan_mark.r�r�Nr?r�rrrr��zListbox.scan_dragtocCr#)z"Scroll such that INDEX is visible.�seeNr?r$rrrrH�r&zListbox.seecCr�)z-Set the fixed end oft the selection to INDEX.r�r�Nr?r$rrr�selection_anchor�r(zListbox.selection_anchorcCr�)z2Clear the selection from FIRST to LAST (included).r�rwNr?r rrrr��s
1095  �zListbox.selection_clearcC�|j�|j�|jdd|��S)z.Return True if INDEX is part of the selection.r��includesr�r$rrr�selection_includes��
1096  �zListbox.selection_includescCr�)ziSet the selection from FIRST to LAST (included) without
1097          changing the currently selected elements.r�r�Nr?r rrr�
selection_set�r�zListbox.selection_setcC�|j�|j�|jd��S)z-Return the number of elements in the listbox.r�r�r�rrrr��r(zListbox.sizecCr�)z4Return the resource value for an ITEM and an OPTION.r�r/r?�r�r�r�rrrr��r�zListbox.itemcgetcKr�)a9Configure resources of an ITEM.
1098  
1099          The values for resources are specified as keyword arguments.
1100          To get an overview about the allowed keyword arguments
1101          call the method without arguments.
1102          Valid resource names: background, bg, foreground, fg,
1103          selectbackground, selectforeground.r�rxr�rrrr��szListbox.itemconfigurer�)rarbrcr�r�r<r�r?r�r�r�r�rFr�rrHrI�
select_anchorr�rrL�select_includesrN�
1104  select_setr�r�r�rrrrrr:vs4
1105  
1106  
1107  
1108  
1109  
1110  
1111  r:c@seZdZdZdifdd�Zd6dd�Zdd	�Zifd
1112  d�Zifdd
�Zifdd�Z	ifdd�Z
1113  ifdd�Zifdd�Zifdd�Z
ifdd�Zifdd�Zifdd�Zifdd�Zifd d!�Zd7d"d#�Zd$d%�Zd7d&d'�ZeZd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)8�MenuzPMenu widget which allows displaying menu bars, pull-down menus and pop-up menus.NcKr�)aAConstruct menu widget with the parent MASTER.
1114  
1115          Valid resource names: activebackground, activeborderwidth,
1116          activeforeground, background, bd, bg, borderwidth, cursor,
1117          disabledforeground, fg, font, foreground, postcommand, relief,
1118          selectcolor, takefocus, tearoff, tearoffcommand, title, type.�menuNr�r�rrrr���z
Menu.__init__r�cCs|j�d|j|||�dS)z/Post the menu at position X,Y with entry ENTRY.�tk_popupNr?)r�r�r�rrrrrW�rnz
Menu.tk_popupcCr#)zActivate entry at INDEX.r<Nr?r$rrrr<�r&z
Menu.activatecKs$|j�|jd|f|�||��dS)rr�Nrr)r�r�r(r8rrrr��s
1119  
1120  �zMenu.addcK�|�d|p|�dS)zAdd hierarchical menu item.�cascadeN�r�ryrrr�add_cascade
r+zMenu.add_cascadecKrX)zAdd checkbutton menu item.rNrZryrrr�add_checkbutton
r+zMenu.add_checkbuttoncKrX)zAdd command menu item.r�NrZryrrr�add_command
r+zMenu.add_commandcKrX)zAdd radio menu item.�radiobuttonNrZryrrr�add_radiobutton
r+zMenu.add_radiobuttoncKrX)zAdd separator.�	separatorNrZryrrr�
add_separator
r+zMenu.add_separatorcKs&|j�|jd||f|�||��dS)rr�Nrr)r�r�r�r(r8rrrr�
s
1121  
1122  �zMenu.insertcK�|�|d|p|�dS)z$Add hierarchical menu item at INDEX.rYN�r�r�rrr�insert_cascade
r&zMenu.insert_cascadecKrb)z#Add checkbutton menu item at INDEX.rNrcr�rrr�insert_checkbutton 
r&zMenu.insert_checkbuttoncKrb)zAdd command menu item at INDEX.r�Nrcr�rrr�insert_command$
r&zMenu.insert_commandcKrb)zAdd radio menu item at INDEX.r^Nrcr�rrr�insert_radiobutton(
r&zMenu.insert_radiobuttoncKrb)zAdd separator at INDEX.r`Nrcr�rrr�insert_separator,
r&zMenu.insert_separatorcCs�|dur|}|�|�|�|�}}|dus|durd\}}t||d�D]}d|�|�vr<t|�|d��}|r<|�|�q$|j�|jd||�dS)z7Delete menu items between INDEX1 and INDEX2 (included).N)rrMrr�r�)	r�r/�entryconfigr�	entrycgetr�r4r�r@)r��index1�index2�
1123  num_index1�
1124  num_index2r�r)rrrr�0
s
1125  �zMenu.deletecCs|j�|jd|d|�S)z=Return the resource value of a menu item for OPTION at INDEX.rjr/r?rPrrrrj@
r(zMenu.entrycgetcKr�)zConfigure a menu item at INDEX.�entryconfigurerxr�rrrroD
rGzMenu.entryconfigurecCr@)z4Return the index of a menu item identified by INDEX.r�rRNrArBrrrr�J
rCz
1126  Menu.indexcC�|j�|jd|�S)zRInvoke a menu item identified by INDEX and execute
1127          the associated command.r�r?r$rrrr�P
r	zMenu.invokecCr)zDisplay a menu at position X,Y.�postNr?r�rrrrqU
r(z	Menu.postcCrp)z*Return the type of the menu item at INDEX.r!r?r$rrrr!Y
rGz	Menu.typecCr�)z
Unmap a menu.�unpostNr?r�rrrrr]
r+zMenu.unpostcCr%)zNReturn the x-position of the leftmost pixel of the menu item
1128          at INDEX.�	xpositionr�r$rrrrsa
r�zMenu.xpositioncCr%)zEReturn the y-position of the topmost pixel of the menu item at INDEX.�	ypositionr�r$rrrrtf
r&zMenu.yposition�r�r�)rarbrcr�r�rWr<r�r[r\r]r_rar�rdrerfrgrhr�rjrorir�r�rqr!rrrsrtrrrrrT�s8
1129  	
1130  
1131  rTc@r�)�
1132  Menubuttonz(Menubutton widget, obsolete since Tk8.0.NcK�t�||d||�dS)N�
1133  menubuttonr�r�rrrr�o
�zMenubutton.__init__r�rrrrrvl
r�rvc@r�)�MessagezKMessage widget to display multiline text. Obsolete since Label does it too.NcKrw)N�messager�r�rrrr�v
ryzMessage.__init__r�rrrrrzs
r�rzc@s>eZdZdZdifdd�Zdd�Zdd�Zd	d
1134  �Zdd�ZdS)
�RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.NcKr�)a�Construct a radiobutton widget with the parent MASTER.
1135  
1136          Valid resource names: activebackground, activeforeground, anchor,
1137          background, bd, bg, bitmap, borderwidth, command, cursor,
1138          disabledforeground, fg, font, foreground, height,
1139          highlightbackground, highlightcolor, highlightthickness, image,
1140          indicatoron, justify, padx, pady, relief, selectcolor, selectimage,
1141          state, takefocus, text, textvariable, underline, value, variable,
1142          width, wraplength.r^Nr�r�rrrr�}
r�zRadiobutton.__init__cCr�rr?r�rrrr�
r�zRadiobutton.deselectcCr�rr?r�rrrr��
r+zRadiobutton.flashcCr�rr?r�rrrr��
rzRadiobutton.invokecCr�rr?r�rrrr�
r+zRadiobutton.select)	rarbrcr�r�rr�r�rrrrrr|z
sr|c@s@eZdZdZdifdd�Zdd�Zdd�Zd
d	d
1143  �Zdd�ZdS)�Scalez1Scale widget which can display a numerical scale.NcKr�)a�Construct a scale widget with the parent MASTER.
1144  
1145          Valid resource names: activebackground, background, bigincrement, bd,
1146          bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
1147          highlightbackground, highlightcolor, highlightthickness, label,
1148          length, orient, relief, repeatdelay, repeatinterval, resolution,
1149          showvalue, sliderlength, sliderrelief, state, takefocus,
1150          tickinterval, to, troughcolor, variable, width.r�Nr�r�rrrr��
�	zScale.__init__c
1151  CsD|j�|jd�}z|j�|�WStttfy!|j�|�YSw)z*Get the current value as integer or float.r�)r4r�r@r#r�r$r�r$r�rrrr��
s�z	Scale.getcCr#)zSet the value to VALUE.r�Nr?r�rrrr��
r&z	Scale.setcC�|�|j�|jd|��S)z�Return a tuple (X,Y) of the point along the centerline of the
1152          trough that corresponds to VALUE or the current value if None is
1153          given.r�r�r�rrrr��
r�zScale.coordscC�|j�|jd||�S)zcReturn where the point X,Y lies. Valid return values are "slider",
1154          "though1" and "though2".�identifyr?r�rrrr��
r�zScale.identifyr�)	rarbrcr�r�r�r�r�r�rrrrr}�
s
1155  r}c@sPeZdZdZdifdd�Zddd�Zdd�Zd	d
1156  �Zdd�Zd
d�Z	dd�Z
1157  dS)�	Scrollbarz?Scrollbar widget which displays a slider at a certain position.NcKr�)alConstruct a scrollbar widget with the parent MASTER.
1158  
1159          Valid resource names: activebackground, activerelief,
1160          background, bd, bg, borderwidth, command, cursor,
1161          elementborderwidth, highlightbackground,
1162          highlightcolor, highlightthickness, jump, orient,
1163          relief, repeatdelay, repeatinterval, takefocus,
1164          troughcolor, width.�	scrollbarNr�r�rrrr��
r~zScrollbar.__init__cCr)a�Marks the element indicated by index as active.
1165          The only index values understood by this method are "arrow1",
1166          "slider", or "arrow2".  If any other value is specified then no
1167          element of the scrollbar will be active.  If index is not specified,
1168          the method returns the name of the element that is currently active,
1169          or None if no element is active.r<Nr?r$rrrr<�
rVzScrollbar.activatecCr�)znReturn the fractional change of the scrollbar setting if it
1170          would be moved by DELTAX or DELTAY pixels.r�r�)r��deltax�deltayrrrr��
s�zScrollbar.deltacCr�)zRReturn the fractional value which corresponds to a slider
1171          position of X,Y.r�r�r�rrrr��
r>zScrollbar.fractioncCr�)zYReturn the element under position X,Y as one of
1172          "arrow1","slider","arrow2" or "".r�r?r�rrrr��
r�zScrollbar.identifycCs|�|j�|jd��S)zZReturn the current fractional values (upper and lower end)
1173          of the slider position.r�)rGr4r�r@r�rrrr��
rBz
Scrollbar.getcCr)ziSet the fractional values of the slider position (upper and
1174          lower ends as value between 0 and 1).r�Nr?r rrrr��
r�z
Scrollbar.setr�)rarbrcr�r�r<r�r�r�r�r�rrrrr��
s
1175  	r�c@s�eZdZdZdifdd�Zdd�Zdd�Zd	d
1176  �Zdkdd�Zdkd
d�Z	dd�Z
1177  dldd�Zdd�Zdkdd�Z
dd�Zdd�Zdd�Zdd�Zdkdd �Zd!d"�Zdkd#d$�Zifd%d&�Zd'd(�Zd)d*�Zd+d,�Zdkd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zifd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#			dmdCdD�Z$dEdF�Z%dGdH�Z&dkdIdJ�Z'dkdKdL�Z(dMdN�Z)dkdOdP�Z*e*Z+dQdR�Z,dkdSdT�Z-dkdUdV�Z.dkdWdX�Z/dkdYdZ�Z0dkd[d\�Z1d]d^�Z2dkd_d`�Z3dadb�Z4dkdcdd�Z5e5Z6ifdedf�Z7dgdh�Z8didj�Z9dS)n�Textz4Text widget which can display text in various forms.NcKr�)a�Construct a text widget with the parent MASTER.
1178  
1179          STANDARD OPTIONS
1180  
1181              background, borderwidth, cursor,
1182              exportselection, font, foreground,
1183              highlightbackground, highlightcolor,
1184              highlightthickness, insertbackground,
1185              insertborderwidth, insertofftime,
1186              insertontime, insertwidth, padx, pady,
1187              relief, selectbackground,
1188              selectborderwidth, selectforeground,
1189              setgrid, takefocus,
1190              xscrollcommand, yscrollcommand,
1191  
1192          WIDGET-SPECIFIC OPTIONS
1193  
1194              autoseparators, height, maxundo,
1195              spacing1, spacing2, spacing3,
1196              state, tabs, undo, width, wrap,
1197  
1198          r�Nr�r�rrrr��
sz
Text.__init__cCr=)z�Return a tuple of (x,y,width,height) which gives the bounding
1199          box of the visible part of the character at the given index.r�Nr�r$rrrr�s
1200  ��z	Text.bboxc	Cs|j�|j�|jd|||��S)z�Return whether between index INDEX1 and index INDEX2 the
1201          relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.�comparer�)r�rk�oprlrrrr�s�zText.comparecGsTdd�|D�}|||g7}|jj|jdg|�R�pd}|dur(t|�dkr(|fS|S)a�Counts the number of relevant things between the two indices.
1202          If index1 is after index2, the result will be a negative number
1203          (and this holds for each of the possible options).
1204  
1205          The actual items which are counted depends on the options given by
1206          args. The result is a list of integers, one for the result of each
1207          counting option given. Valid counting options are "chars",
1208          "displaychars", "displayindices", "displaylines", "indices",
1209          "lines", "xpixels" and "ypixels". There is an additional possible
1210          option "update", which if given then all subsequent options ensure
1211          that any possible out of date information is recalculated.cSsg|]}d|�qS)r�r)r��argrrrr(szText.count.<locals>.<listcomp>r�N�)r4r�r@r)r�rkrlr7rrrrr�sz
1212  Text.countcCs6|dur|j�|j�|jd��S|j�|jd|�dS)zjTurn on the internal consistency checks of the B-Tree inside the text
1213          widget according to BOOLEAN.N�debugr�r0rrrr�0sz
1214  Text.debugcCr)z?Delete the characters between INDEX1 and INDEX2 (not included).r�Nr?�r�rkrlrrrr�7r(zText.deletecCr)z�Return tuple (x,y,width,height,baseline) giving the bounding box
1215          and baseline position of the visible part of the line containing
1216          the character at INDEX.�	dlineinfor�r$rrrr�;r'zText.dlineinfoc
1217  	Ks�g}d}d}|sg}|fdd�}|}zEt|t�s|�|�}}|d|g7}|D]
}	||	r4|�d|	�q'|�|�|rA|�|�|jj|jdg|�R�|W|rW|�|�SS|r`|�|�ww)a�Return the contents of the widget between index1 and index2.
1218  
1219          The type of contents returned in filtered based on the keyword
1220          parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are
1221          given and true, then the corresponding items are returned. The result
1222          is a list of triples of the form (key, value, index). If none of the
1223          keywords are true then 'all' is used by default.
1224  
1225          If the 'command' argument is given, it is called once for each element
1226          of the list of triples, with the values of each triple serving as the
1227          arguments to the function. In this case the list is not returned.NcSs|�|||f�dSr�)r�)r9r
1228  r�r�rrr�
append_tripleVsz Text.dump.<locals>.append_triplez-commandr/�dump)rrr�r�r4r�r@r�)
1229  r�rkrlr�r8r7�	func_namer�r�r9rrrr�As0
1230  �
1231  
1232  ��z	Text.dumpcGs|jj|jdg|�R�S)arInternal method
1233  
1234          This method controls the undo mechanism and
1235          the modified flag. The exact behavior of the
1236          command depends on the option argument that
1237          follows the edit argument. The following forms
1238          of the command are currently supported:
1239  
1240          edit_modified, edit_redo, edit_reset, edit_separator
1241          and edit_undo
1242  
1243          �editr?r�rrrr�is
z	Text.editcCr�)a;Get or Set the modified flag
1244  
1245          If arg is not specified, returns the modified
1246          flag of the widget. The insert, delete, edit undo and
1247          edit redo commands or the user can set or clear the
1248          modified flag. If boolean is specified, sets the
1249          modified flag of the widget to arg.
1250          �modified�r�)r�r�rrr�
edit_modifiedxs	zText.edit_modifiedcCr�)aRedo the last undone edit
1251  
1252          When the undo option is true, reapplies the last
1253          undone edits provided no other edits were done since
1254          then. Generates an error when the redo stack is empty.
1255          Does nothing when the undo option is false.
1256          �redor�r�rrr�	edit_redo�s
1257  zText.edit_redocCr�)z(Clears the undo and redo stacks
1258          �resetr�r�rrr�
1259  edit_reset��
1260  zText.edit_resetcCr�)znInserts a separator (boundary) on the undo stack.
1261  
1262          Does nothing when the undo option is false
1263          r`r�r�rrr�edit_separator�s
1264  zText.edit_separatorcCr�)aDUndoes the last edit action
1265  
1266          If the undo option is true. An edit action is defined
1267          as all the insert and delete commands that are recorded
1268          on the undo stack in between two separators. Generates
1269          an error when the undo stack is empty. Does nothing
1270          when the undo option is false
1271          �undor�r�rrr�	edit_undo�s
1272  	zText.edit_undocCr�)z5Return the text from INDEX1 to INDEX2 (not included).r�r?r�rrrr��r+zText.getcC�J|dd�dkrd|}|dd�dkr|dd�}|j�|jdd||�S)z9Return the value of OPTION of an embedded image at INDEX.Nrr/rMrNr�r{r?rPrrr�
1273  image_cget��
1274  zText.image_cgetcK�|�dd|f||�S)z%Configure an embedded image at INDEX.r�rwrxr�rrr�image_configure�r+zText.image_configurecKs$|jj|jdd|g|�||��R�S)z"Create an embedded image at INDEX.r�rArrr�rrr�image_create�s
1275  
1276  �
1277  �zText.image_createcCs|j�|jdd�S)z3Return all names of embedded images in this widget.r�r�r?r�rrrr��rGzText.image_namescCst|j�|jd|��S)z1Return the index in the form line.char for INDEX.r�)rr4r�r@r$rrrr��r&z
1278  Text.indexcGs|j�|jd||f|�dS)z�Insert CHARS before the characters at INDEX. An additional
1279          tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.r�Nr?)r�r��charsr7rrrr��szText.insertcCs|j�|jdd||f�S)z�Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
1280          Return the current value if None is given for DIRECTION.r��gravityr?)r��markName�	directionrrr�mark_gravity�r�zText.mark_gravitycCr+)zReturn all mark names.r�r�r,r�rrr�
1281  mark_names�r&zText.mark_namescCr�)z0Set mark MARKNAME before the character at INDEX.r�r�Nr?)r�r�r�rrr�mark_set�rnz
Text.mark_setcG�|j�|jddf|�dS)zDelete all marks in MARKNAMES.r��unsetNr?)r��	markNamesrrr�
1282  mark_unset�rEzText.mark_unsetcC�|j�|jdd|�pdS)z-Return the name of the next mark after INDEX.r��nextNr?r$rrr�	mark_next�r(zText.mark_nextcCr�)z2Return the name of the previous mark before INDEX.r��previousNr?r$rrr�
mark_previous�r(zText.mark_previouscKs(|jj|jdd|g|�||��R�dS)aCreates a peer text widget with the given newPathName, and any
1283          optional standard configuration options. By default the peer will
1284          have the same start and end line as the parent widget, but
1285          these can be overridden with the standard configuration options.�peerrANrr)r��newPathNamer(r8rrr�peer_create�s
1286  �zText.peer_createcCr+)zYReturns a list of peers of this widget (this does not include
1287          the widget itself).r�r�r,r�rrr�
1288  peer_names�r�zText.peer_namescGs"|jj|jd|||g|�R�dS)z�Replaces the range of characters between index1 and index2 with
1289          the given characters and tags specified by args.
1290  
1291          See the method insert for some more information about args, and the
1292          method delete for information about the indices.rNr?)r�rkrlr�r7rrrr�s"zText.replacecCr�r�r?r�rrrr��rnzText.scan_markcCr�)z~Adjust the view of the text to 10 times the
1293          difference between X and Y and the coordinates given in
1294          scan_mark.r�r�Nr?r�rrrr�rGzText.scan_dragtocCs�|jdg}|r|�d�|r|�d�|r|�d�|r!|�d�|r(|�d�|
1295  r/|�d�|	r;|�d�|�|	�|rH|d	d
1296  krH|�d�|�|�|�|�|rY|�|�t|j�t|���S)z�Search PATTERN beginning from INDEX until STOPINDEX.
1297          Return the index of the first character of a match or an
1298          empty string.rz	-forwardsz
1299  -backwardsz-exactz-regexpz-nocasez-elidez-countrr/rz)r@r�rr4r�r)r�r�r��	stopindex�forwards�	backwards�exact�regexp�nocaser��elider7rrrrs
1300  
1301  
1302  zText.searchcCr#)z3Scroll such that the character at INDEX is visible.rHNr?r$rrrrHr&zText.seecGs |j�|jdd||f|�dS)z|Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
1303          Additional pairs of indices may follow in ARGS.�tagr�Nr?)r��tagNamerkr7rrr�tag_adds�zText.tag_addcCs.|j�|jdd||d�|r|�|�dSdS)zgUnbind for all characters with TAGNAME for event SEQUENCE  the
1304          function identified with FUNCID.r�r5r�Nr8)r�r�r1r3rrrr� s�zText.tag_unbindcCs|�|jdd|f|||�S)a+Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.
1305  
1306          An additional boolean parameter ADD specifies whether FUNC will be
1307          called additionally to the other bound function or whether it will
1308          replace the previous function. See bind for the return value.r�r5r6)r�r�r1rar�rrrr�'s�z
Text.tag_bindcCr�)z+Return the value of OPTION for tag TAGNAME.Nrr/rMrNr�r{r?)r�r�r�rrr�tag_cget0r�z
Text.tag_cgetcKr�)zConfigure a tag TAGNAME.r�rwrx)r�r�r(r8rrr�
tag_configure8r+zText.tag_configurecGr�)zDelete all tags in TAGNAMES.r�r�Nr?)r��tagNamesrrr�
1309  tag_delete>rEzText.tag_deletecCr�)z`Change the priority of tag TAGNAME such that it is lower
1310          than the priority of BELOWTHIS.r�r�Nr?)r�r�r�rrrr�Br�zText.tag_lowercCrJ)zReturn a list of all tag names.r�r�r,r$rrr�	tag_namesGr�zText.tag_namesc
1311  C� |j�|j�|jdd|||��S)z�Return a list of start and end index for the first sequence of
1312          characters between INDEX1 and INDEX2 which all have tag TAGNAME.
1313          The text is searched forward from INDEX1.r��	nextranger,�r�r�rkrlrrr�
tag_nextrangeL��zText.tag_nextrangec
1314  Cr�)z�Return a list of start and end index for the first sequence of
1315          characters between INDEX1 and INDEX2 which all have tag TAGNAME.
1316          The text is searched backwards from INDEX1.r��	prevranger,r�rrr�
tag_prevrangeSr�zText.tag_prevrangecCr�)zaChange the priority of tag TAGNAME such that it is higher
1317          than the priority of ABOVETHIS.r�r�Nr?)r�r�r�rrrr�Zs�zText.tag_raisecCrJ)z7Return a list of ranges of text which have tag TAGNAME.r��rangesr,)r�r�rrr�
1318  tag_ranges`rMzText.tag_rangescCr�)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.r�rNr?r�rrr�
1319  tag_removees�zText.tag_removecCr�)z:Return the value of OPTION of an embedded window at INDEX.Nrr/rMrNr>r{r?rPrrr�window_cgetjr�zText.window_cgetcKr�)z&Configure an embedded window at INDEX.r>rwrxr�rrr�window_configurerr+zText.window_configurecKs&|j�|jdd|f|�||��dS)zCreate a window at INDEX.r>rANrrr�rrr�
window_createxs
1320  
1321  ��zText.window_createcCr+)z4Return all names of embedded windows in this widget.r>r�r,r�rrr�window_names~r�zText.window_namescGr�)zObsolete function, use see.r�z
1322  -pickplaceNr?)r�r�rrr�yview_pickplace�rEzText.yview_pickplacer�r�)NNNNNNNN):rarbrcr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rrrHr�r�r�r�r��
1323  tag_configr�r�r�r�r�r�r�r�r�r��
window_configr�r�r�rrrrr��
sv
1324  
1325  
1326  (
1327  
1328  
1329  
1330  
1331  
1332  �
1333  
1334  	
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  r�c@s"eZdZdZddd�Zdd�ZdS)�_setitz>Internal class. It wraps the command in the widget OptionMenu.NcCs||_||_||_dSr�)�
_setit__value�_setit__var�_setit__callback)r��varr
1343  r�rrrr��s
1344  z_setit.__init__cGs4|j�|j�|jdur|j|jg|�R�dSdSr�)r�r�r�r�r�rrrr��s
1345  �z_setit.__call__r�r�rrrrr��s
1346  r�c@r�)	�
1347  OptionMenuz?OptionMenu which allows the user to select a value from a menu.c
1348  Os�d|dtddd�}t�||d|�d|_t|ddd	�}|_|j|_|�d
1349  �}d
1350  |vr.|d
1351  =|r:t	dt
1352  t|����|j|t
|||�d�|D]
}	|j|	t
||	|�d�qG||d<d
S)z�Construct an optionmenu widget with the parent MASTER, with
1353          the resource textvariable set to VARIABLE, the initially selected
1354          value VALUE, the other menu values VALUES and an additional
1355          keyword argument command.r.rr))�borderwidth�textvariable�indicatoron�reliefr��highlightthicknessrx�
tk_optionMenurUr)r��tearoffr�zunknown option -)r9r�N)�RAISEDr�r�r�rT�_OptionMenu__menur@�menunamer�r�r�r2r]r�)
1356  r�r�rr
1357  rV�kwargsr8rUr�r,rrrr��s*�
1358  
1359  �
1360  �zOptionMenu.__init__cCs|dkr|jSt�||�S)NrU)r�r�r�r�rrrr��szOptionMenu.__getitem__cCst�|�d|_dS)z,Destroy this widget and the associated menu.N)rvr�r�r�rrrr��s
1361  
1362  zOptionMenu.destroyN)rarbrcr�r�r�r�rrrrr��s
1363  r�c@sheZdZdZdZdidfdd�Zdd�Zdd	�Zd
1364  d�Zdd
�Z	dd�Z
1365  e
1366  Zdd�Zdd�Z
dd�ZdS)�ImagezBase class for images.rNc	Ks�d|_|durtd�}t|d|�|_|s!tjd7_dtjf}|r,|r,t||f�}n|r0|}d}|��D]\}}t|�rC|�	|�}|d||f}q6|j�
1367  dd||f|�||_dS)	Nzcreate imager4rz	pyimage%rrr/r�rA)r�r�r�r4r��_last_idr-r&rOr�r�)	r��imgtyper�r(r�r8r�r+r,rrrr��s 
1368  
1369  zImage.__init__cCr�r�)r�r�rrrr��sz
Image.__str__cCs8|jrz|j�dd|j�WdStyYdSwdS)Nr�r�)r�r4r�r�r�rrrr��s��z
Image.__del__cCs|j�|jdd||�dS�Nrwr/�r4r�r�r}rrrr~�szImage.__setitem__cCrzr�r�r|rrrr��ryzImage.__getitem__cKsvd}t|���D]%\}}|dur-|ddkr|dd�}t|�r%|�|�}|d||f}q|j�|jdf|�dS)zConfigure the image.rNrMrNr/r�)r-r&rOr�r4r�r�)r�r8rr+r,rrrrw�s
1370  �zImage.configurecCr�)zReturn the height of the image.r�r��r4r#r�r�r�rrrr��r�zImage.heightcCr�)z7Return the type of the image, e.g. "photo" or "bitmap".r�r!r�r�rrrr!�rGz
1371  Image.typecCr�)zReturn the width of the image.r�r�r�r�rrrr��r�zImage.width)rarbrcr�r�r�r�r�r~r�rwr�r�r!r�rrrrr��sr�c@s�eZdZdZdidfdd�Zdd�Zdd�Zd	d
1372  �Zdd�Zddd�Z	ddd�Z
1373  dd�Zddd�Zddd�Z
dd�Zdd�ZdS)�
1374  PhotoImagez=Widget which can display images in PGM, PPM, GIF, PNG format.NcK�tj|d|||fi|��dS)ztCreate an image with NAME.
1375  
1376          Valid resource names: data, format, file, gamma, height, palette,
1377          width.�photoN�r�r��r�r�r(r�r8rrrr�szPhotoImage.__init__cCr�)zDisplay a transparent image.�blankNr�r�rrrr�	r+zPhotoImage.blankcCrz)zReturn the value of OPTION.r{r/r�)r�r�rrrr{
r&zPhotoImage.cgetcCrz)Nr{r/r�r|rrrr�ryzPhotoImage.__getitem__cCs"t|jd�}|j�|d|j�|S)z;Return a new PhotoImage with the same image as this widget.r��copy�r�r4r�r�)r��	destImagerrrr�szPhotoImage.copyr�cC�4t|jd�}|dkr|}|j�|d|jd||�|S)z�Return a new PhotoImage with the same image as this widget
1378          but zoom it with a factor of x in the X direction and y in the Y
1379          direction.  If y is not given, the default value is the same as x.
1380          r�r�r�z-zoomr��r�r�r�r�rrr�zoom�zPhotoImage.zoomcCr�)z�Return a new PhotoImage based on the same image as this widget
1381          but use only every Xth or Yth pixel.  If y is not given, the
1382          default value is the same as x.
1383          r�r�r�z
1384  -subsampler�r�rrr�	subsample&r�zPhotoImage.subsamplecCr�)z8Return the color (red, green, blue) of the pixel at X,Y.r�r�r�rrrr�0r+zPhotoImage.getcCsH|jd|f}|r|ddkr|dd�}|dt|�}|j�|�dS)zzPut row formatted colors to image starting from
1385          position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))�putr�-torN)r��r�rr4r�)r�rgrr7rrrr�4szPhotoImage.putcCs@|jd|f}|r|d|f}|r|dt|�}|j�|�dS)zRWrite image to file FILENAME in FORMAT starting from
1386          position FROM_COORDS.�writez-format)z-fromNr�)r��filename�format�from_coordsr7rrrr�?szPhotoImage.writec	Cs|j�|j�|jdd||��S)z/Return True if the pixel at x,y is transparent.�transparencyr�)r4r�r�r�r�rrr�transparency_getIs�zPhotoImage.transparency_getcCr�)z)Set the transparency of the pixel at x,y.rr�Nr�)r�r�r�r1rrr�transparency_setNrEzPhotoImage.transparency_setrur�r�)rarbrcr�r�r�r{r�r�r�r�r�r�r�rrrrrrr��s
1387  
1388  
1389  
1390  
1391  
1392  
1393  r�c@s eZdZdZdidfdd�ZdS)�BitmapImagez.Widget which can display images in XBM format.NcKr�)zqCreate a bitmap with NAME.
1394  
1395          Valid resource names: background, data, file, foreground, maskdata, maskfile.rNr�r�rrrr�VszBitmapImage.__init__r�rrrrrSsrcC�td�j}|�|�dd��S)Nzuse image_names()r�r��r�r4r0r��r4rrrr�]�
1396  r�cCr)Nzuse image_types()r�r�rr	rrrr�br
1397  r�c@s�eZdZdZdifdd�Zdd�Zd+dd�Zd	d
1398  �Zdd�Zd
d�Z	dd�Z
1399  dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd+d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdS),�Spinboxzspinbox widget.NcKr�)a�Construct a spinbox widget with the parent MASTER.
1400  
1401          STANDARD OPTIONS
1402  
1403              activebackground, background, borderwidth,
1404              cursor, exportselection, font, foreground,
1405              highlightbackground, highlightcolor,
1406              highlightthickness, insertbackground,
1407              insertborderwidth, insertofftime,
1408              insertontime, insertwidth, justify, relief,
1409              repeatdelay, repeatinterval,
1410              selectbackground, selectborderwidth
1411              selectforeground, takefocus, textvariable
1412              xscrollcommand.
1413  
1414          WIDGET-SPECIFIC OPTIONS
1415  
1416              buttonbackground, buttoncursor,
1417              buttondownrelief, buttonuprelief,
1418              command, disabledbackground,
1419              disabledforeground, format, from,
1420              invalidcommand, increment,
1421              readonlybackground, state, to,
1422              validate, validatecommand values,
1423              width, wrap,
1424          �spinboxNr�r�rrrr�jszSpinbox.__init__cCr=)a�Return a tuple of X1,Y1,X2,Y2 coordinates for a
1425          rectangle which encloses the character given by index.
1426  
1427          The first two elements of the list give the x and y
1428          coordinates of the upper-left corner of the screen
1429          area covered by the character (in pixels relative
1430          to the widget) and the last two elements give the
1431          width and height of the character, in pixels. The
1432          bounding box may refer to a region outside the
1433          visible area of the window.
1434          r�Nr�r$rrrr��szSpinbox.bboxcCr�)aWDelete one or more elements of the spinbox.
1435  
1436          First is the index of the first character to delete,
1437          and last is the index of the character just after
1438          the last one to delete. If last isn't specified it
1439          defaults to first+1, i.e. a single character is
1440          deleted.  This command returns an empty string.
1441          r�r?r rrrr��s	zSpinbox.deletecCr�)zReturns the spinbox's stringr�r?r�rrrr��rzSpinbox.getcCrp)z�Alter the position of the insertion cursor.
1442  
1443          The insertion cursor will be displayed just before
1444          the character given by index. Returns an empty string
1445          r�r?r$rrrr���zSpinbox.icursorcCr�)z{Returns the name of the widget at position x, y
1446  
1447          Return value is one of: none, buttondown, buttonup, entry
1448          r�r?r�rrrr��r<zSpinbox.identifycCrp)z;Returns the numerical index corresponding to index
1449          r�r?r$rrrr��r	z
Spinbox.indexcCr�)zDInsert string s at index
1450  
1451           Returns an empty string.
1452          r�r?)r�r�r�rrrr��r<zSpinbox.insertcCrp)z�Causes the specified element to be invoked
1453  
1454          The element could be buttondown or buttonup
1455          triggering the action associated with it.
1456          r�r?�r��elementrrrr��r
zSpinbox.invokecGr�)rr�rr�r�rrrr��r�zSpinbox.scancCr�)z�Records x and the current view in the spinbox window;
1457  
1458          used in conjunction with later scan dragto commands.
1459          Typically this command is associated with a mouse button
1460          press in the widget. It returns an empty string.
1461          r��r�rrrrr��szSpinbox.scan_markcCr�)a�Compute the difference between the given x argument
1462          and the x argument to the last scan mark command
1463  
1464          It then adjusts the view left or right by 10 times the
1465          difference in x-coordinates. This command is typically
1466          associated with mouse motion events in the widget, to
1467          produce the effect of dragging the spinbox at high speed
1468          through the window. The return value is an empty string.
1469          r�rrrrrr�s
1470  zSpinbox.scan_dragtocGr�)rr�rr�r�rrrr��r�zSpinbox.selectioncCr�)a�Locate the end of the selection nearest to the character
1471          given by index,
1472  
1473          Then adjust that end of the selection to be at index
1474          (i.e including but not going beyond index). The other
1475          end of the selection is made the anchor point for future
1476          select to commands. If the selection isn't currently in
1477          the spinbox, then a new selection is created to include
1478          the characters between index and the most recent selection
1479          anchor point, inclusive.
1480          r�r�r$rrrr(��zSpinbox.selection_adjustcCr�)zsClear the selection
1481  
1482          If the selection isn't in this widget then the
1483          command has no effect.
1484          rwrr�rrrr��s
1485  zSpinbox.selection_clearcCs|j�|jdd|�S)z�Sets or gets the currently selected element.
1486  
1487          If a spinbutton element is specified, it will be
1488          displayed depressed.
1489          r�rr?rrrr�selection_element�rOzSpinbox.selection_elementcC�|�d|�dS)r)r	Nrr$rrrr*rzSpinbox.selection_fromcCr+)zUReturn True if there are characters selected in the spinbox, False
1490          otherwise.r�r,r�r�rrrr-r�zSpinbox.selection_presentcCs|�d||�dS)r.r/Nrr0rrrr2rGzSpinbox.selection_rangecCr)r3rNrr$rrrr4rzSpinbox.selection_tor�)rarbrcr�r�r�r�r�r�r�r�r�r�r�r�rr�r(r�rr*r-r2r4rrrrrgs,
1491  	
1492  rc@r�)�
1493  LabelFramezlabelframe widget.NcKr�)a�Construct a labelframe widget with the parent MASTER.
1494  
1495          STANDARD OPTIONS
1496  
1497              borderwidth, cursor, font, foreground,
1498              highlightbackground, highlightcolor,
1499              highlightthickness, padx, pady, relief,
1500              takefocus, text
1501  
1502          WIDGET-SPECIFIC OPTIONS
1503  
1504              background, class, colormap, container,
1505              height, labelanchor, labelwidget,
1506              visual, width
15071508  labelframeNr�r�rrrr�szLabelFrame.__init__r�rrrrrr�rc@s�eZdZdZdifdd�Zdd�Zdd�ZeZd	d
1509  �Zdd�Z	d
d�Z
1510  dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd!dd�ZeZdd �ZdS)"�PanedWindowzpanedwindow widget.NcKr�)aTConstruct a panedwindow widget with the parent MASTER.
1511  
1512          STANDARD OPTIONS
1513  
1514              background, borderwidth, cursor, height,
1515              orient, relief, width
1516  
1517          WIDGET-SPECIFIC OPTIONS
1518  
1519              handlepad, handlesize, opaqueresize,
1520              sashcursor, sashpad, sashrelief,
1521              sashwidth, showhandle,
1522          �panedwindowNr�r�rrrr�4szPanedWindow.__init__cKs"|j�|jd|f|�|��dS)a+Add a child widget to the panedwindow in a new pane.
1523  
1524          The child argument is the name of the child widget
1525          followed by pairs of arguments that specify how to
1526          manage the windows. The possible options and values
1527          are the ones accepted by the paneconfigure method.
1528          r�Nrr)r�r�r8rrrr�Ds"zPanedWindow.addcCr#)z�Remove the pane containing child from the panedwindow
1529  
1530          All geometry management options for child will be forgotten.
1531          r�Nr?)r�r�rrrrNr�zPanedWindow.removecCr�)a�Identify the panedwindow component at point x, y
1532  
1533          If the point is over a sash or a sash handle, the result
1534          is a two element list containing the index of the sash or
1535          handle, and a word indicating whether it is over a sash
1536          or a handle, such as {0 sash} or {2 handle}. If the point
1537          is over any other part of the panedwindow, the result is
1538          an empty list.
1539          r�r?r�rrrr�WrzPanedWindow.identifycGr�)r�proxyrr�r�rrrrcr�zPanedWindow.proxycCr�)zBReturn the x and y pair of the most recent proxy location
1540          �coord�rr�rrr�proxy_coordhr�zPanedWindow.proxy_coordcCr�)z+Remove the proxy from the display.
1541          r�rr�rrr�proxy_forgetmr�zPanedWindow.proxy_forgetcCrv)z:Place the proxy at the given x and y coordinates.
1542          r�rr�rrr�proxy_placerszPanedWindow.proxy_placecGr�)r�sashrr�r�rrrrwr�zPanedWindow.sashcCr�)aAReturn the current x and y pair for the sash given by index.
1543  
1544          Index must be an integer between 0 and 1 less than the
1545          number of panes in the panedwindow. The coordinates given are
1546          those of the top left corner of the region containing the sash.
1547          pathName sash dragto index x y This command computes the
1548          difference between the given coordinates and the coordinates
1549          given to the last sash coord command for the given sash. It then
1550          moves that sash the computed difference. The return value is the
1551          empty string.
1552          r�rr$rrr�
1553  sash_coord|rzPanedWindow.sash_coordcCr�)zRecords x and y for the sash given by index;
1554  
1555          Used in conjunction with later dragto commands to move the sash.
1556          r�r r$rrr�	sash_mark�szPanedWindow.sash_markcCr�)z?Place the sash given by index at the given coordinates
1557          r�r )r�r�r�r�rrr�
1558  sash_place�r[zPanedWindow.sash_placecCr�)zwQuery a management option for window.
1559  
1560          Option may be any value allowed by the paneconfigure subcommand
1561          �panecgetr/r?)r�r�r�rrrr$�s�zPanedWindow.panecgetcKsd|dur|s|�|jd|�St|t�r |s |�|jd|d|�S|j�|jd|f|�||��dS)a�
Query or modify the management options for window.
1562  
1563          If no option is specified, returns a list describing all
1564          of the available options for pathName.  If option is
1565          specified with no value, then the command returns a list
1566          describing the one named option (this list will be identical
1567          to the corresponding sublist of the value returned if no
1568          option is specified). If one or more option-value pairs are
1569          specified, then the command modifies the given widget
1570          option(s) to have the given value(s); in this case the
1571          command returns an empty string. The following options
1572          are supported:
1573  
1574          after window
1575              Insert the window after the window specified. window
1576              should be the name of a window already managed by pathName.
1577          before window
1578              Insert the window before the window specified. window
1579              should be the name of a window already managed by pathName.
1580          height size
1581              Specify a height for the window. The height will be the
1582              outer dimension of the window including its border, if
1583              any. If size is an empty string, or if -height is not
1584              specified, then the height requested internally by the
1585              window will be used initially; the height may later be
1586              adjusted by the movement of sashes in the panedwindow.
1587              Size may be any value accepted by Tk_GetPixels.
1588          minsize n
1589              Specifies that the size of the window cannot be made
1590              less than n. This constraint only affects the size of
1591              the widget in the paned dimension -- the x dimension
1592              for horizontal panedwindows, the y dimension for
1593              vertical panedwindows. May be any value accepted by
1594              Tk_GetPixels.
1595          padx n
1596              Specifies a non-negative value indicating how much
1597              extra space to leave on each side of the window in
1598              the X-direction. The value may have any of the forms
1599              accepted by Tk_GetPixels.
1600          pady n
1601              Specifies a non-negative value indicating how much
1602              extra space to leave on each side of the window in
1603              the Y-direction. The value may have any of the forms
1604              accepted by Tk_GetPixels.
1605          sticky style
1606              If a window's pane is larger than the requested
1607              dimensions of the window, this option may be used
1608              to position (or stretch) the window within its pane.
1609              Style is a string that contains zero or more of the
1610              characters n, s, e or w. The string can optionally
1611              contains spaces or commas, but they are ignored. Each
1612              letter refers to a side (north, south, east, or west)
1613              that the window will "stick" to. If both n and s
1614              (or e and w) are specified, the window will be
1615              stretched to fill the entire height (or width) of
1616              its cavity.
1617          width size
1618              Specify a width for the window. The width will be
1619              the outer dimension of the window including its
1620              border, if any. If size is an empty string, or
1621              if -width is not specified, then the width requested
1622              internally by the window will be used initially; the
1623              width may later be adjusted by the movement of sashes
1624              in the panedwindow. Size may be any value accepted by
1625              Tk_GetPixels.
1626  
1627          N�
paneconfigurer/)rsr@rrrtr4r�rsr�rrrr%�sD�
1628  
1629  �zPanedWindow.paneconfigurecCrO)z+Returns an ordered list of the child panes.�panesr,r�rrrr&�r(zPanedWindow.panesr�)rarbrcr�r�r�rr�r�rrrrrr!r"r#r$r%�
1630  paneconfigr&rrrrr1s&
1631  
1632  LrcCs�t�}dt}|d7}t||d�}|��t|d|fdd�d�}|��||_t|d|jd�}|��|��|��|�	�|�
1633  �dS)	NzThis is Tcl/Tk version %su
1634  This should be a cedilla: ç�r�z	Click me!cSs|jjd|jdd�S)Nz[%s]r�r()�testrwr�rrr�<lambda>�s�z_test.<locals>.<lambda>)r�r��QUIT)r��
1635  TclVersionr8r�rhr)r�rr"r�r*)r�r�r9r)rCrrr�_test�s 
1636  �r-cCs2g|]\}}|�d�st|tj�s|dvr|�qS)rN>rB)�
1637  startswithrr��
1638  ModuleType)r�r��objrrrrs�
1639  ��r�__main__)TNr�r�)NNr�F)]r��enumrlr�r�r��tkinter.constants�rerB�floatrT�	TkVersionrUr,�READABLE�WRITABLE�	EXCEPTION�compiler�ASCIIrr
rrr#r-r:r�Enumr;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�rorpr|r�r�r�r�rhr�rrrr7r8r:rTrvrzr|r}r�r�r�r�r�r�rr�r�rrrr-�globalsr&�__all__rarrrr�<module>s� 
1640  
1641  
1642  
1643  ,R
1644  
1645  	6
1646  
1647  u2
1648  ~.37?/8,Vt!'2'BT
1649  3C
1650  
1651  �