0001 # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- 0002 # 0003 # $Id: Tix.py,v 1.19 2004/07/18 06:14:44 tim_one Exp $ 0004 # 0005 # Tix.py -- Tix widget wrappers. 0006 # 0007 # For Tix, see http://tix.sourceforge.net 0008 # 0009 # - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995. 0010 # based on an idea of Jean-Marc Lugrin (lugrin@ms.com) 0011 # 0012 # NOTE: In order to minimize changes to Tkinter.py, some of the code here 0013 # (TixWidget.__init__) has been taken from Tkinter (Widget.__init__) 0014 # and will break if there are major changes in Tkinter. 0015 # 0016 # The Tix widgets are represented by a class hierarchy in python with proper 0017 # inheritance of base classes. 0018 # 0019 # As a result after creating a 'w = StdButtonBox', I can write 0020 # w.ok['text'] = 'Who Cares' 0021 # or w.ok['bg'] = w['bg'] 0022 # or even w.ok.invoke() 0023 # etc. 0024 # 0025 # Compare the demo tixwidgets.py to the original Tcl program and you will 0026 # appreciate the advantages. 0027 # 0028 0029 from Tkinter import * 0030 from Tkinter import _flatten, _cnfmerge, _default_root 0031 0032 # WARNING - TkVersion is a limited precision floating point number 0033 if TkVersion < 3.999: 0034 raise ImportError, "This version of Tix.py requires Tk 4.0 or higher" 0035 0036 import _tkinter # If this fails your Python may not be configured for Tk 0037 0038 # Some more constants (for consistency with Tkinter) 0039 WINDOW = 'window' 0040 TEXT = 'text' 0041 STATUS = 'status' 0042 IMMEDIATE = 'immediate' 0043 IMAGE = 'image' 0044 IMAGETEXT = 'imagetext' 0045 BALLOON = 'balloon' 0046 AUTO = 'auto' 0047 ACROSSTOP = 'acrosstop' 0048 0049 # Some constants used by Tkinter dooneevent() 0050 TCL_DONT_WAIT = 1 << 1 0051 TCL_WINDOW_EVENTS = 1 << 2 0052 TCL_FILE_EVENTS = 1 << 3 0053 TCL_TIMER_EVENTS = 1 << 4 0054 TCL_IDLE_EVENTS = 1 << 5 0055 TCL_ALL_EVENTS = 0 0056 0057 # BEWARE - this is implemented by copying some code from the Widget class 0058 # in Tkinter (to override Widget initialization) and is therefore 0059 # liable to break. 0060 import Tkinter, os 0061 0062 # Could probably add this to Tkinter.Misc 0063 class tixCommand: 0064 """The tix commands provide access to miscellaneous elements 0065 of Tix's internal state and the Tix application context. 0066 Most of the information manipulated by these commands pertains 0067 to the application as a whole, or to a screen or 0068 display, rather than to a particular window. 0069 0070 This is a mixin class, assumed to be mixed to Tkinter.Tk 0071 that supports the self.tk.call method. 0072 """ 0073 0074 def tix_addbitmapdir(self, directory): 0075 """Tix maintains a list of directories under which 0076 the tix_getimage and tix_getbitmap commands will 0077 search for image files. The standard bitmap directory 0078 is $TIX_LIBRARY/bitmaps. The addbitmapdir command 0079 adds directory into this list. By using this 0080 command, the image files of an applications can 0081 also be located using the tix_getimage or tix_getbitmap 0082 command. 0083 """ 0084 return self.tk.call('tix', 'addbitmapdir', directory) 0085 0086 def tix_cget(self, option): 0087 """Returns the current value of the configuration 0088 option given by option. Option may be any of the 0089 options described in the CONFIGURATION OPTIONS section. 0090 """ 0091 return self.tk.call('tix', 'cget', option) 0092 0093 def tix_configure(self, cnf=None, **kw): 0094 """Query or modify the configuration options of the Tix application 0095 context. If no option is specified, returns a dictionary all of the 0096 available options. If option is specified with no value, then the 0097 command returns a list describing the one named option (this list 0098 will be identical to the corresponding sublist of the value 0099 returned if no option is specified). If one or more option-value 0100 pairs are specified, then the command modifies the given option(s) 0101 to have the given value(s); in this case the command returns an 0102 empty string. Option may be any of the configuration options. 0103 """ 0104 # Copied from Tkinter.py 0105 if kw: 0106 cnf = _cnfmerge((cnf, kw)) 0107 elif cnf: 0108 cnf = _cnfmerge(cnf) 0109 if cnf is None: 0110 cnf = {} 0111 for x in self.tk.split(self.tk.call('tix', 'configure')): 0112 cnf[x[0][1:]] = (x[0][1:],) + x[1:] 0113 return cnf 0114 if isinstance(cnf, StringType): 0115 x = self.tk.split(self.tk.call('tix', 'configure', '-'+cnf)) 0116 return (x[0][1:],) + x[1:] 0117 return self.tk.call(('tix', 'configure') + self._options(cnf)) 0118 0119 def tix_filedialog(self, dlgclass=None): 0120 """Returns the file selection dialog that may be shared among 0121 different calls from this application. This command will create a 0122 file selection dialog widget when it is called the first time. This 0123 dialog will be returned by all subsequent calls to tix_filedialog. 0124 An optional dlgclass parameter can be passed to specified what type 0125 of file selection dialog widget is desired. Possible options are 0126 tix FileSelectDialog or tixExFileSelectDialog. 0127 """ 0128 if dlgclass is not None: 0129 return self.tk.call('tix', 'filedialog', dlgclass) 0130 else: 0131 return self.tk.call('tix', 'filedialog') 0132 0133 def tix_getbitmap(self, name): 0134 """Locates a bitmap file of the name name.xpm or name in one of the 0135 bitmap directories (see the tix_addbitmapdir command above). By 0136 using tix_getbitmap, you can avoid hard coding the pathnames of the 0137 bitmap files in your application. When successful, it returns the 0138 complete pathname of the bitmap file, prefixed with the character 0139 '@'. The returned value can be used to configure the -bitmap 0140 option of the TK and Tix widgets. 0141 """ 0142 return self.tk.call('tix', 'getbitmap', name) 0143 0144 def tix_getimage(self, name): 0145 """Locates an image file of the name name.xpm, name.xbm or name.ppm 0146 in one of the bitmap directories (see the addbitmapdir command 0147 above). If more than one file with the same name (but different 0148 extensions) exist, then the image type is chosen according to the 0149 depth of the X display: xbm images are chosen on monochrome 0150 displays and color images are chosen on color displays. By using 0151 tix_ getimage, you can advoid hard coding the pathnames of the 0152 image files in your application. When successful, this command 0153 returns the name of the newly created image, which can be used to 0154 configure the -image option of the Tk and Tix widgets. 0155 """ 0156 return self.tk.call('tix', 'getimage', name) 0157 0158 def tix_option_get(self, name): 0159 """Gets the options manitained by the Tix 0160 scheme mechanism. Available options include: 0161 0162 active_bg active_fg bg 0163 bold_font dark1_bg dark1_fg 0164 dark2_bg dark2_fg disabled_fg 0165 fg fixed_font font 0166 inactive_bg inactive_fg input1_bg 0167 input2_bg italic_font light1_bg 0168 light1_fg light2_bg light2_fg 0169 menu_font output1_bg output2_bg 0170 select_bg select_fg selector 0171 """ 0172 # could use self.tk.globalgetvar('tixOption', name) 0173 return self.tk.call('tix', 'option', 'get', name) 0174 0175 def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None): 0176 """Resets the scheme and fontset of the Tix application to 0177 newScheme and newFontSet, respectively. This affects only those 0178 widgets created after this call. Therefore, it is best to call the 0179 resetoptions command before the creation of any widgets in a Tix 0180 application. 0181 0182 The optional parameter newScmPrio can be given to reset the 0183 priority level of the Tk options set by the Tix schemes. 0184 0185 Because of the way Tk handles the X option database, after Tix has 0186 been has imported and inited, it is not possible to reset the color 0187 schemes and font sets using the tix config command. Instead, the 0188 tix_resetoptions command must be used. 0189 """ 0190 if newScmPrio is not None: 0191 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio) 0192 else: 0193 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet) 0194 0195 class Tk(Tkinter.Tk, tixCommand): 0196 """Toplevel widget of Tix which represents mostly the main window 0197 of an application. It has an associated Tcl interpreter.""" 0198 def __init__(self, screenName=None, baseName=None, className='Tix'): 0199 Tkinter.Tk.__init__(self, screenName, baseName, className) 0200 tixlib = os.environ.get('TIX_LIBRARY') 0201 self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]') 0202 if tixlib is not None: 0203 self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) 0204 self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) 0205 # Load Tix - this should work dynamically or statically 0206 # If it's static, tcl/tix8.1/pkgIndex.tcl should have 0207 # 'load {} Tix' 0208 # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have 0209 # 'load libtix8.1.8.3.so Tix' 0210 self.tk.eval('package require Tix') 0211 0212 def destroy(self): 0213 # For safety, remove an delete_window binding before destroy 0214 self.protocol("WM_DELETE_WINDOW", "") 0215 Tkinter.Tk.destroy(self) 0216 0217 # The Tix 'tixForm' geometry manager 0218 class Form: 0219 """The Tix Form geometry manager 0220 0221 Widgets can be arranged by specifying attachments to other widgets. 0222 See Tix documentation for complete details""" 0223 0224 def config(self, cnf={}, **kw): 0225 self.tk.call('tixForm', self._w, *self._options(cnf, kw)) 0226 0227 form = config 0228 0229 def __setitem__(self, key, value): 0230 Form.form(self, {key: value}) 0231 0232 def check(self): 0233 return self.tk.call('tixForm', 'check', self._w) 0234 0235 def forget(self): 0236 self.tk.call('tixForm', 'forget', self._w) 0237 0238 def grid(self, xsize=0, ysize=0): 0239 if (not xsize) and (not ysize): 0240 x = self.tk.call('tixForm', 'grid', self._w) 0241 y = self.tk.splitlist(x) 0242 z = () 0243 for x in y: 0244 z = z + (self.tk.getint(x),) 0245 return z 0246 return self.tk.call('tixForm', 'grid', self._w, xsize, ysize) 0247 0248 def info(self, option=None): 0249 if not option: 0250 return self.tk.call('tixForm', 'info', self._w) 0251 if option[0] != '-': 0252 option = '-' + option 0253 return self.tk.call('tixForm', 'info', self._w, option) 0254 0255 def slaves(self): 0256 return map(self._nametowidget, 0257 self.tk.splitlist( 0258 self.tk.call( 0259 'tixForm', 'slaves', self._w))) 0260 0261 0262 0263 Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,) 0264 0265 class TixWidget(Tkinter.Widget): 0266 """A TixWidget class is used to package all (or most) Tix widgets. 0267 0268 Widget initialization is extended in two ways: 0269 1) It is possible to give a list of options which must be part of 0270 the creation command (so called Tix 'static' options). These cannot be 0271 given as a 'config' command later. 0272 2) It is possible to give the name of an existing TK widget. These are 0273 child widgets created automatically by a Tix mega-widget. The Tk call 0274 to create these widgets is therefore bypassed in TixWidget.__init__ 0275 0276 Both options are for use by subclasses only. 0277 """ 0278 def __init__ (self, master=None, widgetName=None, 0279 static_options=None, cnf={}, kw={}): 0280 # Merge keywords and dictionary arguments 0281 if kw: 0282 cnf = _cnfmerge((cnf, kw)) 0283 else: 0284 cnf = _cnfmerge(cnf) 0285 0286 # Move static options into extra. static_options must be 0287 # a list of keywords (or None). 0288 extra=() 0289 0290 # 'options' is always a static option 0291 if static_options: 0292 static_options.append('options') 0293 else: 0294 static_options = ['options'] 0295 0296 for k,v in cnf.items()[:]: 0297 if k in static_options: 0298 extra = extra + ('-' + k, v) 0299 del cnf[k] 0300 0301 self.widgetName = widgetName 0302 Widget._setup(self, master, cnf) 0303 0304 # If widgetName is None, this is a dummy creation call where the 0305 # corresponding Tk widget has already been created by Tix 0306 if widgetName: 0307 self.tk.call(widgetName, self._w, *extra) 0308 0309 # Non-static options - to be done via a 'config' command 0310 if cnf: 0311 Widget.config(self, cnf) 0312 0313 # Dictionary to hold subwidget names for easier access. We can't 0314 # use the children list because the public Tix names may not be the 0315 # same as the pathname component 0316 self.subwidget_list = {} 0317 0318 # We set up an attribute access function so that it is possible to 0319 # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello' 0320 # when w is a StdButtonBox. 0321 # We can even do w.ok.invoke() because w.ok is subclassed from the 0322 # Button class if you go through the proper constructors 0323 def __getattr__(self, name): 0324 if self.subwidget_list.has_key(name): 0325 return self.subwidget_list[name] 0326 raise AttributeError, name 0327 0328 def set_silent(self, value): 0329 """Set a variable without calling its action routine""" 0330 self.tk.call('tixSetSilent', self._w, value) 0331 0332 def subwidget(self, name): 0333 """Return the named subwidget (which must have been created by 0334 the sub-class).""" 0335 n = self._subwidget_name(name) 0336 if not n: 0337 raise TclError, "Subwidget " + name + " not child of " + self._name 0338 # Remove header of name and leading dot 0339 n = n[len(self._w)+1:] 0340 return self._nametowidget(n) 0341 0342 def subwidgets_all(self): 0343 """Return all subwidgets.""" 0344 names = self._subwidget_names() 0345 if not names: 0346 return [] 0347 retlist = [] 0348 for name in names: 0349 name = name[len(self._w)+1:] 0350 try: 0351 retlist.append(self._nametowidget(name)) 0352 except: 0353 # some of the widgets are unknown e.g. border in LabelFrame 0354 pass 0355 return retlist 0356 0357 def _subwidget_name(self,name): 0358 """Get a subwidget name (returns a String, not a Widget !)""" 0359 try: 0360 return self.tk.call(self._w, 'subwidget', name) 0361 except TclError: 0362 return None 0363 0364 def _subwidget_names(self): 0365 """Return the name of all subwidgets.""" 0366 try: 0367 x = self.tk.call(self._w, 'subwidgets', '-all') 0368 return self.tk.split(x) 0369 except TclError: 0370 return None 0371 0372 def config_all(self, option, value): 0373 """Set configuration options for all subwidgets (and self).""" 0374 if option == '': 0375 return 0376 elif not isinstance(option, StringType): 0377 option = repr(option) 0378 if not isinstance(value, StringType): 0379 value = repr(value) 0380 names = self._subwidget_names() 0381 for name in names: 0382 self.tk.call(name, 'configure', '-' + option, value) 0383 # These are missing from Tkinter 0384 def image_create(self, imgtype, cnf={}, master=None, **kw): 0385 if not master: 0386 master = Tkinter._default_root 0387 if not master: 0388 raise RuntimeError, 'Too early to create image' 0389 if kw and cnf: cnf = _cnfmerge((cnf, kw)) 0390 elif kw: cnf = kw 0391 options = () 0392 for k, v in cnf.items(): 0393 if callable(v): 0394 v = self._register(v) 0395 options = options + ('-'+k, v) 0396 return master.tk.call(('image', 'create', imgtype,) + options) 0397 def image_delete(self, imgname): 0398 try: 0399 self.tk.call('image', 'delete', imgname) 0400 except TclError: 0401 # May happen if the root was destroyed 0402 pass 0403 0404 # Subwidgets are child widgets created automatically by mega-widgets. 0405 # In python, we have to create these subwidgets manually to mirror their 0406 # existence in Tk/Tix. 0407 class TixSubWidget(TixWidget): 0408 """Subwidget class. 0409 0410 This is used to mirror child widgets automatically created 0411 by Tix/Tk as part of a mega-widget in Python (which is not informed 0412 of this)""" 0413 0414 def __init__(self, master, name, 0415 destroy_physically=1, check_intermediate=1): 0416 if check_intermediate: 0417 path = master._subwidget_name(name) 0418 try: 0419 path = path[len(master._w)+1:] 0420 plist = path.split('.') 0421 except: 0422 plist = [] 0423 0424 if (not check_intermediate) or len(plist) < 2: 0425 # immediate descendant 0426 TixWidget.__init__(self, master, None, None, {'name' : name}) 0427 else: 0428 # Ensure that the intermediate widgets exist 0429 parent = master 0430 for i in range(len(plist) - 1): 0431 n = '.'.join(plist[:i+1]) 0432 try: 0433 w = master._nametowidget(n) 0434 parent = w 0435 except KeyError: 0436 # Create the intermediate widget 0437 parent = TixSubWidget(parent, plist[i], 0438 destroy_physically=0, 0439 check_intermediate=0) 0440 TixWidget.__init__(self, parent, None, None, {'name' : name}) 0441 self.destroy_physically = destroy_physically 0442 0443 def destroy(self): 0444 # For some widgets e.g., a NoteBook, when we call destructors, 0445 # we must be careful not to destroy the frame widget since this 0446 # also destroys the parent NoteBook thus leading to an exception 0447 # in Tkinter when it finally calls Tcl to destroy the NoteBook 0448 for c in self.children.values(): c.destroy() 0449 if self.master.children.has_key(self._name): 0450 del self.master.children[self._name] 0451 if self.master.subwidget_list.has_key(self._name): 0452 del self.master.subwidget_list[self._name] 0453 if self.destroy_physically: 0454 # This is bypassed only for a few widgets 0455 self.tk.call('destroy', self._w) 0456 0457 0458 # Useful func. to split Tcl lists and return as a dict. From Tkinter.py 0459 def _lst2dict(lst): 0460 dict = {} 0461 for x in lst: 0462 dict[x[0][1:]] = (x[0][1:],) + x[1:] 0463 return dict 0464 0465 # Useful class to create a display style - later shared by many items. 0466 # Contributed by Steffen Kremser 0467 class DisplayStyle: 0468 """DisplayStyle - handle configuration options shared by 0469 (multiple) Display Items""" 0470 0471 def __init__(self, itemtype, cnf={}, **kw ): 0472 master = _default_root # global from Tkinter 0473 if not master and cnf.has_key('refwindow'): master=cnf['refwindow'] 0474 elif not master and kw.has_key('refwindow'): master= kw['refwindow'] 0475 elif not master: raise RuntimeError, "Too early to create display style: no root window" 0476 self.tk = master.tk 0477 self.stylename = self.tk.call('tixDisplayStyle', itemtype, 0478 *self._options(cnf,kw) ) 0479 0480 def __str__(self): 0481 return self.stylename 0482 0483 def _options(self, cnf, kw ): 0484 if kw and cnf: 0485 cnf = _cnfmerge((cnf, kw)) 0486 elif kw: 0487 cnf = kw 0488 opts = () 0489 for k, v in cnf.items(): 0490 opts = opts + ('-'+k, v) 0491 return opts 0492 0493 def delete(self): 0494 self.tk.call(self.stylename, 'delete') 0495 0496 def __setitem__(self,key,value): 0497 self.tk.call(self.stylename, 'configure', '-%s'%key, value) 0498 0499 def config(self, cnf={}, **kw): 0500 return _lst2dict( 0501 self.tk.split( 0502 self.tk.call( 0503 self.stylename, 'configure', *self._options(cnf,kw)))) 0504 0505 def __getitem__(self,key): 0506 return self.tk.call(self.stylename, 'cget', '-%s'%key) 0507 0508 0509 ###################################################### 0510 ### The Tix Widget classes - in alphabetical order ### 0511 ###################################################### 0512 0513 class Balloon(TixWidget): 0514 """Balloon help widget. 0515 0516 Subwidget Class 0517 --------- ----- 0518 label Label 0519 message Message""" 0520 0521 # FIXME: It should inherit -superclass tixShell 0522 def __init__(self, master=None, cnf={}, **kw): 0523 # static seem to be -installcolormap -initwait -statusbar -cursor 0524 static = ['options', 'installcolormap', 'initwait', 'statusbar', 0525 'cursor'] 0526 TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw) 0527 self.subwidget_list['label'] = _dummyLabel(self, 'label', 0528 destroy_physically=0) 0529 self.subwidget_list['message'] = _dummyLabel(self, 'message', 0530 destroy_physically=0) 0531 0532 def bind_widget(self, widget, cnf={}, **kw): 0533 """Bind balloon widget to another. 0534 One balloon widget may be bound to several widgets at the same time""" 0535 self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw)) 0536 0537 def unbind_widget(self, widget): 0538 self.tk.call(self._w, 'unbind', widget._w) 0539 0540 class ButtonBox(TixWidget): 0541 """ButtonBox - A container for pushbuttons. 0542 Subwidgets are the buttons added with the add method. 0543 """ 0544 def __init__(self, master=None, cnf={}, **kw): 0545 TixWidget.__init__(self, master, 'tixButtonBox', 0546 ['orientation', 'options'], cnf, kw) 0547 0548 def add(self, name, cnf={}, **kw): 0549 """Add a button with given name to box.""" 0550 0551 btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) 0552 self.subwidget_list[name] = _dummyButton(self, name) 0553 return btn 0554 0555 def invoke(self, name): 0556 if self.subwidget_list.has_key(name): 0557 self.tk.call(self._w, 'invoke', name) 0558 0559 class ComboBox(TixWidget): 0560 """ComboBox - an Entry field with a dropdown menu. The user can select a 0561 choice by either typing in the entry subwdget or selecting from the 0562 listbox subwidget. 0563 0564 Subwidget Class 0565 --------- ----- 0566 entry Entry 0567 arrow Button 0568 slistbox ScrolledListBox 0569 tick Button 0570 cross Button : present if created with the fancy option""" 0571 0572 # FIXME: It should inherit -superclass tixLabelWidget 0573 def __init__ (self, master=None, cnf={}, **kw): 0574 TixWidget.__init__(self, master, 'tixComboBox', 0575 ['editable', 'dropdown', 'fancy', 'options'], 0576 cnf, kw) 0577 self.subwidget_list['label'] = _dummyLabel(self, 'label') 0578 self.subwidget_list['entry'] = _dummyEntry(self, 'entry') 0579 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') 0580 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, 0581 'slistbox') 0582 try: 0583 self.subwidget_list['tick'] = _dummyButton(self, 'tick') 0584 self.subwidget_list['cross'] = _dummyButton(self, 'cross') 0585 except TypeError: 0586 # unavailable when -fancy not specified 0587 pass 0588 0589 # align 0590 0591 def add_history(self, str): 0592 self.tk.call(self._w, 'addhistory', str) 0593 0594 def append_history(self, str): 0595 self.tk.call(self._w, 'appendhistory', str) 0596 0597 def insert(self, index, str): 0598 self.tk.call(self._w, 'insert', index, str) 0599 0600 def pick(self, index): 0601 self.tk.call(self._w, 'pick', index) 0602 0603 class Control(TixWidget): 0604 """Control - An entry field with value change arrows. The user can 0605 adjust the value by pressing the two arrow buttons or by entering 0606 the value directly into the entry. The new value will be checked 0607 against the user-defined upper and lower limits. 0608 0609 Subwidget Class 0610 --------- ----- 0611 incr Button 0612 decr Button 0613 entry Entry 0614 label Label""" 0615 0616 # FIXME: It should inherit -superclass tixLabelWidget 0617 def __init__ (self, master=None, cnf={}, **kw): 0618 TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) 0619 self.subwidget_list['incr'] = _dummyButton(self, 'incr') 0620 self.subwidget_list['decr'] = _dummyButton(self, 'decr') 0621 self.subwidget_list['label'] = _dummyLabel(self, 'label') 0622 self.subwidget_list['entry'] = _dummyEntry(self, 'entry') 0623 0624 def decrement(self): 0625 self.tk.call(self._w, 'decr') 0626 0627 def increment(self): 0628 self.tk.call(self._w, 'incr') 0629 0630 def invoke(self): 0631 self.tk.call(self._w, 'invoke') 0632 0633 def update(self): 0634 self.tk.call(self._w, 'update') 0635 0636 class DirList(TixWidget): 0637 """DirList - displays a list view of a directory, its previous 0638 directories and its sub-directories. The user can choose one of 0639 the directories displayed in the list or change to another directory. 0640 0641 Subwidget Class 0642 --------- ----- 0643 hlist HList 0644 hsb Scrollbar 0645 vsb Scrollbar""" 0646 0647 # FIXME: It should inherit -superclass tixScrolledHList 0648 def __init__(self, master, cnf={}, **kw): 0649 TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) 0650 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 0651 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 0652 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 0653 0654 def chdir(self, dir): 0655 self.tk.call(self._w, 'chdir', dir) 0656 0657 class DirTree(TixWidget): 0658 """DirTree - Directory Listing in a hierarchical view. 0659 Displays a tree view of a directory, its previous directories and its 0660 sub-directories. The user can choose one of the directories displayed 0661 in the list or change to another directory. 0662 0663 Subwidget Class 0664 --------- ----- 0665 hlist HList 0666 hsb Scrollbar 0667 vsb Scrollbar""" 0668 0669 # FIXME: It should inherit -superclass tixScrolledHList 0670 def __init__(self, master, cnf={}, **kw): 0671 TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) 0672 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 0673 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 0674 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 0675 0676 def chdir(self, dir): 0677 self.tk.call(self._w, 'chdir', dir) 0678 0679 class DirSelectBox(TixWidget): 0680 """DirSelectBox - Motif style file select box. 0681 It is generally used for 0682 the user to choose a file. FileSelectBox stores the files mostly 0683 recently selected into a ComboBox widget so that they can be quickly 0684 selected again. 0685 0686 Subwidget Class 0687 --------- ----- 0688 selection ComboBox 0689 filter ComboBox 0690 dirlist ScrolledListBox 0691 filelist ScrolledListBox""" 0692 0693 def __init__(self, master, cnf={}, **kw): 0694 TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw) 0695 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') 0696 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') 0697 0698 class ExFileSelectBox(TixWidget): 0699 """ExFileSelectBox - MS Windows style file select box. 0700 It provides an convenient method for the user to select files. 0701 0702 Subwidget Class 0703 --------- ----- 0704 cancel Button 0705 ok Button 0706 hidden Checkbutton 0707 types ComboBox 0708 dir ComboBox 0709 file ComboBox 0710 dirlist ScrolledListBox 0711 filelist ScrolledListBox""" 0712 0713 def __init__(self, master, cnf={}, **kw): 0714 TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) 0715 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') 0716 self.subwidget_list['ok'] = _dummyButton(self, 'ok') 0717 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') 0718 self.subwidget_list['types'] = _dummyComboBox(self, 'types') 0719 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') 0720 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') 0721 self.subwidget_list['file'] = _dummyComboBox(self, 'file') 0722 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') 0723 0724 def filter(self): 0725 self.tk.call(self._w, 'filter') 0726 0727 def invoke(self): 0728 self.tk.call(self._w, 'invoke') 0729 0730 0731 # Should inherit from a Dialog class 0732 class DirSelectDialog(TixWidget): 0733 """The DirSelectDialog widget presents the directories in the file 0734 system in a dialog window. The user can use this dialog window to 0735 navigate through the file system to select the desired directory. 0736 0737 Subwidgets Class 0738 ---------- ----- 0739 dirbox DirSelectDialog""" 0740 0741 # FIXME: It should inherit -superclass tixDialogShell 0742 def __init__(self, master, cnf={}, **kw): 0743 TixWidget.__init__(self, master, 'tixDirSelectDialog', 0744 ['options'], cnf, kw) 0745 self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox') 0746 # cancel and ok buttons are missing 0747 0748 def popup(self): 0749 self.tk.call(self._w, 'popup') 0750 0751 def popdown(self): 0752 self.tk.call(self._w, 'popdown') 0753 0754 0755 # Should inherit from a Dialog class 0756 class ExFileSelectDialog(TixWidget): 0757 """ExFileSelectDialog - MS Windows style file select dialog. 0758 It provides an convenient method for the user to select files. 0759 0760 Subwidgets Class 0761 ---------- ----- 0762 fsbox ExFileSelectBox""" 0763 0764 # FIXME: It should inherit -superclass tixDialogShell 0765 def __init__(self, master, cnf={}, **kw): 0766 TixWidget.__init__(self, master, 'tixExFileSelectDialog', 0767 ['options'], cnf, kw) 0768 self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') 0769 0770 def popup(self): 0771 self.tk.call(self._w, 'popup') 0772 0773 def popdown(self): 0774 self.tk.call(self._w, 'popdown') 0775 0776 class FileSelectBox(TixWidget): 0777 """ExFileSelectBox - Motif style file select box. 0778 It is generally used for 0779 the user to choose a file. FileSelectBox stores the files mostly 0780 recently selected into a ComboBox widget so that they can be quickly 0781 selected again. 0782 0783 Subwidget Class 0784 --------- ----- 0785 selection ComboBox 0786 filter ComboBox 0787 dirlist ScrolledListBox 0788 filelist ScrolledListBox""" 0789 0790 def __init__(self, master, cnf={}, **kw): 0791 TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) 0792 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') 0793 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') 0794 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') 0795 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') 0796 0797 def apply_filter(self): # name of subwidget is same as command 0798 self.tk.call(self._w, 'filter') 0799 0800 def invoke(self): 0801 self.tk.call(self._w, 'invoke') 0802 0803 # Should inherit from a Dialog class 0804 class FileSelectDialog(TixWidget): 0805 """FileSelectDialog - Motif style file select dialog. 0806 0807 Subwidgets Class 0808 ---------- ----- 0809 btns StdButtonBox 0810 fsbox FileSelectBox""" 0811 0812 # FIXME: It should inherit -superclass tixStdDialogShell 0813 def __init__(self, master, cnf={}, **kw): 0814 TixWidget.__init__(self, master, 'tixFileSelectDialog', 0815 ['options'], cnf, kw) 0816 self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') 0817 self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') 0818 0819 def popup(self): 0820 self.tk.call(self._w, 'popup') 0821 0822 def popdown(self): 0823 self.tk.call(self._w, 'popdown') 0824 0825 class FileEntry(TixWidget): 0826 """FileEntry - Entry field with button that invokes a FileSelectDialog. 0827 The user can type in the filename manually. Alternatively, the user can 0828 press the button widget that sits next to the entry, which will bring 0829 up a file selection dialog. 0830 0831 Subwidgets Class 0832 ---------- ----- 0833 button Button 0834 entry Entry""" 0835 0836 # FIXME: It should inherit -superclass tixLabelWidget 0837 def __init__(self, master, cnf={}, **kw): 0838 TixWidget.__init__(self, master, 'tixFileEntry', 0839 ['dialogtype', 'options'], cnf, kw) 0840 self.subwidget_list['button'] = _dummyButton(self, 'button') 0841 self.subwidget_list['entry'] = _dummyEntry(self, 'entry') 0842 0843 def invoke(self): 0844 self.tk.call(self._w, 'invoke') 0845 0846 def file_dialog(self): 0847 # FIXME: return python object 0848 pass 0849 0850 class HList(TixWidget): 0851 """HList - Hierarchy display widget can be used to display any data 0852 that have a hierarchical structure, for example, file system directory 0853 trees. The list entries are indented and connected by branch lines 0854 according to their places in the hierachy. 0855 0856 Subwidgets - None""" 0857 0858 def __init__ (self,master=None,cnf={}, **kw): 0859 TixWidget.__init__(self, master, 'tixHList', 0860 ['columns', 'options'], cnf, kw) 0861 0862 def add(self, entry, cnf={}, **kw): 0863 return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) 0864 0865 def add_child(self, parent=None, cnf={}, **kw): 0866 if not parent: 0867 parent = '' 0868 return self.tk.call( 0869 self._w, 'addchild', parent, *self._options(cnf, kw)) 0870 0871 def anchor_set(self, entry): 0872 self.tk.call(self._w, 'anchor', 'set', entry) 0873 0874 def anchor_clear(self): 0875 self.tk.call(self._w, 'anchor', 'clear') 0876 0877 def column_width(self, col=0, width=None, chars=None): 0878 if not chars: 0879 return self.tk.call(self._w, 'column', 'width', col, width) 0880 else: 0881 return self.tk.call(self._w, 'column', 'width', col, 0882 '-char', chars) 0883 0884 def delete_all(self): 0885 self.tk.call(self._w, 'delete', 'all') 0886 0887 def delete_entry(self, entry): 0888 self.tk.call(self._w, 'delete', 'entry', entry) 0889 0890 def delete_offsprings(self, entry): 0891 self.tk.call(self._w, 'delete', 'offsprings', entry) 0892 0893 def delete_siblings(self, entry): 0894 self.tk.call(self._w, 'delete', 'siblings', entry) 0895 0896 def dragsite_set(self, index): 0897 self.tk.call(self._w, 'dragsite', 'set', index) 0898 0899 def dragsite_clear(self): 0900 self.tk.call(self._w, 'dragsite', 'clear') 0901 0902 def dropsite_set(self, index): 0903 self.tk.call(self._w, 'dropsite', 'set', index) 0904 0905 def dropsite_clear(self): 0906 self.tk.call(self._w, 'dropsite', 'clear') 0907 0908 def header_create(self, col, cnf={}, **kw): 0909 self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw)) 0910 0911 def header_configure(self, col, cnf={}, **kw): 0912 if cnf is None: 0913 return _lst2dict( 0914 self.tk.split( 0915 self.tk.call(self._w, 'header', 'configure', col))) 0916 self.tk.call(self._w, 'header', 'configure', col, 0917 *self._options(cnf, kw)) 0918 0919 def header_cget(self, col, opt): 0920 return self.tk.call(self._w, 'header', 'cget', col, opt) 0921 0922 def header_exists(self, col): 0923 return self.tk.call(self._w, 'header', 'exists', col) 0924 0925 def header_delete(self, col): 0926 self.tk.call(self._w, 'header', 'delete', col) 0927 0928 def header_size(self, col): 0929 return self.tk.call(self._w, 'header', 'size', col) 0930 0931 def hide_entry(self, entry): 0932 self.tk.call(self._w, 'hide', 'entry', entry) 0933 0934 def indicator_create(self, entry, cnf={}, **kw): 0935 self.tk.call( 0936 self._w, 'indicator', 'create', entry, *self._options(cnf, kw)) 0937 0938 def indicator_configure(self, entry, cnf={}, **kw): 0939 if cnf is None: 0940 return _lst2dict( 0941 self.tk.split( 0942 self.tk.call(self._w, 'indicator', 'configure', entry))) 0943 self.tk.call( 0944 self._w, 'indicator', 'configure', entry, *self._options(cnf, kw)) 0945 0946 def indicator_cget(self, entry, opt): 0947 return self.tk.call(self._w, 'indicator', 'cget', entry, opt) 0948 0949 def indicator_exists(self, entry): 0950 return self.tk.call (self._w, 'indicator', 'exists', entry) 0951 0952 def indicator_delete(self, entry): 0953 self.tk.call(self._w, 'indicator', 'delete', entry) 0954 0955 def indicator_size(self, entry): 0956 return self.tk.call(self._w, 'indicator', 'size', entry) 0957 0958 def info_anchor(self): 0959 return self.tk.call(self._w, 'info', 'anchor') 0960 0961 def info_children(self, entry=None): 0962 c = self.tk.call(self._w, 'info', 'children', entry) 0963 return self.tk.splitlist(c) 0964 0965 def info_data(self, entry): 0966 return self.tk.call(self._w, 'info', 'data', entry) 0967 0968 def info_exists(self, entry): 0969 return self.tk.call(self._w, 'info', 'exists', entry) 0970 0971 def info_hidden(self, entry): 0972 return self.tk.call(self._w, 'info', 'hidden', entry) 0973 0974 def info_next(self, entry): 0975 return self.tk.call(self._w, 'info', 'next', entry) 0976 0977 def info_parent(self, entry): 0978 return self.tk.call(self._w, 'info', 'parent', entry) 0979 0980 def info_prev(self, entry): 0981 return self.tk.call(self._w, 'info', 'prev', entry) 0982 0983 def info_selection(self): 0984 c = self.tk.call(self._w, 'info', 'selection') 0985 return self.tk.splitlist(c) 0986 0987 def item_cget(self, entry, col, opt): 0988 return self.tk.call(self._w, 'item', 'cget', entry, col, opt) 0989 0990 def item_configure(self, entry, col, cnf={}, **kw): 0991 if cnf is None: 0992 return _lst2dict( 0993 self.tk.split( 0994 self.tk.call(self._w, 'item', 'configure', entry, col))) 0995 self.tk.call(self._w, 'item', 'configure', entry, col, 0996 *self._options(cnf, kw)) 0997 0998 def item_create(self, entry, col, cnf={}, **kw): 0999 self.tk.call( 1000 self._w, 'item', 'create', entry, col, *self._options(cnf, kw)) 1001 1002 def item_exists(self, entry, col): 1003 return self.tk.call(self._w, 'item', 'exists', entry, col) 1004 1005 def item_delete(self, entry, col): 1006 self.tk.call(self._w, 'item', 'delete', entry, col) 1007 1008 def entrycget(self, entry, opt): 1009 return self.tk.call(self._w, 'entrycget', entry, opt) 1010 1011 def entryconfigure(self, entry, cnf={}, **kw): 1012 if cnf is None: 1013 return _lst2dict( 1014 self.tk.split( 1015 self.tk.call(self._w, 'entryconfigure', entry))) 1016 self.tk.call(self._w, 'entryconfigure', entry, 1017 *self._options(cnf, kw)) 1018 1019 def nearest(self, y): 1020 return self.tk.call(self._w, 'nearest', y) 1021 1022 def see(self, entry): 1023 self.tk.call(self._w, 'see', entry) 1024 1025 def selection_clear(self, cnf={}, **kw): 1026 self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) 1027 1028 def selection_includes(self, entry): 1029 return self.tk.call(self._w, 'selection', 'includes', entry) 1030 1031 def selection_set(self, first, last=None): 1032 self.tk.call(self._w, 'selection', 'set', first, last) 1033 1034 def show_entry(self, entry): 1035 return self.tk.call(self._w, 'show', 'entry', entry) 1036 1037 def xview(self, *args): 1038 self.tk.call(self._w, 'xview', *args) 1039 1040 def yview(self, *args): 1041 self.tk.call(self._w, 'yview', *args) 1042 1043 class InputOnly(TixWidget): 1044 """InputOnly - Invisible widget. Unix only. 1045 1046 Subwidgets - None""" 1047 1048 def __init__ (self,master=None,cnf={}, **kw): 1049 TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw) 1050 1051 class LabelEntry(TixWidget): 1052 """LabelEntry - Entry field with label. Packages an entry widget 1053 and a label into one mega widget. It can beused be used to simplify 1054 the creation of ``entry-form'' type of interface. 1055 1056 Subwidgets Class 1057 ---------- ----- 1058 label Label 1059 entry Entry""" 1060 1061 def __init__ (self,master=None,cnf={}, **kw): 1062 TixWidget.__init__(self, master, 'tixLabelEntry', 1063 ['labelside','options'], cnf, kw) 1064 self.subwidget_list['label'] = _dummyLabel(self, 'label') 1065 self.subwidget_list['entry'] = _dummyEntry(self, 'entry') 1066 1067 class LabelFrame(TixWidget): 1068 """LabelFrame - Labelled Frame container. Packages a frame widget 1069 and a label into one mega widget. To create widgets inside a 1070 LabelFrame widget, one creates the new widgets relative to the 1071 frame subwidget and manage them inside the frame subwidget. 1072 1073 Subwidgets Class 1074 ---------- ----- 1075 label Label 1076 frame Frame""" 1077 1078 def __init__ (self,master=None,cnf={}, **kw): 1079 TixWidget.__init__(self, master, 'tixLabelFrame', 1080 ['labelside','options'], cnf, kw) 1081 self.subwidget_list['label'] = _dummyLabel(self, 'label') 1082 self.subwidget_list['frame'] = _dummyFrame(self, 'frame') 1083 1084 1085 class ListNoteBook(TixWidget): 1086 """A ListNoteBook widget is very similar to the TixNoteBook widget: 1087 it can be used to display many windows in a limited space using a 1088 notebook metaphor. The notebook is divided into a stack of pages 1089 (windows). At one time only one of these pages can be shown. 1090 The user can navigate through these pages by 1091 choosing the name of the desired page in the hlist subwidget.""" 1092 1093 def __init__(self, master, cnf={}, **kw): 1094 TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) 1095 # Is this necessary? It's not an exposed subwidget in Tix. 1096 self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', 1097 destroy_physically=0) 1098 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1099 self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist') 1100 1101 def add(self, name, cnf={}, **kw): 1102 self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) 1103 self.subwidget_list[name] = TixSubWidget(self, name) 1104 return self.subwidget_list[name] 1105 1106 def page(self, name): 1107 return self.subwidget(name) 1108 1109 def pages(self): 1110 # Can't call subwidgets_all directly because we don't want .nbframe 1111 names = self.tk.split(self.tk.call(self._w, 'pages')) 1112 ret = [] 1113 for x in names: 1114 ret.append(self.subwidget(x)) 1115 return ret 1116 1117 def raise_page(self, name): # raise is a python keyword 1118 self.tk.call(self._w, 'raise', name) 1119 1120 class Meter(TixWidget): 1121 """The Meter widget can be used to show the progress of a background 1122 job which may take a long time to execute. 1123 """ 1124 1125 def __init__(self, master=None, cnf={}, **kw): 1126 TixWidget.__init__(self, master, 'tixMeter', 1127 ['options'], cnf, kw) 1128 1129 class NoteBook(TixWidget): 1130 """NoteBook - Multi-page container widget (tabbed notebook metaphor). 1131 1132 Subwidgets Class 1133 ---------- ----- 1134 nbframe NoteBookFrame 1135 <pages> page widgets added dynamically with the add method""" 1136 1137 def __init__ (self,master=None,cnf={}, **kw): 1138 TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) 1139 self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', 1140 destroy_physically=0) 1141 1142 def add(self, name, cnf={}, **kw): 1143 self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) 1144 self.subwidget_list[name] = TixSubWidget(self, name) 1145 return self.subwidget_list[name] 1146 1147 def delete(self, name): 1148 self.tk.call(self._w, 'delete', name) 1149 self.subwidget_list[name].destroy() 1150 del self.subwidget_list[name] 1151 1152 def page(self, name): 1153 return self.subwidget(name) 1154 1155 def pages(self): 1156 # Can't call subwidgets_all directly because we don't want .nbframe 1157 names = self.tk.split(self.tk.call(self._w, 'pages')) 1158 ret = [] 1159 for x in names: 1160 ret.append(self.subwidget(x)) 1161 return ret 1162 1163 def raise_page(self, name): # raise is a python keyword 1164 self.tk.call(self._w, 'raise', name) 1165 1166 def raised(self): 1167 return self.tk.call(self._w, 'raised') 1168 1169 class NoteBookFrame(TixWidget): 1170 # FIXME: This is dangerous to expose to be called on its own. 1171 pass 1172 1173 class OptionMenu(TixWidget): 1174 """OptionMenu - creates a menu button of options. 1175 1176 Subwidget Class 1177 --------- ----- 1178 menubutton Menubutton 1179 menu Menu""" 1180 1181 def __init__(self, master, cnf={}, **kw): 1182 TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw) 1183 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') 1184 self.subwidget_list['menu'] = _dummyMenu(self, 'menu') 1185 1186 def add_command(self, name, cnf={}, **kw): 1187 self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw)) 1188 1189 def add_separator(self, name, cnf={}, **kw): 1190 self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw)) 1191 1192 def delete(self, name): 1193 self.tk.call(self._w, 'delete', name) 1194 1195 def disable(self, name): 1196 self.tk.call(self._w, 'disable', name) 1197 1198 def enable(self, name): 1199 self.tk.call(self._w, 'enable', name) 1200 1201 class PanedWindow(TixWidget): 1202 """PanedWindow - Multi-pane container widget 1203 allows the user to interactively manipulate the sizes of several 1204 panes. The panes can be arranged either vertically or horizontally.The 1205 user changes the sizes of the panes by dragging the resize handle 1206 between two panes. 1207 1208 Subwidgets Class 1209 ---------- ----- 1210 <panes> g/p widgets added dynamically with the add method.""" 1211 1212 def __init__(self, master, cnf={}, **kw): 1213 TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) 1214 1215 # add delete forget panecget paneconfigure panes setsize 1216 def add(self, name, cnf={}, **kw): 1217 self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) 1218 self.subwidget_list[name] = TixSubWidget(self, name, 1219 check_intermediate=0) 1220 return self.subwidget_list[name] 1221 1222 def delete(self, name): 1223 self.tk.call(self._w, 'delete', name) 1224 self.subwidget_list[name].destroy() 1225 del self.subwidget_list[name] 1226 1227 def forget(self, name): 1228 self.tk.call(self._w, 'forget', name) 1229 1230 def panecget(self, entry, opt): 1231 return self.tk.call(self._w, 'panecget', entry, opt) 1232 1233 def paneconfigure(self, entry, cnf={}, **kw): 1234 if cnf is None: 1235 return _lst2dict( 1236 self.tk.split( 1237 self.tk.call(self._w, 'paneconfigure', entry))) 1238 self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw)) 1239 1240 def panes(self): 1241 names = self.tk.call(self._w, 'panes') 1242 ret = [] 1243 for x in names: 1244 ret.append(self.subwidget(x)) 1245 return ret 1246 1247 class PopupMenu(TixWidget): 1248 """PopupMenu widget can be used as a replacement of the tk_popup command. 1249 The advantage of the Tix PopupMenu widget is it requires less application 1250 code to manipulate. 1251 1252 1253 Subwidgets Class 1254 ---------- ----- 1255 menubutton Menubutton 1256 menu Menu""" 1257 1258 # FIXME: It should inherit -superclass tixShell 1259 def __init__(self, master, cnf={}, **kw): 1260 TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw) 1261 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') 1262 self.subwidget_list['menu'] = _dummyMenu(self, 'menu') 1263 1264 def bind_widget(self, widget): 1265 self.tk.call(self._w, 'bind', widget._w) 1266 1267 def unbind_widget(self, widget): 1268 self.tk.call(self._w, 'unbind', widget._w) 1269 1270 def post_widget(self, widget, x, y): 1271 self.tk.call(self._w, 'post', widget._w, x, y) 1272 1273 class ResizeHandle(TixWidget): 1274 """Internal widget to draw resize handles on Scrolled widgets.""" 1275 def __init__(self, master, cnf={}, **kw): 1276 # There seems to be a Tix bug rejecting the configure method 1277 # Let's try making the flags -static 1278 flags = ['options', 'command', 'cursorfg', 'cursorbg', 1279 'handlesize', 'hintcolor', 'hintwidth', 1280 'x', 'y'] 1281 # In fact, x y height width are configurable 1282 TixWidget.__init__(self, master, 'tixResizeHandle', 1283 flags, cnf, kw) 1284 1285 def attach_widget(self, widget): 1286 self.tk.call(self._w, 'attachwidget', widget._w) 1287 1288 def detach_widget(self, widget): 1289 self.tk.call(self._w, 'detachwidget', widget._w) 1290 1291 def hide(self, widget): 1292 self.tk.call(self._w, 'hide', widget._w) 1293 1294 def show(self, widget): 1295 self.tk.call(self._w, 'show', widget._w) 1296 1297 class ScrolledHList(TixWidget): 1298 """ScrolledHList - HList with automatic scrollbars.""" 1299 1300 # FIXME: It should inherit -superclass tixScrolledWidget 1301 def __init__(self, master, cnf={}, **kw): 1302 TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], 1303 cnf, kw) 1304 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1305 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1306 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1307 1308 class ScrolledListBox(TixWidget): 1309 """ScrolledListBox - Listbox with automatic scrollbars.""" 1310 1311 # FIXME: It should inherit -superclass tixScrolledWidget 1312 def __init__(self, master, cnf={}, **kw): 1313 TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) 1314 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') 1315 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1316 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1317 1318 class ScrolledText(TixWidget): 1319 """ScrolledText - Text with automatic scrollbars.""" 1320 1321 # FIXME: It should inherit -superclass tixScrolledWidget 1322 def __init__(self, master, cnf={}, **kw): 1323 TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) 1324 self.subwidget_list['text'] = _dummyText(self, 'text') 1325 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1326 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1327 1328 class ScrolledTList(TixWidget): 1329 """ScrolledTList - TList with automatic scrollbars.""" 1330 1331 # FIXME: It should inherit -superclass tixScrolledWidget 1332 def __init__(self, master, cnf={}, **kw): 1333 TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], 1334 cnf, kw) 1335 self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') 1336 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1337 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1338 1339 class ScrolledWindow(TixWidget): 1340 """ScrolledWindow - Window with automatic scrollbars.""" 1341 1342 # FIXME: It should inherit -superclass tixScrolledWidget 1343 def __init__(self, master, cnf={}, **kw): 1344 TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) 1345 self.subwidget_list['window'] = _dummyFrame(self, 'window') 1346 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1347 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1348 1349 class Select(TixWidget): 1350 """Select - Container of button subwidgets. It can be used to provide 1351 radio-box or check-box style of selection options for the user. 1352 1353 Subwidgets are buttons added dynamically using the add method.""" 1354 1355 # FIXME: It should inherit -superclass tixLabelWidget 1356 def __init__(self, master, cnf={}, **kw): 1357 TixWidget.__init__(self, master, 'tixSelect', 1358 ['allowzero', 'radio', 'orientation', 'labelside', 1359 'options'], 1360 cnf, kw) 1361 self.subwidget_list['label'] = _dummyLabel(self, 'label') 1362 1363 def add(self, name, cnf={}, **kw): 1364 self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) 1365 self.subwidget_list[name] = _dummyButton(self, name) 1366 return self.subwidget_list[name] 1367 1368 def invoke(self, name): 1369 self.tk.call(self._w, 'invoke', name) 1370 1371 class Shell(TixWidget): 1372 """Toplevel window. 1373 1374 Subwidgets - None""" 1375 1376 def __init__ (self,master=None,cnf={}, **kw): 1377 TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw) 1378 1379 class DialogShell(TixWidget): 1380 """Toplevel window, with popup popdown and center methods. 1381 It tells the window manager that it is a dialog window and should be 1382 treated specially. The exact treatment depends on the treatment of 1383 the window manager. 1384 1385 Subwidgets - None""" 1386 1387 # FIXME: It should inherit from Shell 1388 def __init__ (self,master=None,cnf={}, **kw): 1389 TixWidget.__init__(self, master, 1390 'tixDialogShell', 1391 ['options', 'title', 'mapped', 1392 'minheight', 'minwidth', 1393 'parent', 'transient'], cnf, kw) 1394 1395 def popdown(self): 1396 self.tk.call(self._w, 'popdown') 1397 1398 def popup(self): 1399 self.tk.call(self._w, 'popup') 1400 1401 def center(self): 1402 self.tk.call(self._w, 'center') 1403 1404 class StdButtonBox(TixWidget): 1405 """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """ 1406 1407 def __init__(self, master=None, cnf={}, **kw): 1408 TixWidget.__init__(self, master, 'tixStdButtonBox', 1409 ['orientation', 'options'], cnf, kw) 1410 self.subwidget_list['ok'] = _dummyButton(self, 'ok') 1411 self.subwidget_list['apply'] = _dummyButton(self, 'apply') 1412 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') 1413 self.subwidget_list['help'] = _dummyButton(self, 'help') 1414 1415 def invoke(self, name): 1416 if self.subwidget_list.has_key(name): 1417 self.tk.call(self._w, 'invoke', name) 1418 1419 class TList(TixWidget): 1420 """TList - Hierarchy display widget which can be 1421 used to display data in a tabular format. The list entries of a TList 1422 widget are similar to the entries in the Tk listbox widget. The main 1423 differences are (1) the TList widget can display the list entries in a 1424 two dimensional format and (2) you can use graphical images as well as 1425 multiple colors and fonts for the list entries. 1426 1427 Subwidgets - None""" 1428 1429 def __init__ (self,master=None,cnf={}, **kw): 1430 TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw) 1431 1432 def active_set(self, index): 1433 self.tk.call(self._w, 'active', 'set', index) 1434 1435 def active_clear(self): 1436 self.tk.call(self._w, 'active', 'clear') 1437 1438 def anchor_set(self, index): 1439 self.tk.call(self._w, 'anchor', 'set', index) 1440 1441 def anchor_clear(self): 1442 self.tk.call(self._w, 'anchor', 'clear') 1443 1444 def delete(self, from_, to=None): 1445 self.tk.call(self._w, 'delete', from_, to) 1446 1447 def dragsite_set(self, index): 1448 self.tk.call(self._w, 'dragsite', 'set', index) 1449 1450 def dragsite_clear(self): 1451 self.tk.call(self._w, 'dragsite', 'clear') 1452 1453 def dropsite_set(self, index): 1454 self.tk.call(self._w, 'dropsite', 'set', index) 1455 1456 def dropsite_clear(self): 1457 self.tk.call(self._w, 'dropsite', 'clear') 1458 1459 def insert(self, index, cnf={}, **kw): 1460 self.tk.call(self._w, 'insert', index, *self._options(cnf, kw)) 1461 1462 def info_active(self): 1463 return self.tk.call(self._w, 'info', 'active') 1464 1465 def info_anchor(self): 1466 return self.tk.call(self._w, 'info', 'anchor') 1467 1468 def info_down(self, index): 1469 return self.tk.call(self._w, 'info', 'down', index) 1470 1471 def info_left(self, index): 1472 return self.tk.call(self._w, 'info', 'left', index) 1473 1474 def info_right(self, index): 1475 return self.tk.call(self._w, 'info', 'right', index) 1476 1477 def info_selection(self): 1478 c = self.tk.call(self._w, 'info', 'selection') 1479 return self.tk.splitlist(c) 1480 1481 def info_size(self): 1482 return self.tk.call(self._w, 'info', 'size') 1483 1484 def info_up(self, index): 1485 return self.tk.call(self._w, 'info', 'up', index) 1486 1487 def nearest(self, x, y): 1488 return self.tk.call(self._w, 'nearest', x, y) 1489 1490 def see(self, index): 1491 self.tk.call(self._w, 'see', index) 1492 1493 def selection_clear(self, cnf={}, **kw): 1494 self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) 1495 1496 def selection_includes(self, index): 1497 return self.tk.call(self._w, 'selection', 'includes', index) 1498 1499 def selection_set(self, first, last=None): 1500 self.tk.call(self._w, 'selection', 'set', first, last) 1501 1502 def xview(self, *args): 1503 self.tk.call(self._w, 'xview', *args) 1504 1505 def yview(self, *args): 1506 self.tk.call(self._w, 'yview', *args) 1507 1508 class Tree(TixWidget): 1509 """Tree - The tixTree widget can be used to display hierachical 1510 data in a tree form. The user can adjust 1511 the view of the tree by opening or closing parts of the tree.""" 1512 1513 # FIXME: It should inherit -superclass tixScrolledWidget 1514 def __init__(self, master=None, cnf={}, **kw): 1515 TixWidget.__init__(self, master, 'tixTree', 1516 ['options'], cnf, kw) 1517 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1518 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1519 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1520 1521 def autosetmode(self): 1522 '''This command calls the setmode method for all the entries in this 1523 Tree widget: if an entry has no child entries, its mode is set to 1524 none. Otherwise, if the entry has any hidden child entries, its mode is 1525 set to open; otherwise its mode is set to close.''' 1526 self.tk.call(self._w, 'autosetmode') 1527 1528 def close(self, entrypath): 1529 '''Close the entry given by entryPath if its mode is close.''' 1530 self.tk.call(self._w, 'close', entrypath) 1531 1532 def getmode(self, entrypath): 1533 '''Returns the current mode of the entry given by entryPath.''' 1534 return self.tk.call(self._w, 'getmode', entrypath) 1535 1536 def open(self, entrypath): 1537 '''Open the entry given by entryPath if its mode is open.''' 1538 self.tk.call(self._w, 'open', entrypath) 1539 1540 def setmode(self, entrypath, mode='none'): 1541 '''This command is used to indicate whether the entry given by 1542 entryPath has children entries and whether the children are visible. mode 1543 must be one of open, close or none. If mode is set to open, a (+) 1544 indicator is drawn next the the entry. If mode is set to close, a (-) 1545 indicator is drawn next the the entry. If mode is set to none, no 1546 indicators will be drawn for this entry. The default mode is none. The 1547 open mode indicates the entry has hidden children and this entry can be 1548 opened by the user. The close mode indicates that all the children of the 1549 entry are now visible and the entry can be closed by the user.''' 1550 self.tk.call(self._w, 'setmode', entrypath, mode) 1551 1552 1553 # Could try subclassing Tree for CheckList - would need another arg to init 1554 class CheckList(TixWidget): 1555 """The CheckList widget 1556 displays a list of items to be selected by the user. CheckList acts 1557 similarly to the Tk checkbutton or radiobutton widgets, except it is 1558 capable of handling many more items than checkbuttons or radiobuttons. 1559 """ 1560 # FIXME: It should inherit -superclass tixTree 1561 def __init__(self, master=None, cnf={}, **kw): 1562 TixWidget.__init__(self, master, 'tixCheckList', 1563 ['options'], cnf, kw) 1564 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1565 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1566 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1567 1568 def autosetmode(self): 1569 '''This command calls the setmode method for all the entries in this 1570 Tree widget: if an entry has no child entries, its mode is set to 1571 none. Otherwise, if the entry has any hidden child entries, its mode is 1572 set to open; otherwise its mode is set to close.''' 1573 self.tk.call(self._w, 'autosetmode') 1574 1575 def close(self, entrypath): 1576 '''Close the entry given by entryPath if its mode is close.''' 1577 self.tk.call(self._w, 'close', entrypath) 1578 1579 def getmode(self, entrypath): 1580 '''Returns the current mode of the entry given by entryPath.''' 1581 return self.tk.call(self._w, 'getmode', entrypath) 1582 1583 def open(self, entrypath): 1584 '''Open the entry given by entryPath if its mode is open.''' 1585 self.tk.call(self._w, 'open', entrypath) 1586 1587 def getselection(self, mode='on'): 1588 '''Returns a list of items whose status matches status. If status is 1589 not specified, the list of items in the "on" status will be returned. 1590 Mode can be on, off, default''' 1591 c = self.tk.split(self.tk.call(self._w, 'getselection', mode)) 1592 return self.tk.splitlist(c) 1593 1594 def getstatus(self, entrypath): 1595 '''Returns the current status of entryPath.''' 1596 return self.tk.call(self._w, 'getstatus', entrypath) 1597 1598 def setstatus(self, entrypath, mode='on'): 1599 '''Sets the status of entryPath to be status. A bitmap will be 1600 displayed next to the entry its status is on, off or default.''' 1601 self.tk.call(self._w, 'setstatus', entrypath, mode) 1602 1603 1604 ########################################################################### 1605 ### The subclassing below is used to instantiate the subwidgets in each ### 1606 ### mega widget. This allows us to access their methods directly. ### 1607 ########################################################################### 1608 1609 class _dummyButton(Button, TixSubWidget): 1610 def __init__(self, master, name, destroy_physically=1): 1611 TixSubWidget.__init__(self, master, name, destroy_physically) 1612 1613 class _dummyCheckbutton(Checkbutton, TixSubWidget): 1614 def __init__(self, master, name, destroy_physically=1): 1615 TixSubWidget.__init__(self, master, name, destroy_physically) 1616 1617 class _dummyEntry(Entry, TixSubWidget): 1618 def __init__(self, master, name, destroy_physically=1): 1619 TixSubWidget.__init__(self, master, name, destroy_physically) 1620 1621 class _dummyFrame(Frame, TixSubWidget): 1622 def __init__(self, master, name, destroy_physically=1): 1623 TixSubWidget.__init__(self, master, name, destroy_physically) 1624 1625 class _dummyLabel(Label, TixSubWidget): 1626 def __init__(self, master, name, destroy_physically=1): 1627 TixSubWidget.__init__(self, master, name, destroy_physically) 1628 1629 class _dummyListbox(Listbox, TixSubWidget): 1630 def __init__(self, master, name, destroy_physically=1): 1631 TixSubWidget.__init__(self, master, name, destroy_physically) 1632 1633 class _dummyMenu(Menu, TixSubWidget): 1634 def __init__(self, master, name, destroy_physically=1): 1635 TixSubWidget.__init__(self, master, name, destroy_physically) 1636 1637 class _dummyMenubutton(Menubutton, TixSubWidget): 1638 def __init__(self, master, name, destroy_physically=1): 1639 TixSubWidget.__init__(self, master, name, destroy_physically) 1640 1641 class _dummyScrollbar(Scrollbar, TixSubWidget): 1642 def __init__(self, master, name, destroy_physically=1): 1643 TixSubWidget.__init__(self, master, name, destroy_physically) 1644 1645 class _dummyText(Text, TixSubWidget): 1646 def __init__(self, master, name, destroy_physically=1): 1647 TixSubWidget.__init__(self, master, name, destroy_physically) 1648 1649 class _dummyScrolledListBox(ScrolledListBox, TixSubWidget): 1650 def __init__(self, master, name, destroy_physically=1): 1651 TixSubWidget.__init__(self, master, name, destroy_physically) 1652 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') 1653 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1654 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1655 1656 class _dummyHList(HList, TixSubWidget): 1657 def __init__(self, master, name, destroy_physically=1): 1658 TixSubWidget.__init__(self, master, name, destroy_physically) 1659 1660 class _dummyScrolledHList(ScrolledHList, TixSubWidget): 1661 def __init__(self, master, name, destroy_physically=1): 1662 TixSubWidget.__init__(self, master, name, destroy_physically) 1663 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1664 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1665 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1666 1667 class _dummyTList(TList, TixSubWidget): 1668 def __init__(self, master, name, destroy_physically=1): 1669 TixSubWidget.__init__(self, master, name, destroy_physically) 1670 1671 class _dummyComboBox(ComboBox, TixSubWidget): 1672 def __init__(self, master, name, destroy_physically=1): 1673 TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically]) 1674 self.subwidget_list['label'] = _dummyLabel(self, 'label') 1675 self.subwidget_list['entry'] = _dummyEntry(self, 'entry') 1676 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') 1677 1678 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, 1679 'slistbox') 1680 try: 1681 self.subwidget_list['tick'] = _dummyButton(self, 'tick') 1682 #cross Button : present if created with the fancy option 1683 self.subwidget_list['cross'] = _dummyButton(self, 'cross') 1684 except TypeError: 1685 # unavailable when -fancy not specified 1686 pass 1687 1688 class _dummyDirList(DirList, TixSubWidget): 1689 def __init__(self, master, name, destroy_physically=1): 1690 TixSubWidget.__init__(self, master, name, destroy_physically) 1691 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') 1692 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') 1693 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') 1694 1695 class _dummyDirSelectBox(DirSelectBox, TixSubWidget): 1696 def __init__(self, master, name, destroy_physically=1): 1697 TixSubWidget.__init__(self, master, name, destroy_physically) 1698 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') 1699 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') 1700 1701 class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget): 1702 def __init__(self, master, name, destroy_physically=1): 1703 TixSubWidget.__init__(self, master, name, destroy_physically) 1704 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') 1705 self.subwidget_list['ok'] = _dummyButton(self, 'ok') 1706 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') 1707 self.subwidget_list['types'] = _dummyComboBox(self, 'types') 1708 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') 1709 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') 1710 self.subwidget_list['file'] = _dummyComboBox(self, 'file') 1711 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') 1712 1713 class _dummyFileSelectBox(FileSelectBox, TixSubWidget): 1714 def __init__(self, master, name, destroy_physically=1): 1715 TixSubWidget.__init__(self, master, name, destroy_physically) 1716 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') 1717 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') 1718 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') 1719 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') 1720 1721 class _dummyFileComboBox(ComboBox, TixSubWidget): 1722 def __init__(self, master, name, destroy_physically=1): 1723 TixSubWidget.__init__(self, master, name, destroy_physically) 1724 self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx') 1725 1726 class _dummyStdButtonBox(StdButtonBox, TixSubWidget): 1727 def __init__(self, master, name, destroy_physically=1): 1728 TixSubWidget.__init__(self, master, name, destroy_physically) 1729 self.subwidget_list['ok'] = _dummyButton(self, 'ok') 1730 self.subwidget_list['apply'] = _dummyButton(self, 'apply') 1731 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') 1732 self.subwidget_list['help'] = _dummyButton(self, 'help') 1733 1734 class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): 1735 def __init__(self, master, name, destroy_physically=0): 1736 TixSubWidget.__init__(self, master, name, destroy_physically) 1737 1738 class _dummyPanedWindow(PanedWindow, TixSubWidget): 1739 def __init__(self, master, name, destroy_physically=1): 1740 TixSubWidget.__init__(self, master, name, destroy_physically) 1741 1742 ######################## 1743 ### Utility Routines ### 1744 ######################## 1745 1746 #mike Should tixDestroy be exposed as a wrapper? - but not for widgets. 1747 1748 def OptionName(widget): 1749 '''Returns the qualified path name for the widget. Normally used to set 1750 default options for subwidgets. See tixwidgets.py''' 1751 return widget.tk.call('tixOptionName', widget._w) 1752 1753 # Called with a dictionary argument of the form 1754 # {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'} 1755 # returns a string which can be used to configure the fsbox file types 1756 # in an ExFileSelectBox. i.e., 1757 # '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}' 1758 def FileTypeList(dict): 1759 s = '' 1760 for type in dict.keys(): 1761 s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' 1762 return s 1763 1764 # Still to be done: 1765 # tixIconView 1766 class CObjView(TixWidget): 1767 """This file implements the Canvas Object View widget. This is a base 1768 class of IconView. It implements automatic placement/adjustment of the 1769 scrollbars according to the canvas objects inside the canvas subwidget. 1770 The scrollbars are adjusted so that the canvas is just large enough 1771 to see all the objects. 1772 """ 1773 # FIXME: It should inherit -superclass tixScrolledWidget 1774 pass 1775 1776 class Grid(TixWidget): 1777 '''The Tix Grid command creates a new window and makes it into a 1778 tixGrid widget. Additional options, may be specified on the command 1779 line or in the option database to configure aspects such as its cursor 1780 and relief. 1781 1782 A Grid widget displays its contents in a two dimensional grid of cells. 1783 Each cell may contain one Tix display item, which may be in text, 1784 graphics or other formats. See the DisplayStyle class for more information 1785 about Tix display items. Individual cells, or groups of cells, can be 1786 formatted with a wide range of attributes, such as its color, relief and 1787 border. 1788 1789 Subwidgets - None''' 1790 pass 1791 1792 # def anchor option ?args ...? 1793 # def bdtype 1794 # def delete dim from ?to? 1795 # def edit apply 1796 # def edit set x y 1797 # def entrycget x y option 1798 # def entryconfigure x y ?option? ?value option value ...? 1799 # def format 1800 # def index 1801 # def move dim from to offset 1802 # def set x y ?-itemtype type? ?option value...? 1803 # def size dim index ?option value ...? 1804 # def unset x y 1805 # def xview 1806 # def yview 1807 1808 class ScrolledGrid(TixWidget): 1809 '''Scrolled Grid widgets''' 1810 1811 # FIXME: It should inherit -superclass tixScrolledWidget 1812 pass 1813
Generated by PyXR 0.9.4