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ZddZddZdddZdd d Zd d Zd dZ ddZ dddZ dS) tixCommandaThe tix commands provide access to miscellaneous elements of Tix's internal state and the Tix application context. Most of the information manipulated by these commands pertains to the application as a whole, or to a screen or display, rather than to a particular window. This is a mixin class, assumed to be mixed to Tkinter.Tk that supports the self.tk.call method. cCs|jjdd|S)aTix maintains a list of directories under which the tix_getimage and tix_getbitmap commands will search for image files. The standard bitmap directory is $TIX_LIBRARY/bitmaps. The addbitmapdir command adds directory into this list. By using this command, the image files of an applications can also be located using the tix_getimage or tix_getbitmap command. tixZ addbitmapdir)tkcall)selfZ directoryr!/usr/lib/python3.5/tkinter/tix.pytix_addbitmapdirVs ztixCommand.tix_addbitmapdircCs|jjdd|S)zReturns the current value of the configuration option given by option. Option may be any of the options described in the CONFIGURATION OPTIONS section. rcget)rr)roptionrrrtix_cgetbsztixCommand.tix_cgetNcKs|rt||f}n|r-t|}|dkrI|jddSt|tro|jddd|S|jjd|j|S)aQuery or modify the configuration options of the Tix application context. If no option is specified, returns a dictionary all of the available options. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given option(s) to have the given value(s); in this case the command returns an empty string. Option may be any of the configuration options. Nr configure-)rr)r _getconfigure isinstancestrZ_getconfigure1rr_options)rcnfkwrrr tix_configureis   ztixCommand.tix_configurecCs9|dk r"|jjdd|S|jjddSdS)aReturns the file selection dialog that may be shared among different calls from this application. This command will create a file selection dialog widget when it is called the first time. This dialog will be returned by all subsequent calls to tix_filedialog. An optional dlgclass parameter can be passed to specified what type of file selection dialog widget is desired. Possible options are tix FileSelectDialog or tixExFileSelectDialog. NrZ filedialog)rr)rZdlgclassrrrtix_filedialogs ztixCommand.tix_filedialogcCs|jjdd|S)aLocates a bitmap file of the name name.xpm or name in one of the bitmap directories (see the tix_addbitmapdir command above). By using tix_getbitmap, you can avoid hard coding the pathnames of the bitmap files in your application. When successful, it returns the complete pathname of the bitmap file, prefixed with the character '@'. The returned value can be used to configure the -bitmap option of the TK and Tix widgets. rZ getbitmap)rr)rnamerrr tix_getbitmaps ztixCommand.tix_getbitmapcCs|jjdd|S)aLocates an image file of the name name.xpm, name.xbm or name.ppm in one of the bitmap directories (see the addbitmapdir command above). If more than one file with the same name (but different extensions) exist, then the image type is chosen according to the depth of the X display: xbm images are chosen on monochrome displays and color images are chosen on color displays. By using tix_ getimage, you can avoid hard coding the pathnames of the image files in your application. When successful, this command returns the name of the newly created image, which can be used to configure the -image option of the Tk and Tix widgets. rZgetimage)rr)rr'rrr tix_getimages ztixCommand.tix_getimagecCs|jjddd|S)a@Gets the options maintained by the Tix scheme mechanism. Available options include: active_bg active_fg bg bold_font dark1_bg dark1_fg dark2_bg dark2_fg disabled_fg fg fixed_font font inactive_bg inactive_fg input1_bg input2_bg italic_font light1_bg light1_fg light2_bg light2_fg menu_font output1_bg output2_bg select_bg select_fg selector rrget)rr)rr'rrrtix_option_getsztixCommand.tix_option_getcCsE|dk r(|jjdd|||S|jjdd||SdS)aResets the scheme and fontset of the Tix application to newScheme and newFontSet, respectively. This affects only those widgets created after this call. Therefore, it is best to call the resetoptions command before the creation of any widgets in a Tix application. The optional parameter newScmPrio can be given to reset the priority level of the Tk options set by the Tix schemes. Because of the way Tk handles the X option database, after Tix has been has imported and inited, it is not possible to reset the color schemes and font sets using the tix config command. Instead, the tix_resetoptions command must be used. NrZ resetoptions)rr)rZ newSchemeZ newFontSetZ newScmPriorrrtix_resetoptionss ztixCommand.tix_resetoptions) __name__ __module__ __qualname____doc__rrr%r&r(r)r+r,rrrrrKs    rc@s7eZdZdZdddddZddZdS)Tkz{Toplevel widget of Tix which represents mostly the main window of an application. It has an associated Tcl interpreter.NZTixcCstjj||||tjjd}|jjd|dk ro|jjd||jjd||jjddS)NZ TIX_LIBRARYzs zForm.slaves..r:slaves)rrDrr;)rr)rrrLs  z Form.slaves) r-r.r/r0r<r=r@rArBrCrHrLrrrrr9s     r9c@seZdZdZdddiiddZddZddZd d Zd d Zd dZ ddZ ddZ idddZ ddZ dS) TixWidgetaQA TixWidget class is used to package all (or most) Tix widgets. Widget initialization is extended in two ways: 1) It is possible to give a list of options which must be part of the creation command (so called Tix 'static' options). These cannot be given as a 'config' command later. 2) It is possible to give the name of an existing TK widget. These are child widgets created automatically by a Tix mega-widget. The Tk call to create these widgets is therefore bypassed in TixWidget.__init__ Both options are for use by subclasses only. Nc Cs|rt||f}n t|}f}|rC|jdn dg}xGt|jD]3\}}||kr_|d||f}||=q_W||_tj||||r|jj||j ||rtj ||i|_ dS)Noptionsr) rappendlistitems widgetNameWidget_setuprrr;r<subwidget_list) rmasterrRZstatic_optionsr#r$Zextrakvrrrr3s$     zTixWidget.__init__cCs*||jkr|j|St|dS)N)rUAttributeError)rr'rrr __getattr__Ks zTixWidget.__getattr__cCs|jjd|j|dS)z1Set a variable without calling its action routineZ tixSetSilentN)rrr;)rr?rrr set_silentPszTixWidget.set_silentcCsZ|j|}|s0td|d|j|t|jdd}|j|S)zSReturn the named subwidget (which must have been created by the sub-class).z Subwidget z not child of r N)_subwidget_nameTclError_namelenr;rI)rr'nrrr subwidgetTs zTixWidget.subwidgetc Css|j}|sgSg}xP|D]H}|t|jdd}y|j|j|Wq#Yq#Xq#W|S)zReturn all subwidgets.r N)_subwidget_namesr_r;rOrI)rnamesZretlistr'rrrsubwidgets_all^s   zTixWidget.subwidgets_allc Cs:y|jj|jd|SWntk r5dSYnXdS)z7Get a subwidget name (returns a String, not a Widget !)raN)rrr;r])rr'rrrr\ms zTixWidget._subwidget_namec CsLy/|jj|jdd}|jj|SWntk rGdSYnXdS)z"Return the name of all subwidgets.Z subwidgetsz-allN)rrr;rDr])rrErrrrbts  zTixWidget._subwidget_namescCs|dkrdSt|ts+t|}t|tsFt|}|j}x+|D]#}|jj|dd||qYWdS)z8Set configuration options for all subwidgets (and self).r7Nrr)r r!reprrbrr)rrr?rcr'rrr config_all|s     zTixWidget.config_allcKs|s!tj}|s!td|rB|rBt||f}n |rN|}f}xI|jD];\}}t|r|j|}|d||f}qaW|jjdd|f|S)NzToo early to create imagerrcreate) r2 _default_root RuntimeErrorrrQcallable _registerrr)rZimgtyper#rVr$rNrWrXrrr image_creates    zTixWidget.image_createc Cs3y|jjdd|Wntk r.YnXdS)Nrdelete)rrr])rZimgnamerrr image_deletes zTixWidget.image_delete)r-r.r/r0r3rZr[rardr\rbrfrlrnrrrrrMs ,       rMc@s4eZdZdZddddZddZdS) TixSubWidgetzSubwidget class. This is used to mirror child widgets automatically created by Tix/Tk as part of a mega-widget in Python (which is not informed of this)r c CsK|rV|j|}y0|t|jdd}|jd}Wng}YnX|s~tj||ddd|in|}xtt|dD]p}dj|d|d} y|j| } | }Wqt k r t |||dddd}YqXqW|r|d}tj||ddd|i||_ dS)Nr .r'destroy_physicallyrcheck_intermediate) r\r_r;splitrMr3rangejoinrIKeyErrorrorq) rrVr'rqrrpathZplistparentir`wrrrr3s. "   zTixSubWidget.__init__cCsx't|jjD]}|jqW|j|jjkrO|jj|j=|j|jjkrt|jj|j=|jr|jj d|j dS)Nr8) rPchildrenvaluesr8r^rVrUrqrrr;)rcrrrr8s zTixSubWidget.destroyN)r-r.r/r0r3r8rrrrros roc@speZdZdZiddZddZddZdd Zd d Zid d Z ddZ dS) DisplayStylezRDisplayStyle - handle configuration options shared by (multiple) Display ItemscKsd|kr|d}n4d|kr2|d}ntj}|sMtd|j|_|jjd||j|||_dS)NZ refwindowz1Too early to create display style: no root windowZtixDisplayStyle)r2rhrirrr" stylename)ritemtyper#r$rVrrrr3s       zDisplayStyle.__init__cCs|jS)N)r)rrrr__str__szDisplayStyle.__str__cCsh|r!|r!t||f}n |r-|}f}x.|jD] \}}|d||f}q@W|S)Nr)rrQ)rr#r$ZoptsrWrXrrrr"s zDisplayStyle._optionscCs|jj|jddS)Nrm)rrr)rrrrrmszDisplayStyle.deletecCs$|jj|jdd||dS)Nrz-%s)rrr)rr>r?rrrr@szDisplayStyle.__setitem__cKs"|j|jd|j||S)Nr)rrr")rr#r$rrrr<szDisplayStyle.configcCs|jj|jdd|S)Nrz-%s)rrr)rr>rrr __getitem__szDisplayStyle.__getitem__N) r-r.r/r0r3rr"rmr@r<rrrrrrs    rc@sCeZdZdZdiddZiddZddZdS) BalloonzBalloon help widget. Subwidget Class --------- ----- label Label message MessageNcKsmdddddg}tj||d|||t|ddd |jd