U e5dÍ•ã@sôdZddlZddlZddlZejZddlTddlZdZeej ƒZ eej ƒZ ej Z ejZejZe d¡Ze dej¡Zdd„Zd d „Zd d „Zz ejZWnek rªYnXd d„Zz ejZWnek rÒYnXdydd„ZGdd„deejƒZGdd„dƒZdadadd„Z dzdd„Z!dd„Z"d{dd„Z#da$Gdd„dƒZ%Gd d!„d!e%ƒZ&Gd"d#„d#e%ƒZ'Gd$d%„d%e%ƒZ(Gd&d'„d'e%ƒZ)d|d(d)„Z*e+Z,eZ-d*d+„Z.Gd,d-„d-ƒZ/Gd.d/„d/ƒZ0Gd0d1„d1ƒZ1Gd2d3„d3ƒZ2Gd4d5„d5ƒZ3Gd6d7„d7e/e3ƒZ4d}d8d9„Z5Gd:d;„d;ƒZ6Gdd?„d?ƒZ8Gd@dA„dAe/ƒZ9GdBdC„dCe9e6e7e8ƒZ:GdDdE„dEe9e3ƒZ;GdFdG„dGe:ƒZGdLdM„dMe:e1ƒZ?GdNdO„dOe:ƒZ@GdPdQ„dQe:ƒZAGdRdS„dSe:e1e2ƒZBGdTdU„dUe:ƒZCGdVdW„dWe:ƒZDGdXdY„dYe:ƒZEGdZd[„d[e:ƒZFGd\d]„d]e:ƒZGGd^d_„d_e:ƒZHGd`da„dae:e1e2ƒZIGdbdc„dcƒZJGddde„deeDƒZKGdfdg„dgƒZLGdhdi„dieLƒZMGdjdk„dkeLƒZNdldm„ZOdndo„ZPGdpdq„dqe:e1ƒZQGdrds„dse:ƒZRGdtdu„due:ƒZSdvdw„ZTeUdxk�rðeTƒdS)~a8Wrapper functions for Tcl/Tk. Tkinter provides classes which allow the display, positioning and control of widgets. Toplevel widgets are Tk and Toplevel. Other widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox LabelFrame and PanedWindow. Properties of the widgets are specified with keyword arguments. Keyword arguments have the same name as the corresponding resource under Tk. Widgets are positioned with one of the geometry managers Place, Pack or Grid. These managers can be called with methods place, pack, grid available in every Widget. Actions are bound to events by resources (e.g. keyword argument command) or with the method bind. Example (Hello, World): import tkinter from tkinter.constants import * tk = tkinter.Tk() frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2) frame.pack(fill=BOTH,expand=1) label = tkinter.Label(frame, text="Hello, World") label.pack(fill=X, expand=1) button = tkinter.Button(frame,text="Exit",command=tk.destroy) button.pack(side=BOTTOM) tk.mainloop() éN)Ú*éz([\\{}])z([\s])cCsd tt|ƒ¡S)úInternal function.ú )ÚjoinÚmapÚ _stringify©Úvalue©r ú(/usr/lib64/python3.8/tkinter/__init__.pyÚ_join8sr cCsÀt|ttfƒrHt|ƒdkr:t|dƒ}t |¡rFd|}q¼dt|ƒ}ntt|ƒ}|sZd}nbt |¡ržt  d|¡}|  dd¡}t   d|¡}|ddkr¼d |}n|ddks´t  |¡r¼d|}|S) rrrz{%s}z{}z\\\1Ú z\nú"ú\) Ú isinstanceÚlistÚtupleÚlenrÚ _magic_reÚsearchr ÚstrÚsubÚreplaceÚ _space_rer r r r r=s$          rcCs@d}|D]2}t|ttfƒr(|t|ƒ}q|dk r||f}q|S)rr N)rrrÚ_flatten)ÚseqÚresÚitemr r r rVs rc Cs˜t|tƒr|St|tdƒtfƒr$|Si}t|ƒD]^}z| |¡Wq0ttfk rŒ}z(td|ƒ|  ¡D]\}}|||<qjW5d}~XYq0Xq0|SdS)rNz_cnfmerge: fallback due to:) rÚdictÚtyperrÚupdateÚAttributeErrorÚ TypeErrorÚprintÚitems)ZcnfsÚcnfÚcÚmsgÚkÚvr r r Ú _cnfmergees   r+Tc Csz| |¡}t|ƒdrtdƒ‚t|ƒ}i}t||ƒD]@\}}t|ƒ}|r`|ddkr`|dd…}|rl||ƒ}|||<q4|S)aReturn a properly formatted dict built from Tcl list pairs. If cut_minus is True, the supposed '-' prefix will be removed from keys. If conv is specified, it is used to convert values. Tcl list is expected to contain an even number of elements. ézNTcl list representing a dict is expected to contain an even number of elementsrú-rN)Ú splitlistrÚ RuntimeErrorÚiterÚzipr) Útkr*Z cut_minusÚconvÚtÚitrÚkeyr r r r Ú _splitdict{s    r7c@s®eZdZdZeZdZdZeZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)e*j+Z+d&S)'Ú EventTypeÚ2Ú3Ú4Ú5Ú6Ú7Ú8Ú9Z10Z11Z12Z13Z14Z15Z16Z17Z18Z19Z20Z21Z22Z23Z24Z25Z26Z27Z28Z29Z30Z31Z32Z33Z34Z35Z36Z37Z38N),Ú__name__Ú __module__Ú __qualname__ZKeyPressZKeyZ KeyReleaseZ ButtonPressÚButtonZ ButtonReleaseZMotionZEnterZLeaveZFocusInZFocusOutZKeymapZExposeZGraphicsExposeZNoExposeZ VisibilityZCreateZDestroyZUnmapZMapZ MapRequestZReparentZ ConfigureZConfigureRequestZGravityZ ResizeRequestZ CirculateZCirculateRequestZPropertyZSelectionClearZSelectionRequestZ SelectionZColormapZ ClientMessageÚMappingZ VirtualEventZActivateZ DeactivateZ MouseWheelrÚ__str__r r r r r8“sPr8c@seZdZdZdd„ZdS)ÚEventaÊContainer for the properties of an event. Instances of this type are generated if one of the following events occurs: KeyPress, KeyRelease - for keyboard events ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, Colormap, Gravity, Reparent, Property, Destroy, Activate, Deactivate - for window events. If a callback function for one of these events is registered using bind, bind_all, bind_class, or tag_bind, the callback is called with an Event as first argument. It will have the following attributes (in braces are the event types for which the attribute is valid): serial - serial number of event num - mouse button pressed (ButtonPress, ButtonRelease) focus - whether the window has the focus (Enter, Leave) height - height of the exposed window (Configure, Expose) width - width of the exposed window (Configure, Expose) keycode - keycode of the pressed key (KeyPress, KeyRelease) state - state of the event as a number (ButtonPress, ButtonRelease, Enter, KeyPress, KeyRelease, Leave, Motion) state - state as a string (Visibility) time - when the event occurred x - x-position of the mouse y - y-position of the mouse x_root - x-position of the mouse on the screen (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) y_root - y-position of the mouse on the screen (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) char - pressed character (KeyPress, KeyRelease) send_event - see X/Windows documentation keysym - keysym of the event as a string (KeyPress, KeyRelease) keysym_num - keysym of the event as a number (KeyPress, KeyRelease) type - type of the event as a number widget - widget in which the event occurred delta - delta of wheel movement (MouseWheel) csdd„|j ¡Dƒ‰|js"ˆd=n|jdkr:t|jƒˆd<t|ddƒsLˆd=|jdkr^ˆd=n|t|jtƒrÚ|j}d }g}t|ƒD]\}}|d |>@r€|  |¡q€|d t |ƒ>d @}|s¾|sÌ|  t |ƒ¡d   |¡ˆd<|j dkrêˆd =d }dt|jd|jƒd  ‡fdd„|Dƒ¡fS)NcSsi|]\}}|dkr||“qS)ú??r ©Ú.0r)r*r r r Ú ësz"Event.__repr__..ÚcharrHÚ send_eventTrÚstate) ZShiftZLockZControlZMod1ZMod2ZMod3ZMod4ZMod5ZButton1ZButton2ZButton3ZButton4ZButton5rú|Údelta) rMrNÚkeysymÚkeycoderLÚnumrPÚfocusÚxÚyÚwidthÚheightz <%s event%s>ÚnameÚc3s&|]}|ˆkrd|ˆ|fVqdS)z %s=%sNr )rJr)©Úattrsr r Ú sz!Event.__repr__..)Ú__dict__r%rLÚreprÚgetattrrNrÚintÚ enumerateÚappendrÚhexrrPr )ÚselfrNZmodsÚsÚiÚnÚkeysr r[r Ú__repr__ês6       þzEvent.__repr__N)rArBrCÚ__doc__rjr r r r rG¿s*rGcCsdadabdS)z¨Inhibit setting of default root window. Call this function to inhibit that the first instance of Tk is used for windows without an explicit parent window. FN)Ú_support_default_rootÚ _default_rootr r r r Ú NoDefaultRootsrncCs:ts tdƒ‚ts6|r$td|›d�ƒ‚tƒ}t|ks6t‚tS)NzINo master specified and tkinter is configured to not support default rootz Too early to z: no default root window)rlr/rmÚTkÚAssertionError)ÚwhatÚrootr r r Ú_get_default_root#s rscCsdS©rNr )Úerrr r r Ú_tkerror/srvcCs.z t|ƒ}Wntk r YnXt|ƒ‚dS)zBInternal function. Calling it will raise the exception SystemExit.N)raÚ ValueErrorÚ SystemExit)Úcoder r r Ú_exit4s  rzc@sŽeZdZdZdZdZdZddd„Zdd„Zdd „Z d d „Z e Z d d „Z dd„Z dd„Zdd„Zdd„Zdd„ZeZdd„Zdd„Zdd„ZdS)ÚVariablezºClass to define value holders for e.g. buttons. Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations that constrain the type of the value returned from get().rZNcCs˜|dk rt|tƒstdƒ‚|s&tdƒ}| ¡|_|j|_|rD||_ndtt ƒ|_t d7a |dk rn|  |¡n&|j  |j  dd|j¡¡s”|  |j ¡dS)a.Construct a variable MASTER can be given as master widget. VALUE is an optional value (defaults to "") NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. Nzname must be a stringzcreate variableÚPY_VARrÚinfoÚexists)rrr#rsÚ_rootr2Ú_tkÚ_namer_Ú_varnumÚ initializeÚ getbooleanÚcallÚ_default©reÚmasterr rYr r r Ú__init__Is   zVariable.__init__cCsb|jdkrdS|j |j dd|j¡¡r6|j |j¡|jdk r^|jD]}|j |¡qFd|_dS)zUnset the variable in Tcl.Nr}r~)r€r„r…r�ZglobalunsetvarÚ _tclCommandsÚ deletecommand©rerYr r r Ú__del__gs   zVariable.__del__cCs|jS)z'Return the name of the variable in Tcl.)r�©rer r r rFsszVariable.__str__cCs|j |j|¡S©zSet the variable to VALUE.)r€Ú globalsetvarr�©rer r r r Úsetwsz Variable.setcCs|j |j¡S)zReturn value of variable.)r€Ú globalgetvarr�rŽr r r Úget}sz Variable.getcCsŽt|d|jƒj}tt|ƒƒ}z |j}Wntk r:YnXz||j}Wntk r^YnX|j  ||¡|j dkr~g|_ |j   |¡|S©N) Ú CallWrapperrÚ__call__r_ÚidÚ__func__r"rAr€Ú createcommandrŠrc)reÚcallbackÚfÚcbnamer r r Ú _register�s    zVariable._registercCs(| |¡}|j ddd|j||f¡|S)a#Define a trace callback for the variable. Mode is one of "read", "write", "unset", or a list or tuple of such strings. Callback must be a function which is called when the variable is read, written or unset. Return the name of the callback. ÚtraceÚaddÚvariable©ržr€r…r�©reÚmoder›r�r r r Ú trace_add’s  ÿzVariable.trace_addcCsx|j ddd|j||¡| ¡D] \}}|j |¡d|kr qtq |j |¡z|j |¡Wntk rrYnXdS)aDelete the trace callback for a variable. Mode is one of "read", "write", "unset" or a list or tuple of such strings. Must be same as were specified in trace_add(). cbname is the name of the callback returned from trace_add(). rŸÚremover¡rN) r€r…r�Ú trace_infor.r‹rŠr¦rw©rer¤r�ÚmZcar r r Ú trace_remove¡s ÿ zVariable.trace_removec s4|jj‰‡fdd„tˆˆ|j ddd|j¡ƒƒDƒS)z&Return all trace callback information.csg|]\}}ˆ|ƒ|f‘qSr r rI©r.r r Ú ·sz'Variable.trace_info..rŸr}r¡)r€r.rr…r�rŽr r«r r§´sÿzVariable.trace_infocCs$| |¡}|j dd|j||¡|S)a•Define a trace callback for the variable. MODE is one of "r", "w", "u" for read, write, undefine. CALLBACK must be a function which is called when the variable is read, written or undefined. Return the name of the callback. This deprecated method wraps a deprecated Tcl method that will likely be removed in the future. Use trace_add() instead. rŸr¡r¢r£r r r Útrace_variableºs zVariable.trace_variablecCs†|j dd|j||¡|j |¡d}| ¡D] \}}|j |¡d|kr.q‚q.|j |¡z|j |¡Wntk r€YnXdS)aSDelete the trace callback for a variable. MODE is one of "r", "w", "u" for read, write, undefine. CBNAME is the name of the callback returned from trace_variable or trace. This deprecated method wraps a deprecated Tcl method that will likely be removed in the future. Use trace_remove() instead. rŸZvdeleterN) r€r…r�r.r§r‹rŠr¦rwr¨r r r Ú trace_vdeleteÍs  zVariable.trace_vdeletecs(‡fdd„ˆj ˆj ddˆj¡¡DƒS)z»Return all trace callback information. This deprecated method wraps a deprecated Tcl method that will likely be removed in the future. Use trace_info() instead. csg|]}ˆj |¡‘qSr )r€r.©rJrUrŽr r r¬êsz(Variable.trace_vinfo..rŸZvinfo)r€r.r…r�rŽr rŽr Ú trace_vinfoãsÿzVariable.trace_vinfocCs6t|tƒstS|j|jko4|jj|jjko4|j|jkSr•)rr{ÚNotImplementedr�Ú __class__rAr€)reÚotherr r r Ú__eq__ís  ÿ þzVariable.__eq__)NNN)rArBrCrkr†r€rŠr‰r�rFr’rƒr”ržr¥rªr§r­rŸr®r°r´r r r r r{@s&   r{c@s&eZdZdZdZddd„Zdd„ZdS) Ú StringVarz#Value holder for strings variables.rZNcCst ||||¡dS)a6Construct a string variable. MASTER can be given as master widget. VALUE is an optional value (defaults to "") NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. N©r{r‰r‡r r r r‰ùs zStringVar.__init__cCs$|j |j¡}t|tƒr|St|ƒS)z#Return value of variable as string.)r€r“r�rrr‘r r r r”s z StringVar.get)NNN©rArBrCrkr†r‰r”r r r r rµõs rµc@s&eZdZdZdZddd„Zdd„ZdS) ÚIntVarz#Value holder for integer variables.rNcCst ||||¡dS)a7Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. Nr¶r‡r r r r‰s zIntVar.__init__c CsJ|j |j¡}z|j |¡WSttfk rDt|j |¡ƒYSXdS)z/Return the value of the variable as an integer.N)r€r“r�Úgetintr#ÚTclErrorraÚ getdoubler‘r r r r”s z IntVar.get)NNNr·r r r r r¸ s r¸c@s&eZdZdZdZddd„Zdd„ZdS) Ú DoubleVarz!Value holder for float variables.gNcCst ||||¡dS)a6Construct a float variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0.0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. Nr¶r‡r r r r‰*s zDoubleVar.__init__cCs|j |j |j¡¡S)z,Return the value of the variable as a float.)r€r»r“r�rŽr r r r”6sz DoubleVar.get)NNNr·r r r r r¼&s r¼c@s2eZdZdZdZd dd„Zdd„ZeZdd „ZdS) Ú BooleanVarz#Value holder for boolean variables.FNcCst ||||¡dS)a:Construct a boolean variable. MASTER can be given as master widget. VALUE is an optional value (defaults to False) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. Nr¶r‡r r r r‰?s zBooleanVar.__init__cCs|j |j|j |¡¡Sr�)r€r�r�r„r‘r r r r’KszBooleanVar.setcCs:z|j |j |j¡¡WStk r4tdƒ‚YnXdS)z+Return the value of the variable as a bool.ú invalid literal for getboolean()N)r€r„r“r�rºrwrŽr r r r”QszBooleanVar.get)NNN) rArBrCrkr†r‰r’rƒr”r r r r r½;s  r½cCstdƒj |¡dS)zRun the main loop of Tcl.zrun the main loopN)rsr2Úmainloop)rhr r r r¿Ysr¿cCs4ztdƒj |¡WStk r.tdƒ‚YnXdS)z$Convert Tcl object to True or False.zuse getboolean()r¾N)rsr2r„rºrw©rfr r r r„csr„c@sòeZdZdZdZdZdd„Zdd„Z�d1dd„Zd d „Z d d „Z �d2dd„Z e Z �d3dd„Z �d4dd„Z�d5dd„Z�d6dd„Zdd„Zdd„Zdd„Zdd „ZeZd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Z�d7d/d0„Zd1d2„Zd3d4„Z�d8d6d7„Z d8d9„Z!d:d;„Z"dd?„Z$d@dA„Z%dBdC„Z&dDdE„Z'dFdG„Z(�d9dHdI„Z)dJdK„Z*dLdM„Z+�d:dNdO„Z,dPdQ„Z-dRdS„Z.dTdU„Z/dVdW„Z0dXdY„Z1dZd[„Z2�d;d\d]„Z3�ddbdc„Z7ddde„Z8dfdg„Z9dhdi„Z:djdk„Z;�d?dldm„Zdrds„Z?dtdu„Z@dvdw„ZAdxdy„ZB�d@dzd{„ZCd|d}„ZDd~d„ZEd€d�„ZFd‚dƒ„ZG�dAd„d…„ZHd†d‡„ZIdˆd‰„ZJdŠd‹„ZKdŒd�„ZLdŽd�„ZMd�d‘„ZNd’d“„ZOd”d•„ZPd–d—„ZQd˜d™„ZRdšd›„ZSdœd�„ZTdždŸ„ZUd d¡„ZVd¢d£„ZWd¤d¥„ZXd¦d§„ZYd¨d©„ZZdªd«„Z[d¬d­„Z\d®d¯„Z]d°d±„Z^�dBd³d´„Z_dµd¶„Z`d·d¸„Zad¹dº„Zbd»d¼„Zcd½d¾„Zdd¿dÀ„ZedÁd„ZfdÃdÄ„ZgdÅdÆ„ZhdÇdÈ„ZidÉdÊ„Zj�dCdËdÌ„Zk�dDdÎdÏ„Zl�dEdÐdÑ„Zm�dFdÒdÓ„Zn�dGdÔdÕ„ZodÖdׄZp�dHdØdÙ„ZqdÚdÛ„Zr�dIdÜdÝ„ZsdÞdß„Ztdàdá„Zudâdã„Zvdädå„Zwdædç„Zxeydèd鄃Zz�dJdêdë„Z{dìdí„Z|e|Z}�dKdîdï„Z~e~Zdðdñ„Z€dòZ�dó ‚e�¡Zƒdôdõ„Z„död÷„Z…dødù„Z†dúdû„Z‡düdý„Zˆ�dLdþdÿ„Z‰e‰ZŠ�d�d„Z‹e‹ZŒ�d�d„Z��d�d„ZŽ�d�d„Z��d�d „Z��d gZ‘e‘f�d �d „Z’e’Z“�d �d„Z”e”Z•�d�d„Z–�dM�d�d„Z—e—Z˜�dN�d�d„Z™e™Zš�d�d„Z›�d�d„Zœif�d�d„Z�e�Zž�d�d„ZŸe‘f�d�d„Z if�d�d „Z¡e¡Z¢�d!�d"„Z£e£Z¤�dO�d#�d$„Z¥�d%�d&„Z¦�d'�d(„Z§�d)�d*„Z¨�dP�d+�d,„Z©�d-�d.„Zª�d/�d0„Z«dS(QÚMisczRInternal class. Base class which defines methods common for interior widgets.NcCs,|jdk r(|jD]}|j |¡qd|_dS)zkInternal function. Delete all Tcl commands created for this widget in the Tcl interpreter.N)rŠr2r‹rŒr r r Údestroyxs  z Misc.destroycCs6|j |¡z|j |¡Wntk r0YnXdS)zDInternal function. Delete the Tcl command provided in NAME.N)r2r‹rŠr¦rwrŒr r r r‹ƒs  zMisc.deletecommandcCs|j |j dd|¡¡S)zßSet Tcl internal variable, whether the look and feel should adhere to Motif. A parameter of 1 means adhere to Motif (e.g. no color change if mouse passes over slider). Returns the set value.r’Útk_strictMotif)r2r„r…©reÚbooleanr r r rÃŽs  ÿzMisc.tk_strictMotifcCs|j d¡dS)zDChange the color scheme to light brown as used in Tk 3.6 and before.Ú tk_bisqueN©r2r…rŽr r r rƘszMisc.tk_bisquecOs(|j dt|ƒtt| ¡ƒƒ¡dS)a Set a new color scheme for all widget elements. A single color as argument will cause that all colors of Tk widget elements are derived from this. Alternatively several keyword parameters and its associated colors can be given. The following keywords are valid: activeBackground, foreground, selectColor, activeForeground, highlightBackground, selectBackground, background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.)Ú tk_setPaletteN)r2r…rrr%©reÚargsÚkwr r r rÈœs ÿÿzMisc.tk_setPaletter|cCs|j dd|¡dS)zƒWait until the variable is modified. A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.Útkwaitr¡NrÇrŒr r r Ú wait_variableªszMisc.wait_variablecCs"|dkr |}|j dd|j¡dS)zQWait until a WIDGET is destroyed. If no parameter is given self is used.NrÌÚwindow©r2r…Ú_w©rerÎr r r Ú wait_window²szMisc.wait_windowcCs"|dkr |}|j dd|j¡dS)zxWait until the visibility of a WIDGET changes (e.g. it appears). If no parameter is given self is used.NrÌZ visibilityrÏrÑr r r Úwait_visibilityºszMisc.wait_visibilityÚ1cCs|j ||¡dS)zSet Tcl variable NAME to VALUE.N)r2Úsetvar)rerYr r r r rÕÃsz Misc.setvarcCs |j |¡S)z"Return value of Tcl variable NAME.)r2ÚgetvarrŒr r r rÖÇsz Misc.getvarc CsBz|j |¡WStk r<}ztt|ƒƒ‚W5d}~XYnXdSr•)r2r¹rºrwr©rerfÚexcr r r r¹Ësz Misc.getintc CsBz|j |¡WStk r<}ztt|ƒƒ‚W5d}~XYnXdSr•)r2r»rºrwrr×r r r r»ÑszMisc.getdoublecCs0z|j |¡WStk r*tdƒ‚YnXdS)zPReturn a boolean value for Tcl boolean values true and false given as parameter.r¾N)r2r„rºrw)rerfr r r r„×szMisc.getbooleancCs|j d|j¡dS)zÍDirect input focus to this widget. If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.rTNrÏrŽr r r Ú focus_setÞszMisc.focus_setcCs|j dd|j¡dS)ztDirect input focus to this widget even if the application does not have the focus. Use with caution!rTz-forceNrÏrŽr r r Ú focus_forceçszMisc.focus_forcecCs&|j d¡}|dks|sdS| |¡S)zÔReturn the widget which has currently the focus in the application. Use focus_displayof to allow working with several displays. Return None if application does not have the focus.rTÚnoneN)r2r…Ú _nametowidgetrŒr r r Ú focus_getís  zMisc.focus_getcCs,|j dd|j¡}|dks|s"dS| |¡S)z¥Return the widget which has currently the focus on the display where this widget is located. Return None if the application does not have the focus.rTú -displayofrÛN©r2r…rÐrÜrŒr r r Úfocus_displayoføs zMisc.focus_displayofcCs,|j dd|j¡}|dks|s"dS| |¡S)zyReturn the widget which would have the focus if top level for this widget gets the focus from the window manager.rTz-lastforrÛNrßrŒr r r Ú focus_lastfors zMisc.focus_lastforcCs|j d¡dS)zXThe widget under mouse will get automatically focus. Can not be disabled easily.Útk_focusFollowsMouseNrÇrŽr r r râszMisc.tk_focusFollowsMousecCs"|j d|j¡}|sdS| |¡S)anReturn the next widget in the focus order which follows widget which has currently the focus. The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.Ú tk_focusNextNrßrŒr r r rã s zMisc.tk_focusNextcCs"|j d|j¡}|sdS| |¡S)zHReturn previous widget in the focus order. See tk_focusNext for details.Ú tk_focusPrevNrßrŒr r r räszMisc.tk_focusPrevcsNˆsˆj d|¡dS‡‡‡‡fdd„}ˆj|_ˆ |¡‰ˆj d|ˆ¡SdS)aCall function once after given time. MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.ÚafterNcs8z ˆˆŽW5zˆ ˆ¡Wntk r0YnXXdSr•)r‹rºr ©rÊÚfuncrYrer r Úcallit,s  zMisc.after..callit)r2r…rArž)reZmsrçrÊrèr rær rå s z Misc.aftercGs|jd|f|žŽS)z–Call FUNC once if the Tcl main loop has no event to process. Return an identifier to cancel the scheduling with after_cancel.Zidle)rå)rerçrÊr r r Ú after_idle8szMisc.after_idlecCsd|s tdƒ‚z.|j dd|¡}|j |¡d}| |¡Wntk rNYnX|j dd|¡dS)z˜Cancel scheduling of function identified with ID. Identifier returned by after or after_idle must be given as first parameter. z?id must be a valid identifier returned from after or after_idlerår}rZcancelN)rwr2r…r.r‹rº)rer˜ÚdataZscriptr r r Ú after_cancel@szMisc.after_cancelrcCs|j d| |¡¡dS)zRing a display's bell.)ÚbellN)r2r…Ú _displayof©reÚ displayofr r r rìQsz Misc.bellcKsdd|krN|jdkrNz d|d<|j d| |¡¡WStk rL|d=YnX|j d| |¡¡S)aïRetrieve data from the clipboard on window's display. The window keyword defaults to the root window of the Tkinter application. The type keyword specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING, except on X11, where the default is to try UTF8_STRING and fall back to STRING. This command is equivalent to: selection_get(CLIPBOARD) r Úx11Ú UTF8_STRING)Ú clipboardr”)Ú_windowingsystemr2r…Ú_optionsrº©rerËr r r Ú clipboard_getVs zMisc.clipboard_getcKs,d|kr|j|d<|j d| |¡¡dS)z‘Clear the data in the Tk clipboard. A widget specified for the optional displayof keyword argument specifies the target display.rï)ròÚclearN©rÐr2r…rôrõr r r Úclipboard_clearms zMisc.clipboard_clearcKs4d|kr|j|d<|j d| |¡d|f¡dS)zÊAppend STRING to the Tk clipboard. A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.rï)ròrcú--Nrø)reÚstringrËr r r Úclipboard_appendus  ÿzMisc.clipboard_appendcCs$|j dd|j¡}|sdS| |¡S)zOReturn widget which has currently the grab in this application or None.ÚgrabZcurrentNrßrŒr r r Ú grab_current€szMisc.grab_currentcCs|j dd|j¡dS)z.Release grab for this widget if currently set.rýÚreleaseNrÏrŽr r r Ú grab_release‡szMisc.grab_releasecCs|j dd|j¡dS)zwSet grab for this widget. A grab directs all events to this and descendant widgets in the application.rýr’NrÏrŽr r r Úgrab_set‹sz Misc.grab_setcCs|j ddd|j¡dS)zÊSet global grab for this widget. A global grab directs all events to this and descendant widgets on the display. Use with caution - other applications do not get events anymore.rýr’z-globalNrÏrŽr r r Úgrab_set_global’szMisc.grab_set_globalcCs"|j dd|j¡}|dkrd}|S)zYReturn None, "local" or "global" if this widget has no, a local or a global grab.rýÚstatusrÛNrÏ)rerr r r Ú grab_statusšszMisc.grab_statuscCs|j dd|||¡dS)z©Set a VALUE (second parameter) for an option PATTERN (first parameter). An optional third parameter gives the numeric priority (defaults to 80).Úoptionr NrÇ)reÚpatternr Úpriorityr r r Ú option_add¡szMisc.option_addcCs|j dd¡dS)zPClear the option database. It will be reloaded if option_add is called.rr÷NrÇrŽr r r Ú option_clear©szMisc.option_clearcCs|j dd|j||¡S)z‡Return the value for an option NAME for this widget with CLASSNAME. Values with higher priority override lower values.rr”rÏ)rerYÚ classNamer r r Ú option_get¯szMisc.option_getcCs|j dd||¡dS)zvRead file FILENAME into the option database. An optional second parameter gives the numeric priority.rZreadfileNrÇ)reZfileNamerr r r Úoption_readfile¶szMisc.option_readfilecKs,d|kr|j|d<|j d| |¡¡dS)zClear the current X selection.rï)Ú selectionr÷Nrørõr r r Úselection_clear½s zMisc.selection_clearcKsvd|kr|j|d<d|kr`|jdkr`z d|d<|j d| |¡¡WStk r^|d=YnX|j d| |¡¡S)a•Return the contents of the current X selection. A keyword parameter selection specifies the name of the selection and defaults to PRIMARY. A keyword parameter displayof specifies a widget on the display to use. A keyword parameter type specifies the form of data to be fetched, defaulting to STRING except on X11, where UTF8_STRING is tried before STRING.rïr rðrñ)r r”)rÐrór2r…rôrºrõr r r Ú selection_getÂs   zMisc.selection_getcKs.| |¡}|j d| |¡|j|f¡dS)aSpecify a function COMMAND to call if the X selection owned by this widget is queried by another application. This function must return the contents of the selection. The function will be called with the arguments OFFSET and LENGTH which allows the chunking of very long selections. The following keyword parameters can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).)r ZhandleN)ržr2r…rôrÐ)reÚcommandrËrYr r r Úselection_handleÔs ÿzMisc.selection_handlecKs"|j d| |¡|jf¡dS)z‚Become owner of X selection. A keyword parameter selection specifies the name of the selection (default PRIMARY).©r ZownN)r2r…rôrÐrõr r r Ú selection_ownäs ÿÿzMisc.selection_owncKs:d|kr|j|d<|j d| |¡¡}|s0dS| |¡S)zÚReturn owner of X selection. The following keyword parameter can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).rïrN)rÐr2r…rôrÜ)rerËrYr r r Úselection_own_getìs  zMisc.selection_own_getcGs|j d||f|¡S)zDSend Tcl command CMD to different interpreter INTERP to be executed.ÚsendrÇ)reZinterpÚcmdrÊr r r røsz Misc.sendcCs|j d|j|¡dS)z(Lower this widget in the stacking order.ÚlowerNrÏ)reÚ belowThisr r r rüsz Misc.lowercCs|j d|j|¡dS)z(Raise this widget in the stacking order.ÚraiseNrÏ)reÚ aboveThisr r r Útkraisesz Misc.tkraisecCs(d| |¡|f}|j |j |¡¡S)z*Return integer which represents atom NAME.)ÚwinfoZatom)rír2r¹r…)rerYrïrÊr r r Ú winfo_atomszMisc.winfo_atomcCs d| |¡|f}|j |¡S)z'Return name of atom with identifier ID.)rZatomname©rír2r…©rer˜rïrÊr r r Úwinfo_atomname s ÿÿzMisc.winfo_atomnamecCs|j |j dd|j¡¡S)z7Return number of cells in the colormap for this widget.rZcells©r2r¹r…rÐrŽr r r Ú winfo_cellssÿzMisc.winfo_cellsc CsRg}|j |j dd|j¡¡D].}z| | |¡¡Wqtk rJYqXq|S)z?Return a list of all widgets which are children of this widget.rÚchildren)r2r.r…rÐrcrÜÚKeyError)reÚresultÚchildr r r Úwinfo_childrensÿzMisc.winfo_childrencCs|j dd|j¡S)z(Return window class name of this widget.rÚclassrÏrŽr r r Ú winfo_class#szMisc.winfo_classcCs|j |j dd|j¡¡S)z?Return True if at the last color request the colormap was full.rZ colormapfull©r2r„r…rÐrŽr r r Úwinfo_colormapfull'sÿzMisc.winfo_colormapfullcCs4d| |¡||f}|j |¡}|s*dS| |¡S)z@Return the widget which is at the root coordinates ROOTX, ROOTY.)rZ containingN)rír2r…rÜ)reZrootXZrootYrïrÊrYr r r Úwinfo_containing,sÿÿ zMisc.winfo_containingcCs|j |j dd|j¡¡S)z$Return the number of bits per pixel.rZdepthr!rŽr r r Ú winfo_depth4szMisc.winfo_depthcCs|j |j dd|j¡¡S)z"Return true if this widget exists.rr~r!rŽr r r Ú winfo_exists8sÿzMisc.winfo_existscCs|j |j dd|j|¡¡S)zWReturn the number of pixels for the given distance NUMBER (e.g. "3c") as float.rZfpixels©r2r»r…rЩreÚnumberr r r Ú winfo_fpixels=s  ÿzMisc.winfo_fpixelscCs|j dd|j¡S)zFReturn geometry string for this widget in the form "widthxheight+X+Y".rÚgeometryrÏrŽr r r Úwinfo_geometryCszMisc.winfo_geometrycCs|j |j dd|j¡¡S)zReturn height of this widget.rrXr!rŽr r r Ú winfo_heightGsÿzMisc.winfo_heightcCst|j dd|j¡dƒS)z%Return identifier ID for this widget.rr˜r)rar2r…rÐrŽr r r Úwinfo_idLsz Misc.winfo_idcCs"d| |¡}|j |j |¡¡S)z9Return the name of all Tcl interpreters for this display.)rZinterps)rír2r.r…)rerïrÊr r r Ú winfo_interpsPszMisc.winfo_interpscCs|j |j dd|j¡¡S)z%Return true if this widget is mapped.rZismappedr!rŽr r r Úwinfo_ismappedUsÿzMisc.winfo_ismappedcCs|j dd|j¡S)z/Return the window manager name for this widget.rZmanagerrÏrŽr r r Ú winfo_managerZszMisc.winfo_managercCs|j dd|j¡S)zReturn the name of this widget.rrYrÏrŽr r r Ú winfo_name^szMisc.winfo_namecCs|j dd|j¡S)z-Return the name of the parent of this widget.rÚparentrÏrŽr r r Ú winfo_parentbszMisc.winfo_parentcCs d| |¡|f}|j |¡S)z.Return the pathname of the widget given by ID.)rÚpathnamerrr r r Úwinfo_pathnamefs ÿÿzMisc.winfo_pathnamecCs|j |j dd|j|¡¡S)z'Rounded integer value of winfo_fpixels.rZpixelsr!r0r r r Ú winfo_pixelslsÿzMisc.winfo_pixelscCs|j |j dd|j¡¡S)z:Return the x coordinate of the pointer on the root window.rZpointerxr!rŽr r r Úwinfo_pointerxqsÿzMisc.winfo_pointerxcCs| |j dd|j¡¡S)zHReturn a tuple of x and y coordinates of the pointer on the root window.rZ pointerxy©Ú_getintsr2r…rÐrŽr r r Úwinfo_pointerxyvsÿzMisc.winfo_pointerxycCs|j |j dd|j¡¡S)z:Return the y coordinate of the pointer on the root window.rZpointeryr!rŽr r r Úwinfo_pointery{sÿzMisc.winfo_pointerycCs|j |j dd|j¡¡S)z'Return requested height of this widget.rZ reqheightr!rŽr r r Úwinfo_reqheight€sÿzMisc.winfo_reqheightcCs|j |j dd|j¡¡S)z&Return requested width of this widget.rZreqwidthr!rŽr r r Úwinfo_reqwidth…sÿzMisc.winfo_reqwidthcCs| |j dd|j|¡¡S)zNReturn a tuple of integer RGB values in range(65536) for color in this widget.rZrgbrA)reZcolorr r r Ú winfo_rgbŠsÿzMisc.winfo_rgbcCs|j |j dd|j¡¡S)zSReturn x coordinate of upper left corner of this widget on the root window.rZrootxr!rŽr r r Ú winfo_rootx�sÿzMisc.winfo_rootxcCs|j |j dd|j¡¡S)zSReturn y coordinate of upper left corner of this widget on the root window.rZrootyr!rŽr r r Ú winfo_rooty•sÿzMisc.winfo_rootycCs|j dd|j¡S)z&Return the screen name of this widget.rÚscreenrÏrŽr r r Ú winfo_screen›szMisc.winfo_screencCs|j |j dd|j¡¡S)zTReturn the number of the cells in the colormap of the screen of this widget.rZ screencellsr!rŽr r r Úwinfo_screencellsŸsÿzMisc.winfo_screencellscCs|j |j dd|j¡¡S)z\Return the number of bits per pixel of the root window of the screen of this widget.rZ screendepthr!rŽr r r Úwinfo_screendepth¥sÿzMisc.winfo_screendepthcCs|j |j dd|j¡¡S)zXReturn the number of pixels of the height of the screen of this widget in pixel.rZ screenheightr!rŽr r r Úwinfo_screenheight«sÿzMisc.winfo_screenheightcCs|j |j dd|j¡¡S)zUReturn the number of pixels of the height of the screen of this widget in mm.rZscreenmmheightr!rŽr r r Úwinfo_screenmmheight±sÿzMisc.winfo_screenmmheightcCs|j |j dd|j¡¡S)zTReturn the number of pixels of the width of the screen of this widget in mm.rZ screenmmwidthr!rŽr r r Úwinfo_screenmmwidth·sÿzMisc.winfo_screenmmwidthcCs|j dd|j¡S)zŸReturn one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the default colormodel of this screen.rZ screenvisualrÏrŽr r r Úwinfo_screenvisual½szMisc.winfo_screenvisualcCs|j |j dd|j¡¡S)zWReturn the number of pixels of the width of the screen of this widget in pixel.rZ screenwidthr!rŽr r r Úwinfo_screenwidthÃsÿzMisc.winfo_screenwidthcCs|j dd|j¡S)zxReturn information of the X-Server of the screen of this widget in the form "XmajorRminor vendor vendorVersion".rZserverrÏrŽr r r Ú winfo_serverÉszMisc.winfo_servercCs| |j dd|j¡¡S)z*Return the toplevel widget of this widget.rÚtoplevel)rÜr2r…rÐrŽr r r Úwinfo_toplevelÎs  ÿzMisc.winfo_toplevelcCs|j |j dd|j¡¡S)zBReturn true if the widget and all its higher ancestors are mapped.rZviewabler!rŽr r r Úwinfo_viewableÓsÿzMisc.winfo_viewablecCs|j dd|j¡S)z—Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.rÚvisualrÏrŽr r r Ú winfo_visualØszMisc.winfo_visualcCs|j dd|j¡S)z7Return the X identifier for the visual for this widget.rZvisualidrÏrŽr r r Úwinfo_visualidÞszMisc.winfo_visualidFcsHˆj ddˆj|rdnd¡}‡fdd„ˆj |¡Dƒ}‡fdd„|DƒS)zäReturn a list of all visuals available for the screen of this widget. Each item in the list consists of a visual name (see winfo_visual), a depth and if includeids is true is given also the X identifier.rZvisualsavailableÚ includeidsNcsg|]}ˆj |¡‘qSr )r2r.r¯rŽr r r¬êsz/Misc.winfo_visualsavailable..csg|]}ˆ |¡‘qSr )Ú_Misc__winfo_parseitemr¯rŽr r r¬ës)r2r…rÐr.)rerZrêr rŽr Úwinfo_visualsavailableâs  ÿzMisc.winfo_visualsavailablecCs$|dd…tt|j|dd…ƒƒS)rNr)rrÚ_Misc__winfo_getint)rer4r r r Z__winfo_parseitemíszMisc.__winfo_parseitemcCs t|dƒS)rr)ra©rerUr r r Z__winfo_getintñszMisc.__winfo_getintcCs|j |j dd|j¡¡S)z§Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the height of the screen.rZ vrootheightr!rŽr r r Úwinfo_vrootheightõsÿzMisc.winfo_vrootheightcCs|j |j dd|j¡¡S)z¤Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.rZ vrootwidthr!rŽr r r Úwinfo_vrootwidthüsÿzMisc.winfo_vrootwidthcCs|j |j dd|j¡¡S)ziReturn the x offset of the virtual root relative to the root window of the screen of this widget.rZvrootxr!rŽr r r Ú winfo_vrootxsÿzMisc.winfo_vrootxcCs|j |j dd|j¡¡S)ziReturn the y offset of the virtual root relative to the root window of the screen of this widget.rZvrootyr!rŽr r r Ú winfo_vrooty sÿzMisc.winfo_vrootycCs|j |j dd|j¡¡S)z Return the width of this widget.rrWr!rŽr r r Ú winfo_widthsÿzMisc.winfo_widthcCs|j |j dd|j¡¡S)zVReturn the x coordinate of the upper left corner of this widget in the parent.rrUr!rŽr r r Úwinfo_xsÿz Misc.winfo_xcCs|j |j dd|j¡¡S)zVReturn the y coordinate of the upper left corner of this widget in the parent.rrVr!rŽr r r Úwinfo_ysÿz Misc.winfo_ycCs|j d¡dS)zEEnter event loop until all pending events have been processed by Tcl.r!NrÇrŽr r r r! sz Misc.updatecCs|j dd¡dS)zžEnter event loop until all idle callbacks have been called. This will update the display of windows but not process events caused by the user.r!Z idletasksNrÇrŽr r r Úupdate_idletasks$szMisc.update_idletaskscCs6|dkr |j |j d|j¡¡S|j d|j|¡dS)a,Set or get the list of bindtags for this widget. With no argument return the list of all bindtags associated with this widget. With a list of strings as argument the bindtags are set to this list. The bindtags determine in which order events are processed (see bind).NÚbindtags©r2r.r…rÐ)reZtagListr r r rg*s ÿz Misc.bindtagsrcCs’t|tƒr |j |||f¡nn|rd| ||j|¡}d|r>dp@d||jf}|j |||f¡|S|rz|j ||f¡S|j |j |¡¡SdS)rz"%sif {"[%s %s]" == "break"} break ú+rZN)rrr2r…ržÚ _substituteÚ_subst_format_strr.)rerqÚsequencerçr Ú needcleanupÚfuncidrr r r Ú_bind7s"  ÿ ÿþz Misc._bindcCs| d|jf|||¡S)aOBind to this widget at event SEQUENCE a call to function FUNC. SEQUENCE is a string of concatenated event patterns. An event pattern is of the form where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, B3, Alt, Button4, B4, Double, Button5, B5 Triple, Mod1, M1. TYPE is one of Activate, Enter, Map, ButtonPress, Button, Expose, Motion, ButtonRelease FocusIn, MouseWheel, Circulate, FocusOut, Property, Colormap, Gravity Reparent, Configure, KeyPress, Key, Unmap, Deactivate, KeyRelease Visibility, Destroy, Leave and DETAIL is the button number for ButtonPress, ButtonRelease and DETAIL is the Keysym for KeyPress and KeyRelease. Examples are for pressing Control and mouse button 1 or for pressing A and the Alt key (KeyPress can be omitted). An event pattern can also be a virtual event of the form <> where AString can be arbitrary. This event can be generated by event_generate. If events are concatenated they must appear shortly after each other. FUNC will be called if the event sequence occurs with an instance of Event as argument. If the return value of FUNC is "break" no further bound function is invoked. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. Bind will return an identifier to allow deletion of the bound function with unbind without memory leak. If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.Úbind©rorЩrerlrçr r r r rpIs'z Misc.bindcCs&|j d|j|d¡|r"| |¡dS)zWUnbind for this widget for event SEQUENCE the function identified with FUNCID.rprZN©r2r…rÐr‹)rerlrnr r r Úunbindrsz Misc.unbindcCs| d|||d¡S)aBind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.)rpÚallr©rorrr r r Úbind_allysz Misc.bind_allcCs|j dd|d¡dS)z8Unbind for all widgets for event SEQUENCE all functions.rprurZNrÇ)rerlr r r Ú unbind_all€szMisc.unbind_allcCs| d|f|||d¡S)a=Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.rprrv)rer rlrçr r r r Ú bind_class„szMisc.bind_classcCs|j d||d¡dS)zWUnbind for all widgets with bindtag CLASSNAME for event SEQUENCE all functions.rprZNrÇ)rer rlr r r Ú unbind_classŽszMisc.unbind_classcCs|j |¡dS)zCall the mainloop of Tk.N)r2r¿)rerhr r r r¿“sz Misc.mainloopcCs|j ¡dS)z8Quit the Tcl interpreter. All widgets will be destroyed.N)r2ÚquitrŽr r r r{—sz Misc.quitcCs"|rtt|jj|j |¡ƒƒSdSrt)rrr2r¹r.©rerûr r r rB›sz Misc._getintscCs"|rtt|jj|j |¡ƒƒSdSrt)rrr2r»r.r|r r r Ú _getdoubles szMisc._getdoublescCs|r|j |¡SdSrt)r2r„r|r r r Ú _getboolean¥szMisc._getbooleancCs"|r d|fS|dkrd|jfSdS)rrÞNr ©rÐrîr r r ríªs  zMisc._displayofcCsBz | ¡jWStk r<|j dd¡}| ¡_|YSXdS)rr2ZwindowingsystemN)rZ_windowingsystem_cachedr"r2r…)reZwsr r r ró²s   ÿ zMisc._windowingsystemcCsÖ|rt||fƒ}nt|ƒ}d}| ¡D]ª\}}|dk r&|ddkrN|dd…}t|ƒrb| |¡}n^t|ttfƒrÀg}|D]<}t|tƒr–| t |ƒ¡qxt|t ƒr°| t |ƒ¡qxqÀqxd  |¡}|d||f}q&|S)rr NéÿÿÿÿÚ_rr-) r+r%Úcallableržrrrrarcrrr)rer&rËrr)r*Znvrr r r rô¼s*     z Misc._optionscCsNt|ƒ d¡}|}|ds.| ¡}|dd…}|D]}|s>qJ|j|}q2|S)zPReturn the Tkinter instance of a widget identified by its Tcl name NAME.Ú.rrN)rÚsplitrr#)rerYÚwrhr r r Ú nametowidgetÖs  zMisc.nametowidgetcCs�t|||ƒj}tt|ƒƒ}z |j}Wntk r8YnXz||j}Wntk r\YnX|j ||¡|rŒ|j dkr€g|_ |j   |¡|S)zÏReturn a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.N) r–r—r_r˜r™r"rAr2ršrŠrc)rerçÚsubstrmrœrYr r r ržés     zMisc._registercCs|}|jr|j}q|S)r©rˆ)rer…r r r rsz Misc._root)z%#z%bz%fz%hz%kz%sz%tz%wz%xz%yz%Az%Ez%Kz%Nz%Wz%Tz%Xz%Yz%DrcsÀt|ƒt|jƒkr|S|jj}|jj‰‡fdd„}|\}}}}}} } } } } }}}}}}}}}tƒ}ˆ|ƒ|_||ƒ|_z||ƒ|_Wnt k r˜YnX||ƒ|_ ||ƒ|_ || ƒ|_ || ƒ|_ || ƒ|_|| ƒ|_|| ƒ|_||_z||ƒ|_Wnt k �r YnX||_||ƒ|_zt|ƒ|_Wntk �rF||_YnXz| |¡|_Wntk �rt||_YnX||ƒ|_||ƒ|_zˆ|ƒ|_Wn tt fk �r¸d|_YnX|fS)rc s,z ˆ|ƒWSttfk r&|YSXdS)z?Tk changed behavior in 8.4.2, returning "??" rather more often.N)rwrºrÀ©r¹r r Ú getint_events z&Misc._substitute..getint_eventr)rÚ _subst_formatr2r„r¹rGÚserialrSrTrºrXrRrNÚtimerWrUrVrLrMrQZ keysym_numr8r rwrÜÚwidgetr$Zx_rootZy_rootrP)rerÊr„rŠZnsignÚbrœÚhr)rfr4r…rUrVÚAÚEÚKÚNÚWÚTÚXÚYÚDÚer r‰r rj sT *               zMisc._substitutecCs(t ¡\}}}| ¡}| |||¡dSrt)ÚsysÚexc_inforÚreport_callback_exception)rerØÚvalÚtbrrr r r Ú_report_exceptionHszMisc._report_exceptioncGs\i}|j |jj|Ž¡D]>}|j |¡}|ddd…f|dd…||ddd…<q|S)z;Call Tcl configure command and return the result as a dict.rrN©r2r.r…)rerÊr&rUr r r Ú _getconfigureNs  0zMisc._getconfigurecGs2|j |jj|Ž¡}|ddd…f|dd…S)Nrrr¡)rerÊrUr r r Ú_getconfigure1VszMisc._getconfigure1cCs‚|rt||fƒ}n |rt|ƒ}|dkr:| t|j|fƒ¡St|tƒr^| t|j|d|fƒ¡S|j t|j|fƒ|  |¡¡dS)rNr-) r+r¢rrÐrrr£r2r…rô)rerr&rËr r r Ú _configureZs zMisc._configurecKs| d||¡S)zÌConfigure resources of a widget. The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys. Ú configure©r¤©rer&rËr r r r¥gszMisc.configurecCs|j |jdd|¡S)z4Return the resource value for a KEY given as string.Úcgetr-rÏ©rer6r r r r¨rsz Misc.cgetcCs| ||i¡dSr•)r¥©rer6r r r r Ú __setitem__xszMisc.__setitem__cs*|jj‰‡fdd„ˆ|j |jd¡ƒDƒS)z3Return a list of all resource names of this widget.cs g|]}ˆ|ƒddd…‘qS)rrNr r¯r«r r r¬~szMisc.keys..r¥rhrŽr r«r ri{s ÿz Misc.keyscCs|jS)z+Return the window path name of this widget.rrŽr r r rF�sz Misc.__str__cCsd|jj|jj|jfS)Nz<%s.%s object %s>)r²rBrCrÐrŽr r r rj…s ÿz Misc.__repr__Ú_noarg_cCs:|tjkr"| |j dd|j¡¡S|j dd|j|¡dS)aSet or get the status for propagation of geometry information. A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned. ÚpackÚ propagateN©rÁr¬r~r2r…rЩreÚflagr r r Úpack_propagateŒs  ÿzMisc.pack_propagatecs(‡fdd„ˆj ˆj ddˆj¡¡DƒS)úHReturn a list of all slaves of this widget in its packing order.csg|]}ˆ |¡‘qSr ©rÜr¯rŽr r r¬žsz$Misc.pack_slaves..r­ÚslavesrhrŽr rŽr Ú pack_slaves›s  ÿÿzMisc.pack_slavescs(‡fdd„ˆj ˆj ddˆj¡¡DƒS)r³csg|]}ˆ |¡‘qSr r´r¯rŽr r r¬¨sz%Misc.place_slaves..ÚplacerµrhrŽr rŽr Ú place_slaves¥s ÿÿÿzMisc.place_slavescCs|j dd|j|¡dS)z�The anchor value controls how to place the grid within the master when no row/column has any weight. The default anchor is nw.ÚgridÚanchorNrÏ)rerºr r r Ú grid_anchor¯szMisc.grid_anchorcCsZdd|jf}|dk r(|dk r(|||f}|dk rD|dk rD|||f}| |jj|Ž¡pXdS)aÓReturn a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid. If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell. The returned integers specify the offset of the upper left corner in the master widget and the width and height. r¹ÚbboxN)rÐrBr2r…)reÚcolumnÚrowZcol2Zrow2rÊr r r Ú grid_bbox¸s   zMisc.grid_bboxc Csht|ttjfƒrdz:t|ƒ}|s$WdSd|kr:|j |¡WS|j |¡WSWnttfk rbYnX|S)Nrƒ) rrÚ_tkinterZTcl_Objr2r»r¹rwrº)rer Zsvaluer r r Ú_gridconvvalueÍszMisc._gridconvvaluecCs°t|tƒrJ|sJ|dd…dkr*|dd…}|dd…dkrBd|}|f}n | ||¡}|s|t|j|j d||j|¡|jd�S|j d||j|f|¡}t|ƒdkr¬| |¡SdS)rr€Nr�rr-r¹)r3) rrrôr7r2r…rÐrÁr)rerÚindexr&rËÚoptionsrr r r Ú_grid_configureÛs(  ý ÿÿ zMisc._grid_configurecKs| d|||¡S)zãConfigure column INDEX of a grid. Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).Úcolumnconfigure©rÄ©rerÂr&rËr r r Úgrid_columnconfigureðszMisc.grid_columnconfigurec Cs | |j dd|j||¡¡pdS)z”Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.r¹ÚlocationNrA©rerUrVr r r Ú grid_locationúsÿÿþzMisc.grid_locationcCs:|tjkr"| |j dd|j¡¡S|j dd|j|¡dS)aSet or get the status for propagation of geometry information. A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned. r¹r®Nr¯r°r r r Úgrid_propagates  ÿzMisc.grid_propagatecKs| d|||¡S)zÚConfigure row INDEX of a grid. Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).Ú rowconfigurerÆrÇr r r Úgrid_rowconfigureszMisc.grid_rowconfigurecCs| |j dd|j¡¡pdS)z.r¹rµrh)rer¾r½rÊr rŽr Ú grid_slaves s    ÿÿzMisc.grid_slavescGsdd|f|}|j |¡dS)z›Bind a virtual event VIRTUAL (of the form <>) to an event SEQUENCE such that the virtual event is triggered whenever SEQUENCE occurs.Úeventr NrÇ©reÚvirtualÚ sequencesrÊr r r Ú event_add/szMisc.event_addcGsdd|f|}|j |¡dS)z-Unbind a virtual event VIRTUAL from SEQUENCE.rÒÚdeleteNrÇrÓr r r Ú event_delete6szMisc.event_deletecKsDdd|j|f}| ¡D]\}}|d|t|ƒf}q|j |¡dS)z‚Generate an event SEQUENCE. Additional keyword arguments specify parameter of the event (e.g. x, y, rootx, rooty).rÒZgenerateú-%sN)rÐr%rr2r…)rerlrËrÊr)r*r r r Úevent_generate;szMisc.event_generatecCs|j |j dd|¡¡S)zuReturn a list of all virtual events or the information about the SEQUENCE bound to the virtual event VIRTUAL.rÒr}r¡)rerÔr r r Ú event_infoDsÿzMisc.event_infocCs|j |j dd¡¡S)z*Return a list of all existing image names.ÚimageÚnamesr¡rŽr r r Ú image_namesLszMisc.image_namescCs|j |j dd¡¡S)z?Return a list of all available image types (e.g. photo bitmap).rÜÚtypesr¡rŽr r r Ú image_typesPszMisc.image_types)N)r|)N)N)r|rÔ)r|)N)r)N)N)N)N)r)r)r)r)r)F)N)r)NNN)N)NNN)NNN)r)N)Nr)N)N)NNNN)NN)N)¬rArBrCrkÚ_last_child_idsrŠrÂr‹rÃrÆrÈrÍZwaitvarrÒrÓrÕrÖr¹r»r„rÙrTrÚrÝràrárârãrärårérërìrörùrürþrrrrrr r r rrrrrrrrÚliftrr r"r'r)r+r,r-r.r2r4r5r6r7r8r9r:r<r>r?r@rCrDrErFrGrHrIrKrLrMrNrOrPrQrRrSrUrVrXrYr\r[r]r_r`rarbrcrdrer!rfrgrorprtrwrxryrzr¿r{rBr}r~ríÚpropertyrórôr†rÜržÚregisterrr‹rrkrjr r¢r£r¤r¥Úconfigr¨Ú __getitem__r«rirFrjr¬r²r®r¶rµr¸r»rºr¿r¼rÁrÄrÈrÅrËrÌrÎrÍrÐrÏrÑrÖrØrÚrÛrÞràr r r r rÁmsP                          )       =                  rÁc@s eZdZdZdd„Zdd„ZdS)r–zwInternal class. Stores function to call when some user defined Tcl function is called e.g. after an event occurred.cCs||_||_||_dS)z(Store FUNC, SUBST and WIDGET as members.N)rçr‡rŽ)rerçr‡rŽr r r r‰YszCallWrapper.__init__cGsLz|jr|j|Ž}|j|ŽWStk r2‚Yn|j ¡YnXdS)z3Apply first function SUBST to arguments, than FUNC.N)r‡rçrxrŽr ©rerÊr r r r—_s  zCallWrapper.__call__N©rArBrCrkr‰r—r r r r r–Usr–c@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚXViewzXMix-in class for querying and changing the horizontal position of a widget's window.cGs(|jj|jdf|žŽ}|s$| |¡SdS)z5Query and change the horizontal position of the view.ÚxviewN©r2r…rÐr}©rerÊrr r r rêosz XView.xviewcCs|j |jdd|¡dS)zsAdjusts the view in the window so that FRACTION of the total width of the canvas is off-screen to the left.rêÚmovetoNrÏ©reÚfractionr r r Ú xview_movetouszXView.xview_movetocCs|j |jdd||¡dS)z\Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).rêÚscrollNrÏ©rer1rqr r r Ú xview_scrollzszXView.xview_scrollN)rArBrCrkrêrðrór r r r réksréc@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚYViewzVMix-in class for querying and changing the vertical position of a widget's window.cGs(|jj|jdf|žŽ}|s$| |¡SdS)z3Query and change the vertical position of the view.ÚyviewNrërìr r r rõ„sz YView.yviewcCs|j |jdd|¡dS)zsAdjusts the view in the window so that FRACTION of the total height of the canvas is off-screen to the top.rõríNrÏrîr r r Ú yview_movetoŠszYView.yview_movetocCs|j |jdd||¡dS)z\Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).rõrñNrÏròr r r Ú yview_scroll�szYView.yview_scrollN)rArBrCrkrõrör÷r r r r rô€srôc@s²eZdZdZdBdd„ZeZdd„ZeZdCdd„ZeZ d d „Z e Z dDd d „Z e Z d d„ZeZdEdd„ZeZdd„ZeZdd„ZeZdFdd„ZeZdGdd„ZeZdHdd„ZeZdIdd„ZeZdd„ZeZdJdd „Z e Z!dKd!d"„Z"e"Z#dLd$d%„Z$e$Z%dMd&d'„Z&e&Z'dNd(d)„Z(e(Z)d*d+„Z*e*Z+dOd,d-„Z,e,Z-dPd.d/„Z.e.Z/dQd0d1„Z0e0Z1dRd2d3„Z2e2Z3dSd4d5„Z4e4Z5dTd6d7„Z6e6Z7dUd8d9„Z8e8Z9dVd:d;„Z:e:Z;dWdd?„Z>e>Z?d@dA„Z@e@ZAdS)YÚWmzAProvides functions for the communication with the window manager.Nc Cs | |j dd|j||||¡¡S)zÕInstruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argument is given.ÚwmÚaspectrA)reZminNumerZminDenomZmaxNumerZmaxDenomr r r Ú wm_aspect˜sþÿz Wm.wm_aspectcGsdd|jf|}|j |¡S)aÅThis subcommand returns or sets platform specific attributes The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows: On Windows, -disabled gets or sets whether the window is in a disabled state. -toolwindow gets or sets the style of the window to toolwindow (as defined in the MSDN). -topmost gets or sets whether this is a topmost window (displays above all other windows). On Macintosh, XXXXX On Unix, there are currently no special attribute values. rùÚ attributes)rÐr2r…rçr r r Ú wm_attributes¥szWm.wm_attributescCs|j dd|j|¡S)zVStore NAME in WM_CLIENT_MACHINE property of this widget. Return current value.rùÚclientrÏrŒr r r Ú wm_client¼sz Wm.wm_clientcsZt|ƒdkr|f}ddˆjf|}|r4ˆj |¡n"‡fdd„ˆj ˆj |¡¡DƒSdS)zÛStore list of window names (WLIST) into WM_COLORMAPWINDOWS property of this widget. This list contains windows whose colormaps differ from their parents. Return current list of widgets if WLIST is empty.rrùÚcolormapwindowscsg|]}ˆ |¡‘qSr r´r¯rŽr r r¬Ísÿz)Wm.wm_colormapwindows..N)rrÐr2r…r.)reZwlistrÊr rŽr Úwm_colormapwindowsÃs  ÿzWm.wm_colormapwindowscCs|j dd|j|¡S)z�Store VALUE in WM_COMMAND property. It is the command which shall be used to invoke the application. Return current command if VALUE is None.rùrrÏr‘r r r Ú wm_commandÒsz Wm.wm_commandcCs|j dd|j¡S)zˆDeiconify this widget. If it was never mapped it will not be mapped. On Windows it will raise this widget and give it the focus.rùÚ deiconifyrÏrŽr r r Ú wm_deiconifyÚszWm.wm_deiconifycCs|j dd|j|¡S)zÑSet focus model to MODEL. "active" means that this widget will claim the focus itself, "passive" means that the window manager shall give the focus. Return current focus model if MODEL is None.rùÚ focusmodelrÏ)reZmodelr r r Ú wm_focusmodelászWm.wm_focusmodelcCs|j dd|¡dS)aAThe window will be unmapped from the screen and will no longer be managed by wm. toplevel windows will be treated like frame windows once they are no longer managed by wm, however, the menu option configuration will be remembered and the menus will return once the widget is managed again.rùÚforgetNrÇrÑr r r Ú wm_forgetész Wm.wm_forgetcCs|j dd|j¡S)zAReturn identifier for decorative frame of this widget if present.rùÚframerÏrŽr r r Úwm_frameósz Wm.wm_framecCs|j dd|j|¡S)ziSet geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return current value if None is given.rùr3rÏ)reZ newGeometryr r r Ú wm_geometryùszWm.wm_geometryc Cs | |j dd|j||||¡¡S)aInstruct the window manager that this widget shall only be resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the number of grid units requested in Tk_GeometryRequest.rùr¹rA)reZ baseWidthZ baseHeightZwidthIncZ heightIncr r r Úwm_grids þz Wm.wm_gridcCs|j dd|j|¡S)z~Set the group leader widgets for related widgets to PATHNAME. Return the group leader of this widget if None is given.rùÚgrouprÏ©reZpathNamer r r Úwm_group sz Wm.wm_groupcCs2|r|j dd|jd|¡S|j dd|j|¡SdS)aŸSet bitmap for the iconified widget to BITMAP. Return the bitmap if None is given. Under Windows, the DEFAULT parameter can be used to set the icon for the widget and any descendents that don't have an icon set explicitly. DEFAULT can be the relative path to a .ico file (example: root.iconbitmap(default='myicon.ico') ). See Tk documentation for more information.rùÚ iconbitmapú-defaultNrÏ)reÚbitmapÚdefaultr r r Ú wm_iconbitmaps zWm.wm_iconbitmapcCs|j dd|j¡S)zDisplay widget as icon.rùÚiconifyrÏrŽr r r Ú wm_iconify$sz Wm.wm_iconifycCs|j dd|j|¡S)zVSet mask for the icon bitmap of this widget. Return the mask if None is given.rùÚiconmaskrÏ)rerr r r Ú wm_iconmask*szWm.wm_iconmaskcCs|j dd|j|¡S)zSSet the name of the icon for this widget. Return the name if None is given.rùÚiconnamerÏ)reZnewNamer r r Ú wm_iconname1szWm.wm_iconnameFcGs<|r |jjdd|jdf|žŽn|jjdd|jf|žŽdS)aŸSets the titlebar icon for this window based on the named photo images passed through args. If default is True, this is applied to all future created toplevels as well. The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not reflected to the titlebar icons. Multiple images are accepted to allow different images sizes to be provided. The window manager may scale provided icons to an appropriate size. On Windows, the images are packed into a Windows icon structure. This will override an icon specified to wm_iconbitmap, and vice versa. On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. An icon specified by wm_iconbitmap may exist simultaneously. On Macintosh, this currently does nothing.rùÚ iconphotorNrÏ)rerrÊr r r Ú wm_iconphoto8szWm.wm_iconphotoc Cs| |j dd|j||¡¡S)z�Set the position of the icon of this widget to X and Y. Return a tuple of the current values of X and X if None is given.rùÚ iconpositionrArÊr r r Úwm_iconpositionSs ÿzWm.wm_iconpositioncCs|j dd|j|¡S)zgSet widget PATHNAME to be displayed instead of icon. Return the current value if None is given.rùÚ iconwindowrÏrr r r Ú wm_iconwindow[szWm.wm_iconwindowcCs|j dd|¡dS)z–The widget specified will become a stand alone top-level window. The window will be decorated with the window managers title bar, etc.rùÚmanageNrÇ)rerŽr r r Ú wm_managebsz Wm.wm_managec Cs| |j dd|j||¡¡S)z¢Set max WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.rùÚmaxsizerA©rerWrXr r r Ú wm_maxsizejs ÿz Wm.wm_maxsizec Cs| |j dd|j||¡¡S)z¢Set min WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.rùÚminsizerAr$r r r Ú wm_minsizess ÿz Wm.wm_minsizecCs| |j dd|j|¡¡S)zˆInstruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.rùÚoverrideredirect)r~r2r…rÐrÄr r r Úwm_overrideredirect|s  ÿzWm.wm_overrideredirectcCs|j dd|j|¡S)z¦Instruct the window manager that the position of this widget shall be defined by the user if WHO is "user", and by its own policy if WHO is "program".rùÚ positionfromrÏ©reZwhor r r Úwm_positionfrom…szWm.wm_positionfromcCs.t|ƒr| |¡}n|}|j dd|j||¡S)z´Bind function FUNC to command NAME for this widget. Return the function bound to NAME if None is given. NAME could be e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".rùÚprotocol)r‚ržr2r…rÐ)rerYrçrr r r Ú wm_protocol�s ÿzWm.wm_protocolcCs|j dd|j||¡S)zyInstruct the window manager whether this width can be resized in WIDTH or HEIGHT. Both values are boolean values.rùÚ resizablerÏr$r r r Ú wm_resizablešszWm.wm_resizablecCs|j dd|j|¡S)z¢Instruct the window manager that the size of this widget shall be defined by the user if WHO is "user", and by its own policy if WHO is "program".rùÚsizefromrÏr+r r r Ú wm_sizefrom¡szWm.wm_sizefromcCs|j dd|j|¡S)z†Query or set the state of this widget as one of normal, icon, iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).rùrNrÏ)reZnewstater r r Úwm_state©sz Wm.wm_statecCs|j dd|j|¡S)zSet the title of this widget.rùÚtitlerÏr|r r r Úwm_title°sz Wm.wm_titlecCs|j dd|j|¡S)z_Instruct the window manager that this widget is transient with regard to widget MASTER.rùÚ transientrÏ)rerˆr r r Ú wm_transient¶szWm.wm_transientcCs|j dd|j¡S)zˆWithdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.rùÚwithdrawrÏrŽr r r Ú wm_withdraw½szWm.wm_withdraw)NNNN)N)N)N)N)NNNN)N)NN)N)N)F)NN)N)NN)NN)N)N)NN)NN)N)N)N)N)BrArBrCrkrûrúrýrürÿrþrrrrrrrrrrr r r r3r r¹rr rrrrrrrrrrrrr rr"r!r%r#r'r&r)r(r,r*r.r-r0r/r2r1r3rNr5r4r7r6r9r8r r r r rø•sŽþ      þ                  røc@sNeZdZdZdZddd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dS)rozzToplevel widget of Tk which represents mostly the main window of an application. It has an associated Tcl interpreter.rƒNrrc Csœd|_i|_d|_d|_|dkrZddl}|j tjd¡}|j  |¡\}}|dkrZ||}d} t   |||| t |||¡|_|r„|  ¡tjjs˜| ||¡dS)a@Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.NFr)z.pyz.pyc)rˆr#Ú _tkloadedr2ÚosÚpathÚbasenamer›ÚargvÚsplitextrÀÚcreateÚ wantobjectsÚ_loadtkÚflagsÚignore_environmentÚ readprofile) reÚ screenNameÚbaseNamer ÚuseTkÚsyncZuser;ZextÚ interactiver r r r‰Ês z Tk.__init__cCs|js|j ¡| ¡dSr•)r:r2ÚloadtkrBrŽr r r rKås z Tk.loadtkcCs¼d|_|j d¡}|tjkr.tdtj|fƒ‚t|j d¡ƒ}|tjkrZtdtj|fƒ‚|jdkrjg|_|j  dt ¡|j  dt ¡|j  d¡|j  d¡t rªtsª|a| d|j¡dS) NTÚ tk_versionz4tk.h version (%s) doesn't match libtk.a version (%s)Ú tcl_versionz6tcl.h version (%s) doesn't match libtcl.a version (%s)ZtkerrorÚexitÚWM_DELETE_WINDOW)r:r2rÖrÀÚ TK_VERSIONr/rÚ TCL_VERSIONrŠršrvrzrcrlrmr-rÂ)rerLrMr r r rBês(  ÿ ÿ   z Tk._loadtkcCsJt|j ¡ƒD] }| ¡q|j d|j¡t |¡trFt |krFda dS)zhDestroy this and all descendants widgets. This will end the application of this Tcl interpreter.rÂN) rr#ÚvaluesrÂr2r…rÐrÁrlrm©rer'r r r r s    z Tk.destroyc Csòddl}d|jkr|jd}n|j}|j |d|¡}|j |d|¡}|j |d|¡}|j |d|¡}d|i} td| ƒ|j |¡r˜|j d|¡|j |¡r¶tt |ƒ  ¡| ƒ|j |¡rÐ|j d|¡|j |¡rîtt |ƒ  ¡| ƒdS) zÏInternal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls exec on the contents of BASENAME.py and CLASSNAME.py if such a file exists in the home directory.rNÚHOMEz.%s.tclz.%s.pyrezfrom tkinter import *Úsource) r;ÚenvironÚcurdirr<rÚexecÚisfiler2r…ÚopenÚread) rerGr r;ÚhomeZ class_tclZclass_pyZbase_tclZbase_pyÚdirr r r rE s$      zTk.readprofilecCs:ddl}tdtjd�|t_|t_|t_| |||¡dS)z—Report callback exception on sys.stderr. Applications may want to override this internal function, and should when sys.stderr is None.rNzException in Tkinter callback)Úfile)Ú tracebackr$r›ÚstderrÚ last_typeÚ last_valueÚlast_tracebackÚprint_exception)rerØržrŸr_r r r r�$ s zTk.report_callback_exceptioncCs t|j|ƒS)z3Delegate attribute access to the interpreter object)r`r2)reÚattrr r r Ú __getattr__0 szTk.__getattr__)NNrorrN) rArBrCrkrÐr‰rKrBrÂrEr�rfr r r r roÅsÿ   rocCst||||ƒSr•)ro)rFrGr rHr r r ÚTclC srgc@sTeZdZdZifdd„ZeZZZdd„ZeZ dd„Z e Z e j ZZ e jZZdS) ÚPackzQGeometry manager Pack. Base class to use the methods pack_* in every widget.cKs$|j dd|jf| ||¡¡dS)a(Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to given direction before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see 'in' option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget. r­r¥N©r2r…rÐrôr§r r r Úpack_configureL s   ÿÿzPack.pack_configurecCs|j dd|j¡dS)z:Unmap this widget and do not use it for the packing order.r­rNrÏrŽr r r Ú pack_forgetb szPack.pack_forgetcCs8t|j|j dd|j¡ƒ}d|kr4| |d¡|d<|S)zEReturn information about the packing options for this widget.r­r}Úin©r7r2r…rÐr†©reÚdr r r Ú pack_infoh szPack.pack_infoN)rArBrCrkrjr­r¥rårkrrpr}rÁr²r®r¶rµr r r r rhG s   rhc@sJeZdZdZifdd„ZeZZZdd„ZeZ dd„Z e Z e j ZZ dS) ÚPlacezSGeometry manager Place. Base class to use the methods place_* in every widget.cKs$|j dd|jf| ||¡¡dS)a Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see 'in' option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0 relative to width of master (1.0 is right edge) rely=amount - locate anchor of this widget between 0.0 and 1.0 relative to height of master (1.0 is bottom edge) anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0 relative to width of master (1.0 is the same width as the master) relheight=amount - height of this widget between 0.0 and 1.0 relative to height of master (1.0 is the same height as the master) bordermode="inside" or "outside" - whether to take border width of master widget into account r·r¥Nrir§r r r Úplace_configurez s   ÿÿzPlace.place_configurecCs|j dd|j¡dS)úUnmap this widget.r·rNrÏrŽr r r Ú place_forget– szPlace.place_forgetcCs8t|j|j dd|j¡ƒ}d|kr4| |d¡|d<|S)zEReturn information about the placing options for this widget.r·r}rlrmrnr r r Ú place_infoœ szPlace.place_infoN)rArBrCrkrrr·r¥rårtrrur}rÁr¸rµr r r r rqu s  rqc@sŽeZdZdZifdd„ZeZZZej Z Z ej Z Z dd„Z e Zdd„Zdd „ZeZejZZejZZejZZejZZejZZd S) ÚGridzQGeometry manager Grid. Base class to use the methods grid_* in every widget.cKs$|j dd|jf| ||¡¡dS)aPosition a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see 'in' option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this widget stick to the cell boundary r¹r¥Nrir§r r r Úgrid_configure® s   ÿÿzGrid.grid_configurecCs|j dd|j¡dS)rsr¹rNrÏrŽr r r Ú grid_forgetÅ szGrid.grid_forgetcCs|j dd|j¡dS)z0Unmap this widget but remember the grid options.r¹r¦NrÏrŽr r r Ú grid_removeË szGrid.grid_removecCs8t|j|j dd|j¡ƒ}d|kr4| |d¡|d<|S)zSReturn information about the options for positioning this widget in a grid.r¹r}rlrmrnr r r Ú grid_infoÏ szGrid.grid_infoN)rArBrCrkrwr¹r¥rårÁr¿r¼rÈrÅrxrryrzr}rËrÉrÌr®rÎrÍrÐrÏrÑrµr r r r rv¨ s        rvc@s:eZdZdZdd„Ziidfdd„Zdd„Zd d d „Zd S) Ú BaseWidgetzInternal class.cCsò|s tƒ}||_|j|_d}d|kr2|d}|d=|sŽ|jj ¡}|jdkrRi|_|j |d¡d}||j|<|dkr‚d|f}n d||f}||_|j dkrªd||_ n|j d||_ i|_ |j|jj krà|jj |j  ¡||jj |j<dS)z6Internal function. Sets up information about children.NrYrrz!%sz!%s%drƒ) rsrˆr2r²rArrár”r�rÐr#rÂ)rerˆr&rYÚcountr r r Ú_setupâ s2       zBaseWidget._setupr c Cs˜|rt||fƒ}||_t |||¡|jdkr4g|_dd„| ¡Dƒ}|D]\}}||=qJ|j ||jf||  |¡¡|D]\}}|  ||¡q~dS)zdConstruct a widget with the parent widget MASTER, a name WIDGETNAME and appropriate options.NcSs"g|]\}}t|tƒr||f‘qSr )rr rIr r r r¬ s z'BaseWidget.__init__..) r+Ú widgetNamer{r}rŠr%r2r…rÐrôr¥) rerˆr~r&rËÚextraÚclassesr)r*r r r r‰ s   ÿ zBaseWidget.__init__cCsTt|j ¡ƒD] }| ¡q|j d|j¡|j|jjkrF|jj|j=t  |¡dS)z)Destroy this and all descendants widgets.rÂN) rr#rRrÂr2r…rÐr�rˆrÁrSr r r r s   zBaseWidget.destroycCs|j |j|f|¡Sr•rÏ)rerYrÊr r r Ú_do szBaseWidget._doN)r )rArBrCrkr}r‰rÂr�r r r r r{ß s r{c@seZdZdZdS)ÚWidgetzxInternal class. Base class for a widget which can be positioned with the geometry managers Pack, Place or Grid.N)rArBrCrkr r r r r‚ sr‚c@seZdZdZdifdd„ZdS)ÚToplevelz"Toplevel widget, e.g. for dialogs.Nc Ks°|rt||fƒ}d}dD]L}||kr||}|ddkrJd|dd…}nd|}|||f}||=qt ||d|i|¡| ¡}| | ¡¡| | ¡¡| d|j¡dS) a%Construct a toplevel widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.r )rJÚclass_r(rWZcolormapr€r�r-NrTrO)r+r{r‰rrr4r-rÂ) rerˆr&rËrZwmkeyržÚoptrrr r r r‰) s    zToplevel.__init__©rArBrCrkr‰r r r r rƒ& srƒc@s.eZdZdZdifdd„Zdd„Zdd„ZdS) rDzButton widget.NcKst ||d||¡dS)aUConstruct a button widget with the parent MASTER. STANDARD OPTIONS activebackground, activeforeground, anchor, background, bitmap, borderwidth, cursor, disabledforeground, font, foreground highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, repeatdelay, repeatinterval, takefocus, text, textvariable, underline, wraplength WIDGET-SPECIFIC OPTIONS command, compound, default, height, overrelief, state, width ZbuttonN©r‚r‰©rerˆr&rËr r r r‰G szButton.__init__cCs|j |jd¡dS)a_Flash the button. This is accomplished by redisplaying the button several times, alternating between active and normal colors. At the end of the flash the button is left in the same normal/active state as when the command was invoked. This command is ignored if the button's state is disabled. ÚflashNrÏrŽr r r r‰\ s z Button.flashcCs|j |jd¡S)aInvoke the command associated with the button. The return value is the return value from the command, or an empty string if there is no command associated with the button. This command is ignored if the button's state is disabled. ÚinvokerÏrŽr r r rŠh sz Button.invoke)rArBrCrkr‰r‰rŠr r r r rDD s rDc@seZdZdZdifdd„Zdd„Zdd„Zd d „Zd d „Zdwd d„Z dd„Z dd„Z dd„Z dd„Z dxdd„Zdydd„Zdzdd„Zd{dd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Z d=d>„Z!d?d@„Z"dAdB„Z#d|dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)dOdP„Z*dQdR„Z+dSdT„Z,dUdV„Z-d}dWdX„Z.e.Z/dYdZ„Z0e0Z1d[d\„Z2d~d^d_„Z3ifd`da„Z4dbdc„Z5e5Z6Z7ddde„Z8dfdg„Z9ddidj„Z:dkdl„Z;dmdn„Zdsdt„Z?dudv„Z@dS)€ÚCanvasz?Canvas widget to display graphical elements like lines or text.NcKst ||d||¡dS)aConstruct a canvas widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, closeenough, confine, cursor, height, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, offset, relief, scrollregion, selectbackground, selectborderwidth, selectforeground, state, takefocus, width, xscrollcommand, xscrollincrement, yscrollcommand, yscrollincrement.ZcanvasNr‡rˆr r r r‰v s zCanvas.__init__cGs|j |jdf|¡dS)rÚaddtagNrÏrçr r r rŒ‚ sz Canvas.addtagcCs| |d|¡dS)z*Add tag NEWTAG to all items above TAGORID.ÚaboveN©rŒ©reÚnewtagÚtagOrIdr r r Ú addtag_above† szCanvas.addtag_abovecCs| |d¡dS)zAdd tag NEWTAG to all items.ruNrŽ)rer�r r r Ú addtag_allŠ szCanvas.addtag_allcCs| |d|¡dS)z*Add tag NEWTAG to all items below TAGORID.ÚbelowNrŽr�r r r Ú addtag_belowŽ szCanvas.addtag_belowcCs| |d||||¡dS)z÷Add tag NEWTAG to item which is closest to pixel at X, Y. If several match take the top-most. All items closer than HALO are considered overlapping (all are closests). If START is specified the next below this tag is taken.ÚclosestNrŽ)rer�rUrVÚhaloÚstartr r r Úaddtag_closest’ szCanvas.addtag_closestcCs| |d||||¡dS)zLAdd tag NEWTAG to all items in the rectangle defined by X1,Y1,X2,Y2.ÚenclosedNrŽ©rer�Úx1Úy1Úx2Úy2r r r Úaddtag_enclosed™ szCanvas.addtag_enclosedcCs| |d||||¡dS)zWAdd tag NEWTAG to all items which overlap the rectangle defined by X1,Y1,X2,Y2.Ú overlappingNrŽr›r r r Úaddtag_overlappingž szCanvas.addtag_overlappingcCs| |d|¡dS)z)Add tag NEWTAG to all items with TAGORID.ÚwithtagNrŽr�r r r Úaddtag_withtag£ szCanvas.addtag_withtagcGs | |j |jdf|¡¡pdS)z|Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle which encloses all items with tags specified as arguments.r¼NrArçr r r r¼§ s ÿÿz Canvas.bboxcCs(|j |jd||d¡|r$| |¡dS)zbUnbind for all items with TAGORID for event SEQUENCE the function identified with FUNCID.rprZNrs)rer‘rlrnr r r Ú tag_unbind­ szCanvas.tag_unbindcCs| |jd|f|||¡S)a&Bind to all items with TAGORID at event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.rprq)rer‘rlrçr r r r Útag_bind´ s ÿzCanvas.tag_bindcCs|j |j |jd||¡¡S)zrReturn the canvas x coordinate of pixel position SCREENX rounded to nearest multiple of GRIDSPACING units.Úcanvasxr/)reZscreenxÚ gridspacingr r r r§½ s  ÿzCanvas.canvasxcCs|j |j |jd||¡¡S)zrReturn the canvas y coordinate of pixel position SCREENY rounded to nearest multiple of GRIDSPACING units.Úcanvasyr/)reZscreenyr¨r r r r©à s  ÿzCanvas.canvasycs,‡fdd„ˆj ˆj ˆjdf|¡¡DƒS)z8Return a list of coordinates for the item given in ARGS.csg|]}ˆj |¡‘qSr )r2r»r¯rŽr r r¬Ì sz!Canvas.coords..Úcoordsrhrçr rŽr rªÉ s  ÿÿz Canvas.coordsc Cs\t|ƒ}|d}t|ttfƒr,|dd…}ni}|j |jj|jd|f|| ||¡žŽ¡S)rr€Nr@) rrrrr2r¹r…rÐrô)reÚitemTyperÊrËr&r r r Ú_createÐ s ÿþzCanvas._createcOs| d||¡S)z6Create arc shaped region with coordinates x1,y1,x2,y2.Zarc©r¬rÉr r r Ú create_arcÜ szCanvas.create_arccOs| d||¡S)z%Create bitmap with coordinates x1,y1.rr­rÉr r r Ú create_bitmapà szCanvas.create_bitmapcOs| d||¡S)z)Create image item with coordinates x1,y1.rÜr­rÉr r r Ú create_imageä szCanvas.create_imagecOs| d||¡S)z-Create line with coordinates x1,y1,...,xn,yn.Úliner­rÉr r r Ú create_lineè szCanvas.create_linecOs| d||¡S)z)Create oval with coordinates x1,y1,x2,y2.Zovalr­rÉr r r Ú create_ovalì szCanvas.create_ovalcOs| d||¡S)z0Create polygon with coordinates x1,y1,...,xn,yn.Zpolygonr­rÉr r r Úcreate_polygonð szCanvas.create_polygoncOs| d||¡S)z.Create rectangle with coordinates x1,y1,x2,y2.Z rectangler­rÉr r r Úcreate_rectangleô szCanvas.create_rectanglecOs| d||¡S)z#Create text with coordinates x1,y1.Útextr­rÉr r r Ú create_textø szCanvas.create_textcOs| d||¡S)z+Create window with coordinates x1,y1,x2,y2.rÎr­rÉr r r Ú create_windowü szCanvas.create_windowcGs|j |jdf|¡dS)zŠDelete characters of text items identified by tag or id in ARGS (possibly several times) from FIRST to LAST character (including).ÚdcharsNrÏrçr r r r¹ sz Canvas.dcharscGs|j |jdf|¡dS)zeZdZdZdifdd„Zdd„Zdd„Zd d „Zd d „ZdS) Ú RadiobuttonzGRadiobutton widget which shows only one of several buttons in on-state.NcKst ||d||¡dS)aöConstruct a radiobutton widget with the parent MASTER. Valid resource names: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, command, cursor, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, indicatoron, justify, padx, pady, relief, selectcolor, selectimage, state, takefocus, text, textvariable, underline, value, variable, width, wraplength.rNr‡rˆr r r r‰V s zRadiobutton.__init__cCs|j |jd¡dSrærÏrŽr r r rçb szRadiobutton.deselectcCs|j |jd¡dSrèrÏrŽr r r r‰g szRadiobutton.flashcCs|j |jd¡SrérÏrŽr r r rŠk szRadiobutton.invokecCs|j |jd¡dSrêrÏrŽr r r rØo szRadiobutton.select) rArBrCrkr‰rçr‰rŠrØr r r r r+S s  r+c@s@eZdZdZdifdd„Zdd„Zdd„Zd d d „Zd d „ZdS)ÚScalez1Scale widget which can display a numerical scale.NcKst ||d||¡dS)a×Construct a scale widget with the parent MASTER. Valid resource names: activebackground, background, bigincrement, bd, bg, borderwidth, command, cursor, digits, fg, font, foreground, from, highlightbackground, highlightcolor, highlightthickness, label, length, orient, relief, repeatdelay, repeatinterval, resolution, showvalue, sliderlength, sliderrelief, state, takefocus, tickinterval, to, troughcolor, variable, width.rÐNr‡rˆr r r r‰w s zScale.__init__c CsJ|j |jd¡}z|j |¡WStttfk rD|j |¡YSXdS)z*Get the current value as integer or float.r”N)r2r…rÐr¹rwr#rºr»r‘r r r r”‚ s z Scale.getcCs|j |jd|¡dS)zSet the value to VALUE.r’NrÏr‘r r r r’Š sz Scale.setcCs| |j |jd|¡¡S)z•Return a tuple (X,Y) of the point along the centerline of the trough that corresponds to VALUE or the current value if None is given.rªrAr‘r r r rªŽ sz Scale.coordscCs|j |jd||¡S)zcReturn where the point X,Y lies. Valid return values are "slider", "though1" and "though2".ÚidentifyrÏrÊr r r r-• szScale.identify)N) rArBrCrkr‰r”r’rªr-r r r r r,t s   r,c@sPeZdZdZdifdd„Zddd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dS)Ú Scrollbarz?Scrollbar widget which displays a slider at a certain position.NcKst ||d||¡dS)alConstruct a scrollbar widget with the parent MASTER. Valid resource names: activebackground, activerelief, background, bd, bg, borderwidth, command, cursor, elementborderwidth, highlightbackground, highlightcolor, highlightthickness, jump, orient, relief, repeatdelay, repeatinterval, takefocus, troughcolor, width.Z scrollbarNr‡rˆr r r r‰ž s zScrollbar.__init__cCs|j |jd|¡pdS)a€Marks the element indicated by index as active. The only index values understood by this method are "arrow1", "slider", or "arrow2". If any other value is specified then no element of the scrollbar will be active. If index is not specified, the method returns the name of the element that is currently active, or None if no element is active.rNrÏrðr r r r© szScrollbar.activatecCs|j |j |jd||¡¡S)znReturn the fractional change of the scrollbar setting if it would be moved by DELTAX or DELTAY pixels.rPr/)reZdeltaxZdeltayr r r rP² sÿzScrollbar.deltacCs|j |j |jd||¡¡S)zRReturn the fractional value which corresponds to a slider position of X,Y.rïr/rÊr r r rï¸ szScrollbar.fractioncCs|j |jd||¡S)zYReturn the element under position X,Y as one of "arrow1","slider","arrow2" or "".r-rÏrÊr r r r-½ szScrollbar.identifycCs| |j |jd¡¡S)zZReturn the current fractional values (upper and lower end) of the slider position.r”)r}r2r…rÐrŽr r r r” sz Scrollbar.getcCs|j |jd||¡dS)ziSet the fractional values of the slider position (upper and lower ends as value between 0 and 1).r’NrÏrîr r r r’Ç sz Scrollbar.set)N) rArBrCrkr‰rrPrïr-r”r’r r r r r.› s r.c@sîeZdZdZdifdd„Zdd„Zdd„Zd d „Zdkd d „Zdld d„Z dd„Z dmdd„Z dd„Z dndd„Z dd„Zdd„Zdd„Zdd„Zdodd „Zd!d"„Zdpd#d$„Zifd%d&„Zd'd(„Zd)d*„Zd+d,„Zdqd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zifd9d:„Zd;d<„Z d=d>„Z!d?d@„Z"dAdB„Z#drdCdD„Z$dEdF„Z%dGdH„Z&dsdIdJ„Z'dtdKdL„Z(dMdN„Z)dudOdP„Z*e*Z+dQdR„Z,dvdSdT„Z-dwdUdV„Z.dxdWdX„Z/dydYdZ„Z0dzd[d\„Z1d]d^„Z2d{d_d`„Z3dadb„Z4d|dcdd„Z5e5Z6ifdedf„Z7dgdh„Z8didj„Z9dS)}ÚTextz4Text widget which can display text in various forms.NcKst ||d||¡dS)a¼Construct a text widget with the parent MASTER. STANDARD OPTIONS background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, takefocus, xscrollcommand, yscrollcommand, WIDGET-SPECIFIC OPTIONS autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap, r¶Nr‡rˆr r r r‰Ð sz Text.__init__cCs| |j |jd|¡¡pdS)z‚Return a tuple of (x,y,width,height) which gives the bounding box of the visible part of the character at the given index.r¼NrArðr r r r¼é s ÿÿz Text.bboxc Cs|j |j |jd|||¡¡S)z€Return whether between index INDEX1 and index INDEX2 the relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.Úcomparer*)rer Úopr!r r r r0ï s ÿz Text.comparecGsVdd„|Dƒ}|||g7}|jj|jdf|žŽp2d}|dk rNt|ƒdkrN|fS|SdS)a·Counts the number of relevant things between the two indices. If index1 is after index2, the result will be a negative number (and this holds for each of the possible options). The actual items which are counted depends on the options given by args. The result is a list of integers, one for the result of each counting option given. Valid counting options are "chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels" and "ypixels". There is an additional possible option "update", which if given then all subsequent options ensure that any possible out of date information is recalculated.cSsg|]}| d¡sd|‘qS)r-rÙ)Ú startswith)rJÚargr r r r¬s zText.count..r|Né)r2r…rÐr)rer r!rÊrr r r r|õ s  z Text.countcCs6|dkr |j |j |jd¡¡S|j |jd|¡dS)zjTurn on the internal consistency checks of the B-Tree inside the text widget according to BOOLEAN.NÚdebugr*rÄr r r r5 sz Text.debugcCs|j |jd||¡dS)z?Delete the characters between INDEX1 and INDEX2 (not included).r×NrÏ©rer r!r r r r×sz Text.deletecCs| |j |jd|¡¡S)z©Return tuple (x,y,width,height,baseline) giving the bounding box and baseline position of the visible part of the line containing the character at INDEX.Ú dlineinforArðr r r r7szText.dlineinfoc Ks´g}d}d}|s$g}|fdd„}|}zzt|tƒs>| |¡}}|d|g7}|D]} || rN| d| ¡qN| |¡|r‚| |¡|jj|jdf|žŽ|W¢S|r®| |¡XdS)aŽReturn the contents of the widget between index1 and index2. The type of contents returned in filtered based on the keyword parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are given and true, then the corresponding items are returned. The result is a list of triples of the form (key, value, index). If none of the keywords are true then 'all' is used by default. If the 'command' argument is given, it is called once for each element of the list of triples, with the values of each triple serving as the arguments to the function. In this case the list is not returned.NcSs| |||f¡dSr•)rc)r6r rÂr%r r r Ú append_triple/sz Text.dump..append_triplez-commandr-Údump)r‹rrržrcr2r…rÐ) rer r!rrËrÊZ func_namer%r8r6r r r r9s*      z Text.dumpcGs|jj|jdf|žŽS)arInternal method This method controls the undo mechanism and the modified flag. The exact behavior of the command depends on the option argument that follows the edit argument. The following forms of the command are currently supported: edit_modified, edit_redo, edit_reset, edit_separator and edit_undo ÚeditrÏrçr r r r:Bs z Text.editcCs | d|¡S)a;Get or Set the modified flag If arg is not specified, returns the modified flag of the widget. The insert, delete, edit undo and edit redo commands or the user can set or clear the modified flag. If boolean is specified, sets the modified flag of the widget to arg. Zmodified©r:)rer3r r r Ú edit_modifiedQs zText.edit_modifiedcCs | d¡S)a Redo the last undone edit When the undo option is true, reapplies the last undone edits provided no other edits were done since then. Generates an error when the redo stack is empty. Does nothing when the undo option is false. Zredor;rŽr r r Ú edit_redo\szText.edit_redocCs | d¡S)z(Clears the undo and redo stacks Úresetr;rŽr r r Ú edit_resetfszText.edit_resetcCs | d¡S)znInserts a separator (boundary) on the undo stack. Does nothing when the undo option is false rr;rŽr r r Úedit_separatorkszText.edit_separatorcCs | d¡S)aDUndoes the last edit action If the undo option is true. An edit action is defined as all the insert and delete commands that are recorded on the undo stack in between two separators. Generates an error when the undo stack is empty. Does nothing when the undo option is false Zundor;rŽr r r Ú edit_undors zText.edit_undocCs|j |jd||¡S)z5Return the text from INDEX1 to INDEX2 (not included).r”rÏr6r r r r”}szText.getcCsJ|dd…dkrd|}|dd…dkr4|dd…}|j |jdd||¡S)z9Return the value of OPTION of an embedded image at INDEX.Nrr-r€r�rÜr¨rÏr r r r Ú image_cget‚s  zText.image_cgetcKs| dd|f||¡S)z%Configure an embedded image at INDEX.rÜr¥r¦rÇr r r Úimage_configureŠszText.image_configurecKs"|jj|jdd|f| ||¡žŽS)z"Create an embedded image at INDEX.rÜr@rirÇr r r Ú image_createŽsÿ þzText.image_createcCs|j |jdd¡S)z3Return all names of embedded images in this widget.rÜrÝrÏrŽr r r rÞ”szText.image_namescCst|j |jd|¡ƒS)z1Return the index in the form line.char for INDEX.rÂ)rr2r…rÐrðr r r r˜sz Text.indexcGs|j |jd||f|¡dS)zŠInsert CHARS before the characters at INDEX. An additional tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.rÈNrÏ)rerÂÚcharsrÊr r r rÈœsz Text.insertcCs|j |jdd||f¡S)z„Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT). Return the current value if None is given for DIRECTION.rÓZgravityrÏ)reÚmarkNameÚ directionr r r Ú mark_gravity¡sÿzText.mark_gravitycCs|j |j |jdd¡¡S)zReturn all mark names.rÓrÝrhrŽr r r Ú mark_names§s  ÿzText.mark_namescCs|j |jdd||¡dS)z0Set mark MARKNAME before the character at INDEX.rÓr’NrÏ)rerFrÂr r r Úmark_set¬sz Text.mark_setcGs|j |jddf|¡dS)zDelete all marks in MARKNAMES.rÓZunsetNrÏ)reZ markNamesr r r Ú mark_unset°szText.mark_unsetcCs|j |jdd|¡pdS)z-Return the name of the next mark after INDEX.rÓÚnextNrÏrðr r r Ú mark_next´szText.mark_nextcCs|j |jdd|¡pdS)z2Return the name of the previous mark before INDEX.rÓZpreviousNrÏrðr r r Ú mark_previous¸szText.mark_previouscKs&|jj|jdd|f| ||¡žŽdS)aCreates a peer text widget with the given newPathName, and any optional standard configuration options. By default the peer will have the same start and end line as the parent widget, but these can be overridden with the standard configuration options.Úpeerr@Nri)reZ newPathNamer&rËr r r Ú peer_create¼s ÿzText.peer_createcCs|j |j |jdd¡¡S)zYReturns a list of peers of this widget (this does not include the widget itself).rOrÝrhrŽr r r Ú peer_namesÄszText.peer_namescGs |jj|jd|||f|žŽdS)zþReplaces the range of characters between index1 and index2 with the given characters and tags specified by args. See the method insert for some more information about args, and the method delete for information about the indices.rNrÏ)rer r!rErÊr r r rÉsz Text.replacecCs|j |jdd||¡dSrÑrÏrÊr r r rÔÑszText.scan_markcCs|j |jdd||¡dS)z~Adjust the view of the text to 10 times the difference between X and Y and the coordinates given in scan_mark.rÒrÖNrÏrÊr r r r×ÕszText.scan_dragtoc CsÆ|jdg} |r|  d¡|r&|  d¡|r4|  d¡|rB|  d¡|rP|  d¡| r^|  d¡| rv|  d¡|  | ¡|r�|d d kr�|  d ¡|  |¡|  |¡|r²|  |¡t|j t| ƒ¡ƒS) z‹Search PATTERN beginning from INDEX until STOPINDEX. Return the index of the first character of a match or an empty string.rz -forwardsz -backwardsz-exactz-regexpz-nocasez-elidez-countrr-rú)rÐrcrr2r…r) rerrÂZ stopindexZforwardsZ backwardsÚexactZregexpZnocaser|ZeliderÊr r r rÛs.            z Text.searchcCs|j |jd|¡dS)z3Scroll such that the character at INDEX is visible.rNrÏrðr r r rïszText.seecGs |j |jdd||f|¡dS)z|Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS. Additional pairs of indices may follow in ARGS.Útagr NrÏ)reÚtagNamer rÊr r r Útag_addósÿz Text.tag_addcCs*|j |jdd||d¡|r&| |¡dS)zgUnbind for all characters with TAGNAME for event SEQUENCE the function identified with FUNCID.rSrprZNrs)rerTrlrnr r r r¥ùszText.tag_unbindcCs| |jdd|f|||¡S)a+Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.rSrprq)rerTrlrçr r r r r¦s ÿz Text.tag_bindcCsJ|dd…dkrd|}|dd…dkr4|dd…}|j |jdd||¡S)z+Return the value of OPTION for tag TAGNAME.Nrr-r€r�rSr¨rÏ)rerTrr r r Útag_cget s  z Text.tag_cgetcKs| dd|f||¡S)zConfigure a tag TAGNAME.rSr¥r¦)rerTr&rËr r r Ú tag_configureszText.tag_configurecGs|j |jddf|¡dS)zDelete all tags in TAGNAMES.rSr×NrÏ)reZtagNamesr r r Ú tag_deleteszText.tag_deletecCs|j |jdd||¡dS)z`Change the priority of tag TAGNAME such that it is lower than the priority of BELOWTHIS.rSrNrÏ)rerTrr r r rÌszText.tag_lowercCs|j |j |jdd|¡¡S)zReturn a list of all tag names.rSrÝrhrðr r r Ú tag_names sÿzText.tag_namesc Cs |j |j |jdd|||¡¡S)z¹Return a list of start and end index for the first sequence of characters between INDEX1 and INDEX2 which all have tag TAGNAME. The text is searched forward from INDEX1.rSZ nextrangerh©rerTr r!r r r Ú tag_nextrange%s ÿzText.tag_nextrangec Cs |j |j |jdd|||¡¡S)z»Return a list of start and end index for the first sequence of characters between INDEX1 and INDEX2 which all have tag TAGNAME. The text is searched backwards from INDEX1.rSZ prevrangerhrZr r r Ú tag_prevrange,s ÿzText.tag_prevrangecCs|j |jdd||¡dS)zaChange the priority of tag TAGNAME such that it is higher than the priority of ABOVETHIS.rSrNrÏ)rerTrr r r rÏ3sÿzText.tag_raisecCs|j |j |jdd|¡¡S)z7Return a list of ranges of text which have tag TAGNAME.rSZrangesrh)rerTr r r Ú tag_ranges9s  ÿzText.tag_rangescCs|j |jdd|||¡dS)zARemove tag TAGNAME from all characters between INDEX1 and INDEX2.rSr¦NrÏrZr r r Ú tag_remove>sÿzText.tag_removecCsJ|dd…dkrd|}|dd…dkr4|dd…}|j |jdd||¡S)z:Return the value of OPTION of an embedded window at INDEX.Nrr-r€r�rÎr¨rÏr r r r Ú window_cgetCs  zText.window_cgetcKs| dd|f||¡S)z&Configure an embedded window at INDEX.rÎr¥r¦rÇr r r Úwindow_configureKszText.window_configurecKs&|j |jdd|f| ||¡¡dS)zCreate a window at INDEX.rÎr@NrirÇr r r Ú window_createQs   ÿÿzText.window_createcCs|j |j |jdd¡¡S)z4Return all names of embedded windows in this widget.rÎrÝrhrŽr r r Ú window_namesWsÿzText.window_namescGs|j |jddf|¡dS)zObsolete function, use see.rõz -pickplaceNrÏ)rerqr r r Úyview_pickplace\szText.yview_pickplace)N)N)NN)N)N)N)N)NNNNNNNN)N)N)N)N)N)N)N)N)N)N):rArBrCrkr‰r¼r0r|r5r×r7r9r:r<r=r?r@rAr”rBrCrDrÞrÂrÈrHrIrJrKrMrNrPrQrrÔr×rrrUr¥r¦rVrWZ tag_configrXrÌrYr[r\rÏr]r^r_r`Z window_configrarbrcr r r r r/Í s~   (       þ            r/c@s"eZdZdZddd„Zdd„ZdS)Ú_setitz>Internal class. It wraps the command in the widget OptionMenu.NcCs||_||_||_dSr•)Ú _setit__valueÚ _setit__varÚ_setit__callback)reÚvarr r›r r r r‰dsz_setit.__init__cGs*|j |j¡|jr&|j|jf|žŽdSr•)rfr’rergrçr r r r—isz_setit.__call__)Nrèr r r r rdas rdc@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú OptionMenuz?OptionMenu which allows the user to select a value from a menu.c Os¶d|dtdddœ}t ||d|¡d|_t|ddd �}|_|j|_| d ¡}d |kr\|d =|rtt d t t |ƒƒƒ‚|j |t |||ƒd �|D]} |j | t || |ƒd �qŽ||d<d S)zëConstruct an optionmenu widget with the parent MASTER, with the resource textvariable set to VARIABLE, the initially selected value VALUE, the other menu values VALUES and an additional keyword argument command.r,rr')Z borderwidthZ textvariableZ indicatoronZreliefrºZhighlightthicknessr(Z tk_optionMenur r)rYZtearoffrzunknown option -)rÿrN)ZRAISEDr‚r‰r~r Ú_OptionMenu__menurÐZmenunamer”rºrLr0rrd) rerˆr¡r rRÚkwargsrËr r›r*r r r r‰rs.þ  ÿ ÿzOptionMenu.__init__cCs|dkr|jSt ||¡S)Nr )rjr‚rærŒr r r ræ‹szOptionMenu.__getitem__cCst |¡d|_dS)z,Destroy this widget and the associated menu.N)r'rÂrjrŽr r r rÂ�s zOptionMenu.destroyN)rArBrCrkr‰rærÂr r r r riosric@sheZdZdZdZdidfdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z e Z dd„Z dd„Z dd„ZdS)ÚImagezBase class for images.rNc Ks¶d|_|stdƒ}t|d|ƒ|_|s>tjd7_dtjf}|rT|rTt||fƒ}n|r\|}d}| ¡D]*\}}t|ƒr‚|  |¡}|d||f}qh|j  dd||f|¡||_dS) Nz create imager2rz pyimage%rr r-rÜr@) rYrsr`r2rlÚ_last_idr+r%r‚ržr…) reZimgtyperYr&rˆrËrÃr)r*r r r r‰šs$  zImage.__init__cCs|jSr•)rYrŽr r r rF¬óz Image.__str__cCs6|jr2z|j dd|j¡Wntk r0YnXdS)NrÜr×)rYr2r…rºrŽr r r r�®s z Image.__del__cCs|j |jdd||¡dS©Nr¥r-©r2r…rYrªr r r r«¶szImage.__setitem__cCs|j |jdd|¡Srorpr©r r r ræ¹szImage.__getitem__cKsvd}t|ƒ ¡D]J\}}|dk r|ddkr8|dd…}t|ƒrJ| |¡}|d||f}q|j |jdf|¡dS)zConfigure the image.r Nr€r�r-rå)r+r%r‚ržr2r…rY)rerËrr)r*r r r r¥¼s  zImage.configurecCs|j |j dd|j¡¡S)zReturn the height of the image.rÜrX©r2r¹r…rYrŽr r r rXÉsÿz Image.heightcCs|j dd|j¡S)z7Return the type of the image, e.g. "photo" or "bitmap".rÜr rprŽr r r r Îsz Image.typecCs|j |j dd|j¡¡S)zReturn the width of the image.rÜrWrqrŽr r r rWÒsÿz Image.width)rArBrCrkrmr‰rFr�r«rær¥rårXr rWr r r r rl–s rlc@s€eZdZdZdidfdd„Zdd„Zdd„Zd d „Zd d „Zddd„Z ddd„Z dd„Z ddd„Z ddd„Z dd„Zdd„ZdS) Ú PhotoImagez=Widget which can display images in PGM, PPM, GIF, PNG format.NcKstj|d|||f|ŽdS)ztCreate an image with NAME. Valid resource names: data, format, file, gamma, height, palette, width.ZphotoN©rlr‰©rerYr&rˆrËr r r r‰ÛszPhotoImage.__init__cCs|j |jd¡dS)zDisplay a transparent image.ÚblankNrprŽr r r ruâszPhotoImage.blankcCs|j |jdd|¡S)zReturn the value of OPTION.r¨r-rp)rerr r r r¨æszPhotoImage.cgetcCs|j |jdd|¡S)Nr¨r-rpr©r r r ræëszPhotoImage.__getitem__cCs"t|jd�}|j |d|j¡|S)z;Return a new PhotoImage with the same image as this widget.rˆÚcopy©rrr2r…rY)reÚ destImager r r rvïs zPhotoImage.copyrZcCs4t|jd�}|dkr|}|j |d|jd||¡|S)z×Return a new PhotoImage with the same image as this widget but zoom it with a factor of x in the X direction and y in the Y direction. If y is not given, the default value is the same as x. rˆrZrvz-zoomrw©rerUrVrxr r r Úzoomõs  zPhotoImage.zoomcCs4t|jd�}|dkr|}|j |d|jd||¡|S)z´Return a new PhotoImage based on the same image as this widget but use only every Xth or Yth pixel. If y is not given, the default value is the same as x. rˆrZrvz -subsamplerwryr r r Ú subsampleÿs  zPhotoImage.subsamplecCs|j |jd||¡S)z8Return the color (red, green, blue) of the pixel at X,Y.r”rprÊr r r r” szPhotoImage.getcCsH|jd|f}|r8|ddkr(|dd…}|dt|ƒ}|j |¡dS)zzPut row formatted colors to image starting from position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))Úputrú-torN)r}©rYrr2r…)rerêrárÊr r r r| s    zPhotoImage.putcCs@|jd|f}|r|d|f}|r0|dt|ƒ}|j |¡dS)zRWrite image to file FILENAME in FORMAT starting from position FROM_COORDS.Úwritez-format)z-fromNr~)reÚfilenameÚformatZ from_coordsrÊr r r rs   zPhotoImage.writec Cs|j |j |jdd||¡¡S)z/Return True if the pixel at x,y is transparent.Ú transparencyr”)r2r„r…rYrÊr r r Útransparency_get"s ÿzPhotoImage.transparency_getcCs|j |jdd|||¡dS)z)Set the transparency of the pixel at x,y.r‚r’Nrp)rerUrVrÅr r r Útransparency_set'szPhotoImage.transparency_set)rZ)rZ)N)NN)rArBrCrkr‰rur¨rærvrzr{r”r|rrƒr„r r r r rrØs  rrc@s eZdZdZdidfdd„ZdS)Ú BitmapImagez.Widget which can display images in XBM format.NcKstj|d|||f|ŽdS)zqCreate a bitmap with NAME. Valid resource names: background, data, file, foreground, maskdata, maskfile.rNrsrtr r r r‰/szBitmapImage.__init__r†r r r r r…,sr…cCstdƒj}| | dd¡¡S)Nzuse image_names()rÜrÝ©rsr2r.r…©r2r r r rÞ6s rÞcCstdƒj}| | dd¡¡S)Nzuse image_types()rÜrßr†r‡r r r rà;s ràc@sºeZdZdZdifdd„Zdd„Zd+dd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd,d!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„ZdS)-ÚSpinboxzspinbox widget.NcKst ||d||¡dS)a¤Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, justify, relief, repeatdelay, repeatinterval, selectbackground, selectborderwidth selectforeground, takefocus, textvariable xscrollcommand. WIDGET-SPECIFIC OPTIONS buttonbackground, buttoncursor, buttondownrelief, buttonuprelief, command, disabledbackground, disabledforeground, format, from, invalidcommand, increment, readonlybackground, state, to, validate, validatecommand values, width, wrap, ZspinboxNr‡rˆr r r r‰CszSpinbox.__init__cCs| |j |jd|¡¡pdS)aøReturn a tuple of X1,Y1,X2,Y2 coordinates for a rectangle which encloses the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window. r¼NrArðr r r r¼`s z Spinbox.bboxcCs|j |jd||¡S)aWDelete one or more elements of the spinbox. First is the index of the first character to delete, and last is the index of the character just after the last one to delete. If last isn't specified it defaults to first+1, i.e. a single character is deleted. This command returns an empty string. r×rÏrîr r r r×ns zSpinbox.deletecCs|j |jd¡S)zReturns the spinbox's stringr”rÏrŽr r r r”ysz Spinbox.getcCs|j |jd|¡S)z®Alter the position of the insertion cursor. The insertion cursor will be displayed just before the character given by index. Returns an empty string rÇrÏrðr r r rÇ}szSpinbox.icursorcCs|j |jd||¡S)z{Returns the name of the widget at position x, y Return value is one of: none, buttondown, buttonup, entry r-rÏrÊr r r r-…szSpinbox.identifycCs|j |jd|¡S)z;Returns the numerical index corresponding to index rÂrÏrðr r r rÂŒsz Spinbox.indexcCs|j |jd||¡S)zDInsert string s at index Returns an empty string. rÈrÏ)rerÂrfr r r rÈ‘szSpinbox.insertcCs|j |jd|¡S)zšCauses the specified element to be invoked The element could be buttondown or buttonup triggering the action associated with it. rŠrÏ©reÚelementr r r rŠ˜szSpinbox.invokecGs | |j |jdf|¡¡pdS)rrÒr rArçr r r rÒ s ÿÿz Spinbox.scancCs | d|¡S)zöRecords x and the current view in the spinbox window; used in conjunction with later scan dragto commands. Typically this command is associated with a mouse button press in the widget. It returns an empty string. rÓ©rÒr^r r r rÔ¥szSpinbox.scan_markcCs | d|¡S)a´Compute the difference between the given x argument and the x argument to the last scan mark command It then adjusts the view left or right by 10 times the difference in x-coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the spinbox at high speed through the window. The return value is an empty string. rÖr‹r^r r r r×®s zSpinbox.scan_dragtocGs | |j |jdf|¡¡pdS)rr r rArçr r r r ºs ÿÿzSpinbox.selectioncCs | d|¡S)aúLocate the end of the selection nearest to the character given by index, Then adjust that end of the selection to be at index (i.e including but not going beyond index). The other end of the selection is made the anchor point for future select to commands. If the selection isn't currently in the spinbox, then a new selection is created to include the characters between index and the most recent selection anchor point, inclusive. rÙ©r rðr r r rñ¿s zSpinbox.selection_adjustcCs | d¡S)zsClear the selection If the selection isn't in this widget then the command has no effect. r÷rŒrŽr r r rÍszSpinbox.selection_clearcCs|j |jdd|¡S)zŒSets or gets the currently selected element. If a spinbutton element is specified, it will be displayed depressed. r rŠrÏr‰r r r Úselection_elementÕszSpinbox.selection_elementcCs| d|¡dS)ròrÞNrŒrðr r r róÝszSpinbox.selection_fromcCs|j |j |jdd¡¡S)zUReturn True if there are characters selected in the spinbox, False otherwise.r rôr*rŽr r r rõásÿzSpinbox.selection_presentcCs| d||¡dS)rör÷NrŒrør r r rúçszSpinbox.selection_rangecCs| d|¡dS)rûráNrŒrðr r r rüëszSpinbox.selection_to)N)N)rArBrCrkr‰r¼r×r”rÇr-rÂrÈrŠrÒrÔr×r rñrr�rórõrúrür r r r rˆ@s*    rˆc@seZdZdZdifdd„ZdS)Ú LabelFramezlabelframe widget.NcKst ||d||¡dS)a«Construct a labelframe widget with the parent MASTER. STANDARD OPTIONS borderwidth, cursor, font, foreground, highlightbackground, highlightcolor, highlightthickness, padx, pady, relief, takefocus, text WIDGET-SPECIFIC OPTIONS background, class, colormap, container, height, labelanchor, labelwidget, visual, width Z labelframeNr‡rˆr r r r‰õszLabelFrame.__init__r†r r r r rŽòsrŽc@s˜eZdZdZdifdd„Zdd„Zdd„ZeZd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd!dd„ZeZdd „ZdS)"Ú PanedWindowzpanedwindow widget.NcKst ||d||¡dS)aTConstruct a panedwindow widget with the parent MASTER. STANDARD OPTIONS background, borderwidth, cursor, height, orient, relief, width WIDGET-SPECIFIC OPTIONS handlepad, handlesize, opaqueresize, sashcursor, sashpad, sashrelief, sashwidth, showhandle, Z panedwindowNr‡rˆr r r r‰ szPanedWindow.__init__cKs"|j |jd|f| |¡¡dS)a+Add a child widget to the panedwindow in a new pane. The child argument is the name of the child widget followed by pairs of arguments that specify how to manage the windows. The possible options and values are the ones accepted by the paneconfigure method. r Nri)rer&rËr r r r szPanedWindow.addcCs|j |jd|¡dS)z„Remove the pane containing child from the panedwindow All geometry management options for child will be forgotten. rNrÏ)rer&r r r r¦'szPanedWindow.removecCs|j |jd||¡S)a—Identify the panedwindow component at point x, y If the point is over a sash or a sash handle, the result is a two element list containing the index of the sash or handle, and a word indicating whether it is over a sash or a handle, such as {0 sash} or {2 handle}. If the point is over any other part of the panedwindow, the result is an empty list. r-rÏrÊr r r r-0s zPanedWindow.identifycGs | |j |jdf|¡¡pdS)rÚproxyr rArçr r r r�<s ÿÿzPanedWindow.proxycCs | d¡S)zBReturn the x and y pair of the most recent proxy location Úcoord©r�rŽr r r Ú proxy_coordAszPanedWindow.proxy_coordcCs | d¡S)z+Remove the proxy from the display. rr’rŽr r r Ú proxy_forgetFszPanedWindow.proxy_forgetcCs| d||¡S)z:Place the proxy at the given x and y coordinates. r·r’rÊr r r Ú proxy_placeKszPanedWindow.proxy_placecGs | |j |jdf|¡¡pdS)rÚsashr rArçr r r r–Ps ÿÿzPanedWindow.sashcCs | d|¡S)aAReturn the current x and y pair for the sash given by index. Index must be an integer between 0 and 1 less than the number of panes in the panedwindow. The coordinates given are those of the top left corner of the region containing the sash. pathName sash dragto index x y This command computes the difference between the given coordinates and the coordinates given to the last sash coord command for the given sash. It then moves that sash the computed difference. The return value is the empty string. r‘©r–rðr r r Ú sash_coordUs zPanedWindow.sash_coordcCs | d|¡S)zRecords x and y for the sash given by index; Used in conjunction with later dragto commands to move the sash. rÓr—rðr r r Ú sash_markcszPanedWindow.sash_markcCs| d|||¡S)z?Place the sash given by index at the given coordinates r·r—)rerÂrUrVr r r Ú sash_placejszPanedWindow.sash_placecCs|j |jdf|d|f¡S)zwQuery a management option for window. Option may be any value allowed by the paneconfigure subcommand Úpanecgetr-rÏ)rer&rr r r r›osÿzPanedWindow.panecgetcKsd|dkr|s| |jd|¡St|tƒr@|s@| |jd|d|¡S|j |jd|f| ||¡¡dS)a˜ Query or modify the management options for window. If no option is specified, returns a list describing all of the available options for pathName. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. The following options are supported: after window Insert the window after the window specified. window should be the name of a window already managed by pathName. before window Insert the window before the window specified. window should be the name of a window already managed by pathName. height size Specify a height for the window. The height will be the outer dimension of the window including its border, if any. If size is an empty string, or if -height is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels. minsize n Specifies that the size of the window cannot be made less than n. This constraint only affects the size of the widget in the paned dimension -- the x dimension for horizontal panedwindows, the y dimension for vertical panedwindows. May be any value accepted by Tk_GetPixels. padx n Specifies a non-negative value indicating how much extra space to leave on each side of the window in the X-direction. The value may have any of the forms accepted by Tk_GetPixels. pady n Specifies a non-negative value indicating how much extra space to leave on each side of the window in the Y-direction. The value may have any of the forms accepted by Tk_GetPixels. sticky style If a window's pane is larger than the requested dimensions of the window, this option may be used to position (or stretch) the window within its pane. Style is a string that contains zero or more of the characters n, s, e or w. The string can optionally contains spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the window will "stick" to. If both n and s (or e and w) are specified, the window will be stretched to fill the entire height (or width) of its cavity. width size Specify a width for the window. The width will be the outer dimension of the window including its border, if any. If size is an empty string, or if -width is not specified, then the width requested internally by the window will be used initially; the width may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels. NÚ paneconfigurer-)r¢rÐrrr£r2r…rôrËr r r rœwsD ÿ ÿzPanedWindow.paneconfigurecCs|j |j |jd¡¡S)z+Returns an ordered list of the child panes.ÚpanesrhrŽr r r r�ÅszPanedWindow.panes)N)rArBrCrkr‰r r¦rr-r�r“r”r•r–r˜r™ršr›rœZ paneconfigr�r r r r r� s$   Lr�cCsŠtƒ}dt}|d7}t||d�}| ¡t|d|fdd„d�}| ¡||_t|d|jd�}| ¡| ¡| ¡|  ¡|  ¡dS) NzThis is Tcl/Tk version %su This should be a cedilla: ç©r¶z Click me!cSs|jjd|jdd�S)Nz[%s]r¶rž)Útestr¥)rrr r r ÚÓs ÿz_test..)r¶rZQUIT) roÚ TclVersionrþr­rDrŸrÂrr!rr¿)rrr¶rÿrŸr{r r r Ú_testÌs   ÿr¢Ú__main__)TN)N)r)r)NNror)VrkÚenumr›rÀrºZtkinter.constantsÚrerAÚfloatrPZ TkVersionrQr¡ZREADABLEZWRITABLEZ EXCEPTIONÚcompilerÚASCIIrr rrr"r+r7rÚEnumr8rGrlrmrnrsrvrzr‚r{rµr¸r¼r½r¿rar¹r»r„rÁr–rérôrørorgrhrqrvr{r‚rƒrDr‹rärìrýrþrr r'r)r+r,r.r/rdrirlrrr…rÞràrˆrŽr�r¢rAr r r r ÚsÒ        ,R  6  q2~ .37?/8$Vt!'2'BT 3C