home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 December / CHIP_CD_2004-12.iso / bonus / oo / OOo_1.1.3_ru_RU_infra_WinIntel_install.exe / $PLUGINSDIR / f_0372 / python-core-2.2.2 / lib / lib-tk / Tix.py < prev    next >
Text File  |  2004-10-09  |  62KB  |  1,627 lines

  1. # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: Tix.py,v 1.7 2001/12/13 04:53:07 fdrake Exp $
  4. #
  5. # Tix.py -- Tix widget wrappers.
  6. #
  7. #    For Tix, see http://tix.sourceforge.net
  8. #
  9. #       - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
  10. #         based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
  11. #
  12. # NOTE: In order to minimize changes to Tkinter.py, some of the code here
  13. #       (TixWidget.__init__) has been taken from Tkinter (Widget.__init__)
  14. #       and will break if there are major changes in Tkinter.
  15. #
  16. # The Tix widgets are represented by a class hierarchy in python with proper
  17. # inheritance of base classes.
  18. #
  19. # As a result after creating a 'w = StdButtonBox', I can write
  20. #              w.ok['text'] = 'Who Cares'
  21. #    or              w.ok['bg'] = w['bg']
  22. # or even       w.ok.invoke()
  23. # etc.
  24. #
  25. # Compare the demo tixwidgets.py to the original Tcl program and you will
  26. # appreciate the advantages.
  27. #
  28.  
  29. import string
  30. from Tkinter import *
  31. from Tkinter import _flatten, _cnfmerge, _default_root
  32.  
  33. # WARNING - TkVersion is a limited precision floating point number
  34. if TkVersion < 3.999:
  35.     raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
  36.  
  37. import _tkinter # If this fails your Python may not be configured for Tk
  38. # TixVersion = string.atof(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix
  39. # WARNING - TixVersion is a limited precision floating point number
  40.  
  41. # Some more constants (for consistency with Tkinter)
  42. WINDOW = 'window'
  43. TEXT = 'text'
  44. STATUS = 'status'
  45. IMMEDIATE = 'immediate'
  46. IMAGE = 'image'
  47. IMAGETEXT = 'imagetext'
  48. BALLOON = 'balloon'
  49. AUTO = 'auto'
  50. ACROSSTOP = 'acrosstop'
  51.  
  52. # Some constants used by Tkinter dooneevent()
  53. TCL_DONT_WAIT     = 1 << 1
  54. TCL_WINDOW_EVENTS = 1 << 2
  55. TCL_FILE_EVENTS   = 1 << 3
  56. TCL_TIMER_EVENTS  = 1 << 4
  57. TCL_IDLE_EVENTS   = 1 << 5
  58. TCL_ALL_EVENTS    = 0
  59.  
  60. # BEWARE - this is implemented by copying some code from the Widget class
  61. #          in Tkinter (to override Widget initialization) and is therefore
  62. #          liable to break.
  63. import Tkinter, os
  64.  
  65. # Could probably add this to Tkinter.Misc
  66. class tixCommand:
  67.     """The tix commands provide access to miscellaneous  elements
  68.     of  Tix's  internal state and the Tix application context.
  69.     Most of the information manipulated by these  commands pertains
  70.     to  the  application  as a whole, or to a screen or
  71.     display, rather than to a particular window.
  72.  
  73.     This is a mixin class, assumed to be mixed to Tkinter.Tk
  74.     that supports the self.tk.call method.
  75.     """
  76.  
  77.     def tix_addbitmapdir(self, directory):
  78.         """Tix maintains a list of directories under which
  79.         the  tix_getimage  and tix_getbitmap commands will
  80.         search for image files. The standard bitmap  directory
  81.         is $TIX_LIBRARY/bitmaps. The addbitmapdir command
  82.         adds directory into this list. By  using  this
  83.         command, the  image  files  of an applications can
  84.         also be located using the tix_getimage or tix_getbitmap
  85.         command.
  86.         """
  87.         return self.tk.call('tix', 'addbitmapdir', directory)
  88.  
  89.     def tix_cget(self, option):
  90.         """Returns  the  current  value  of the configuration
  91.         option given by option. Option may be  any  of  the
  92.         options described in the CONFIGURATION OPTIONS section.
  93.         """
  94.         return self.tk.call('tix', 'cget', option)
  95.  
  96.     def tix_configure(self, cnf=None, **kw):
  97.         """Query or modify the configuration options of the Tix application
  98.         context. If no option is specified, returns a dictionary all of the
  99.         available options.  If option is specified with no value, then the
  100.         command returns a list describing the one named option (this list
  101.         will be identical to the corresponding sublist of the value
  102.         returned if no option is specified).  If one or more option-value
  103.         pairs are specified, then the command modifies the given option(s)
  104.         to have the given value(s); in this case the command returns an
  105.         empty string. Option may be any of the configuration options.
  106.         """
  107.         # Copied from Tkinter.py
  108.         if kw:
  109.             cnf = _cnfmerge((cnf, kw))
  110.         elif cnf:
  111.             cnf = _cnfmerge(cnf)
  112.         if cnf is None:
  113.             cnf = {}
  114.             for x in self.tk.split(self.tk.call('tix', 'configure')):
  115.                 cnf[x[0][1:]] = (x[0][1:],) + x[1:]
  116.             return cnf
  117.         if isinstance(cnf, StringType):
  118.             x = self.tk.split(self.tk.call('tix', 'configure', '-'+cnf))
  119.             return (x[0][1:],) + x[1:]
  120.         return self.tk.call(('tix', 'configure') + self._options(cnf))
  121.  
  122.     def tix_filedialog(self, dlgclass=None):
  123.         """Returns the file selection dialog that may be shared among
  124.         different calls from this application.  This command will create a
  125.         file selection dialog widget when it is called the first time. This
  126.         dialog will be returned by all subsequent calls to tix_filedialog.
  127.         An optional dlgclass parameter can be passed to specified what type
  128.         of file selection dialog widget is desired. Possible options are
  129.         tix FileSelectDialog or tixExFileSelectDialog.
  130.         """
  131.         if dlgclass is not None:
  132.             return self.tk.call('tix', 'filedialog', dlgclass)
  133.         else:
  134.             return self.tk.call('tix', 'filedialog')
  135.  
  136.     def tix_getbitmap(self, name):
  137.         """Locates a bitmap file of the name name.xpm or name in one of the
  138.         bitmap directories (see the tix_addbitmapdir command above).  By
  139.         using tix_getbitmap, you can avoid hard coding the pathnames of the
  140.         bitmap files in your application. When successful, it returns the
  141.         complete pathname of the bitmap file, prefixed with the character
  142.         '@'.  The returned value can be used to configure the -bitmap
  143.         option of the TK and Tix widgets.
  144.         """
  145.         return self.tk.call('tix', 'getbitmap', name)
  146.  
  147.     def tix_getimage(self, name):
  148.         """Locates an image file of the name name.xpm, name.xbm or name.ppm
  149.         in one of the bitmap directories (see the addbitmapdir command
  150.         above). If more than one file with the same name (but different
  151.         extensions) exist, then the image type is chosen according to the
  152.         depth of the X display: xbm images are chosen on monochrome
  153.         displays and color images are chosen on color displays. By using
  154.         tix_ getimage, you can advoid hard coding the pathnames of the
  155.         image files in your application. When successful, this command
  156.         returns the name of the newly created image, which can be used to
  157.         configure the -image option of the Tk and Tix widgets.
  158.         """
  159.         return self.tk.call('tix', 'getimage', name)
  160.  
  161.     def tix_option_get(self, name):
  162.         """Gets  the options  manitained  by  the  Tix
  163.         scheme mechanism. Available options include:
  164.  
  165.             active_bg       active_fg      bg
  166.             bold_font       dark1_bg       dark1_fg
  167.             dark2_bg        dark2_fg       disabled_fg
  168.             fg               fixed_font     font
  169.             inactive_bg     inactive_fg    input1_bg
  170.             input2_bg       italic_font    light1_bg
  171.             light1_fg       light2_bg      light2_fg
  172.             menu_font       output1_bg     output2_bg
  173.             select_bg       select_fg      selector
  174.             """
  175.         # could use self.tk.globalgetvar('tixOption', name)
  176.         return self.tk.call('tix', 'option', 'get', name)
  177.  
  178.     def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
  179.         """Resets the scheme and fontset of the Tix application to
  180.         newScheme and newFontSet, respectively.  This affects only those
  181.         widgets created after this call. Therefore, it is best to call the
  182.         resetoptions command before the creation of any widgets in a Tix
  183.         application.
  184.  
  185.         The optional parameter newScmPrio can be given to reset the
  186.         priority level of the Tk options set by the Tix schemes.
  187.  
  188.         Because of the way Tk handles the X option database, after Tix has
  189.         been has imported and inited, it is not possible to reset the color
  190.         schemes and font sets using the tix config command.  Instead, the
  191.         tix_resetoptions command must be used.
  192.         """
  193.         if newScmPrio is not None:
  194.             return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio)
  195.         else:
  196.             return self.tk.call('tix', 'resetoptions', newScheme, newFontSet)
  197.  
  198. class Tk(Tkinter.Tk, tixCommand):
  199.     """Toplevel widget of Tix which represents mostly the main window
  200.     of an application. It has an associated Tcl interpreter."""
  201.     def __init__(self, screenName=None, baseName=None, className='Tix'):
  202.         Tkinter.Tk.__init__(self, screenName, baseName, className)
  203.         tixlib = os.environ.get('TIX_LIBRARY')
  204.         self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]')
  205.         if tixlib is not None:
  206.             self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
  207.             self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
  208.         # Load Tix - this should work dynamically or statically
  209.         # If it's static, lib/tix8.1/pkgIndex.tcl should have
  210.         #        'load {} Tix'
  211.         # If it's dynamic under Unix, lib/tix8.1/pkgIndex.tcl should have
  212.         #        'load libtix8.1.8.3.so Tix'
  213.         self.tk.eval('package require Tix')
  214.  
  215.  
  216. # The Tix 'tixForm' geometry manager
  217. class Form:
  218.     """The Tix Form geometry manager
  219.  
  220.     Widgets can be arranged by specifying attachments to other widgets.
  221.     See Tix documentation for complete details"""
  222.  
  223.     def config(self, cnf={}, **kw):
  224.         apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw))
  225.  
  226.     form = config
  227.  
  228.     def __setitem__(self, key, value):
  229.         Form.form(self, {key: value})
  230.  
  231.     def check(self):
  232.         return self.tk.call('tixForm', 'check', self._w)
  233.  
  234.     def forget(self):
  235.         self.tk.call('tixForm', 'forget', self._w)
  236.  
  237.     def grid(self, xsize=0, ysize=0):
  238.         if (not xsize) and (not ysize):
  239.             x = self.tk.call('tixForm', 'grid', self._w)
  240.             y = self.tk.splitlist(x)
  241.             z = ()
  242.             for x in y:
  243.                 z = z + (self.tk.getint(x),)
  244.             return z
  245.         self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
  246.  
  247.     def info(self, option=None):
  248.         if not option:
  249.             return self.tk.call('tixForm', 'info', self._w)
  250.         if option[0] != '-':
  251.             option = '-' + option
  252.         return self.tk.call('tixForm', 'info', self._w, option)
  253.  
  254.     def slaves(self):
  255.         return map(self._nametowidget,
  256.                    self.tk.splitlist(
  257.                        self.tk.call(
  258.                        'tixForm', 'slaves', self._w)))
  259.  
  260.  
  261.     
  262.  
  263. Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
  264.  
  265. class TixWidget(Tkinter.Widget):
  266.     """A TixWidget class is used to package all (or most) Tix widgets.
  267.  
  268.     Widget initialization is extended in two ways:
  269.        1) It is possible to give a list of options which must be part of
  270.        the creation command (so called Tix 'static' options). These cannot be
  271.        given as a 'config' command later.
  272.        2) It is possible to give the name of an existing TK widget. These are
  273.        child widgets created automatically by a Tix mega-widget. The Tk call
  274.        to create these widgets is therefore bypassed in TixWidget.__init__
  275.  
  276.     Both options are for use by subclasses only.
  277.     """
  278.     def __init__ (self, master=None, widgetName=None,
  279.                 static_options=None, cnf={}, kw={}):
  280.        # Merge keywords and dictionary arguments
  281.        if kw:
  282.             cnf = _cnfmerge((cnf, kw))
  283.        else:
  284.            cnf = _cnfmerge(cnf)
  285.  
  286.        # Move static options into extra. static_options must be
  287.        # a list of keywords (or None).
  288.        extra=()
  289.        if static_options:
  290.            for k,v in cnf.items()[:]:
  291.               if k in static_options:
  292.                   extra = extra + ('-' + k, v)
  293.                   del cnf[k]
  294.  
  295.        self.widgetName = widgetName
  296.        Widget._setup(self, master, cnf)
  297.  
  298.        # If widgetName is None, this is a dummy creation call where the
  299.        # corresponding Tk widget has already been created by Tix
  300.        if widgetName:
  301.            apply(self.tk.call, (widgetName, self._w) + extra)
  302.  
  303.        # Non-static options - to be done via a 'config' command
  304.        if cnf:
  305.            Widget.config(self, cnf)
  306.  
  307.        # Dictionary to hold subwidget names for easier access. We can't
  308.        # use the children list because the public Tix names may not be the
  309.        # same as the pathname component
  310.        self.subwidget_list = {}
  311.  
  312.     # We set up an attribute access function so that it is possible to
  313.     # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
  314.     # when w is a StdButtonBox.
  315.     # We can even do w.ok.invoke() because w.ok is subclassed from the
  316.     # Button class if you go through the proper constructors
  317.     def __getattr__(self, name):
  318.        if self.subwidget_list.has_key(name):
  319.            return self.subwidget_list[name]
  320.        raise AttributeError, name
  321.  
  322.     def set_silent(self, value):
  323.        """Set a variable without calling its action routine"""
  324.        self.tk.call('tixSetSilent', self._w, value)
  325.  
  326.     def subwidget(self, name):
  327.        """Return the named subwidget (which must have been created by
  328.        the sub-class)."""
  329.        n = self._subwidget_name(name)
  330.        if not n:
  331.            raise TclError, "Subwidget " + name + " not child of " + self._name
  332.        # Remove header of name and leading dot
  333.        n = n[len(self._w)+1:]
  334.        return self._nametowidget(n)
  335.  
  336.     def subwidgets_all(self):
  337.        """Return all subwidgets."""
  338.        names = self._subwidget_names()
  339.        if not names:
  340.            return []
  341.        retlist = []
  342.        for name in names:
  343.            name = name[len(self._w)+1:]
  344.            try:
  345.               retlist.append(self._nametowidget(name))
  346.            except:
  347.               # some of the widgets are unknown e.g. border in LabelFrame
  348.               pass
  349.        return retlist
  350.  
  351.     def _subwidget_name(self,name):
  352.        """Get a subwidget name (returns a String, not a Widget !)"""
  353.        try:
  354.            return self.tk.call(self._w, 'subwidget', name)
  355.        except TclError:
  356.            return None
  357.  
  358.     def _subwidget_names(self):
  359.        """Return the name of all subwidgets."""
  360.        try:
  361.            x = self.tk.call(self._w, 'subwidgets', '-all')
  362.            return self.tk.split(x)
  363.        except TclError:
  364.            return None
  365.  
  366.     def config_all(self, option, value):
  367.        """Set configuration options for all subwidgets (and self)."""
  368.        if option == '':
  369.            return
  370.        elif not isinstance(option, StringType):
  371.            option = `option`
  372.        if not isinstance(value, StringType):
  373.            value = `value`
  374.        names = self._subwidget_names()
  375.        for name in names:
  376.            self.tk.call(name, 'configure', '-' + option, value)
  377.  
  378. # Subwidgets are child widgets created automatically by mega-widgets.
  379. # In python, we have to create these subwidgets manually to mirror their
  380. # existence in Tk/Tix.
  381. class TixSubWidget(TixWidget):
  382.     """Subwidget class.
  383.  
  384.     This is used to mirror child widgets automatically created
  385.     by Tix/Tk as part of a mega-widget in Python (which is not informed
  386.     of this)"""
  387.  
  388.     def __init__(self, master, name,
  389.                destroy_physically=1, check_intermediate=1):
  390.        if check_intermediate:
  391.            path = master._subwidget_name(name)
  392.            try:
  393.               path = path[len(master._w)+1:]
  394.               plist = string.splitfields(path, '.')
  395.            except:
  396.               plist = []
  397.  
  398.        if (not check_intermediate) or len(plist) < 2:
  399.            # immediate descendant
  400.            TixWidget.__init__(self, master, None, None, {'name' : name})
  401.        else:
  402.            # Ensure that the intermediate widgets exist
  403.            parent = master
  404.            for i in range(len(plist) - 1):
  405.               n = string.joinfields(plist[:i+1], '.')
  406.               try:
  407.                   w = master._nametowidget(n)
  408.                   parent = w
  409.               except KeyError:
  410.                   # Create the intermediate widget
  411.                   parent = TixSubWidget(parent, plist[i],
  412.                                      destroy_physically=0,
  413.                                      check_intermediate=0)
  414.            TixWidget.__init__(self, parent, None, None, {'name' : name})
  415.        self.destroy_physically = destroy_physically
  416.  
  417.     def destroy(self):
  418.        # For some widgets e.g., a NoteBook, when we call destructors,
  419.        # we must be careful not to destroy the frame widget since this
  420.        # also destroys the parent NoteBook thus leading to an exception
  421.        # in Tkinter when it finally calls Tcl to destroy the NoteBook
  422.        for c in self.children.values(): c.destroy()
  423.        if self.master.children.has_key(self._name):
  424.            del self.master.children[self._name]
  425.        if self.master.subwidget_list.has_key(self._name):
  426.            del self.master.subwidget_list[self._name]
  427.        if self.destroy_physically:
  428.            # This is bypassed only for a few widgets
  429.            self.tk.call('destroy', self._w)
  430.  
  431.  
  432. # Useful func. to split Tcl lists and return as a dict. From Tkinter.py
  433. def _lst2dict(lst):
  434.     dict = {}
  435.     for x in lst:
  436.        dict[x[0][1:]] = (x[0][1:],) + x[1:]
  437.     return dict
  438.  
  439. # Useful class to create a display style - later shared by many items.
  440. # Contributed by Steffen Kremser
  441. class DisplayStyle:
  442.     """DisplayStyle - handle configuration options shared by
  443.     (multiple) Display Items"""
  444.  
  445.     def __init__(self, itemtype, cnf={}, **kw ):
  446.         master = _default_root              # global from Tkinter
  447.         if not master and cnf.has_key('refwindow'): master=cnf['refwindow']
  448.         elif not master and kw.has_key('refwindow'):  master= kw['refwindow']
  449.         elif not master: raise RuntimeError, "Too early to create display style: no root window"
  450.         self.tk = master.tk
  451.         self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) +
  452.                             self._options(cnf,kw) )
  453.  
  454.     def __str__(self):
  455.        return self.stylename
  456.  
  457.     def _options(self, cnf, kw ):
  458.        if kw and cnf:
  459.            cnf = _cnfmerge((cnf, kw))
  460.        elif kw:
  461.            cnf = kw
  462.        opts = ()
  463.        for k, v in cnf.items():
  464.            opts = opts + ('-'+k, v)
  465.        return opts
  466.  
  467.     def delete(self):
  468.        self.tk.call(self.stylename, 'delete')
  469.        del(self)
  470.  
  471.     def __setitem__(self,key,value):
  472.        self.tk.call(self.stylename, 'configure', '-%s'%key, value)
  473.  
  474.     def config(self, cnf={}, **kw):
  475.        return _lst2dict(
  476.            self.tk.split(
  477.               apply(self.tk.call,
  478.                     (self.stylename, 'configure') + self._options(cnf,kw))))
  479.  
  480.     def __getitem__(self,key):
  481.        return self.tk.call(self.stylename, 'cget', '-%s'%key)
  482.  
  483.  
  484. ######################################################
  485. ### The Tix Widget classes - in alphabetical order ###
  486. ######################################################
  487.  
  488. class Balloon(TixWidget):
  489.     """Balloon help widget.
  490.  
  491.     Subwidget       Class
  492.     ---------       -----
  493.     label           Label
  494.     message         Message"""
  495.  
  496.     def __init__(self, master=None, cnf={}, **kw):
  497.         # static seem to be -installcolormap -initwait -statusbar -cursor
  498.        static = ['options', 'installcolormap', 'initwait', 'statusbar',
  499.                  'cursor']
  500.        TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
  501.        self.subwidget_list['label'] = _dummyLabel(self, 'label',
  502.                                                   destroy_physically=0)
  503.        self.subwidget_list['message'] = _dummyLabel(self, 'message',
  504.                                                     destroy_physically=0)
  505.  
  506.     def bind_widget(self, widget, cnf={}, **kw):
  507.        """Bind balloon widget to another.
  508.        One balloon widget may be bound to several widgets at the same time"""
  509.        apply(self.tk.call, 
  510.              (self._w, 'bind', widget._w) + self._options(cnf, kw))
  511.  
  512.     def unbind_widget(self, widget):
  513.        self.tk.call(self._w, 'unbind', widget._w)
  514.  
  515. class ButtonBox(TixWidget):
  516.     """ButtonBox - A container for pushbuttons.
  517.     Subwidgets are the buttons added with the add method.
  518.     """
  519.     def __init__(self, master=None, cnf={}, **kw):
  520.        TixWidget.__init__(self, master, 'tixButtonBox',
  521.                           ['orientation', 'options'], cnf, kw)
  522.  
  523.     def add(self, name, cnf={}, **kw):
  524.        """Add a button with given name to box."""
  525.  
  526.        btn = apply(self.tk.call,
  527.                    (self._w, 'add', name) + self._options(cnf, kw))
  528.        self.subwidget_list[name] = _dummyButton(self, name)
  529.        return btn
  530.  
  531.     def invoke(self, name):
  532.        if self.subwidget_list.has_key(name):
  533.            self.tk.call(self._w, 'invoke', name)
  534.  
  535. class ComboBox(TixWidget):
  536.     """ComboBox - an Entry field with a dropdown menu. The user can select a
  537.     choice by either typing in the entry subwdget or selecting from the
  538.     listbox subwidget.
  539.  
  540.     Subwidget       Class
  541.     ---------       -----
  542.     entry       Entry
  543.     arrow       Button
  544.     slistbox    ScrolledListBox
  545.     tick        Button 
  546.     cross       Button : present if created with the fancy option"""
  547.  
  548.     def __init__ (self, master=None, cnf={}, **kw):
  549.        TixWidget.__init__(self, master, 'tixComboBox', 
  550.                           ['editable', 'dropdown', 'fancy', 'options'],
  551.                           cnf, kw)
  552.        self.subwidget_list['label'] = _dummyLabel(self, 'label')
  553.        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
  554.        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
  555.        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
  556.                                                                'slistbox')
  557.        try:
  558.            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
  559.            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
  560.        except TypeError:
  561.            # unavailable when -fancy not specified
  562.            pass
  563.  
  564.     def add_history(self, str):
  565.        self.tk.call(self._w, 'addhistory', str)
  566.  
  567.     def append_history(self, str):
  568.        self.tk.call(self._w, 'appendhistory', str)
  569.  
  570.     def insert(self, index, str):
  571.        self.tk.call(self._w, 'insert', index, str)
  572.  
  573.     def pick(self, index):
  574.        self.tk.call(self._w, 'pick', index)
  575.  
  576. class Control(TixWidget):
  577.     """Control - An entry field with value change arrows.  The user can
  578.     adjust the value by pressing the two arrow buttons or by entering
  579.     the value directly into the entry. The new value will be checked
  580.     against the user-defined upper and lower limits.
  581.  
  582.     Subwidget       Class
  583.     ---------       -----
  584.     incr       Button
  585.     decr       Button
  586.     entry       Entry
  587.     label       Label"""
  588.  
  589.     def __init__ (self, master=None, cnf={}, **kw):
  590.        TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
  591.        self.subwidget_list['incr'] = _dummyButton(self, 'incr')
  592.        self.subwidget_list['decr'] = _dummyButton(self, 'decr')
  593.        self.subwidget_list['label'] = _dummyLabel(self, 'label')
  594.        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
  595.  
  596.     def decrement(self):
  597.        self.tk.call(self._w, 'decr')
  598.  
  599.     def increment(self):
  600.        self.tk.call(self._w, 'incr')
  601.  
  602.     def invoke(self):
  603.        self.tk.call(self._w, 'invoke')
  604.  
  605.     def update(self):
  606.        self.tk.call(self._w, 'update')
  607.  
  608. class DirList(TixWidget):
  609.     """DirList - displays a list view of a directory, its previous
  610.     directories and its sub-directories. The user can choose one of
  611.     the directories displayed in the list or change to another directory.
  612.  
  613.     Subwidget       Class
  614.     ---------       -----
  615.     hlist       HList
  616.     hsb              Scrollbar
  617.     vsb              Scrollbar"""
  618.  
  619.     def __init__(self, master, cnf={}, **kw):
  620.        TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
  621.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  622.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  623.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  624.  
  625.     def chdir(self, dir):
  626.        self.tk.call(self._w, 'chdir', dir)
  627.  
  628. class DirTree(TixWidget):
  629.     """DirTree - Directory Listing in a hierarchical view.
  630.     Displays a tree view of a directory, its previous directories and its
  631.     sub-directories. The user can choose one of the directories displayed
  632.     in the list or change to another directory.
  633.  
  634.     Subwidget       Class
  635.     ---------       -----
  636.     hlist       HList
  637.     hsb              Scrollbar
  638.     vsb              Scrollbar"""
  639.  
  640.     def __init__(self, master, cnf={}, **kw):
  641.        TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
  642.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  643.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  644.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  645.  
  646.     def chdir(self, dir):
  647.        self.tk.call(self._w, 'chdir', dir)
  648.  
  649. class DirSelectBox(TixWidget):
  650.     """DirSelectBox - Motif style file select box.
  651.     It is generally used for
  652.     the user to choose a file. FileSelectBox stores the files mostly
  653.     recently selected into a ComboBox widget so that they can be quickly
  654.     selected again.
  655.     
  656.     Subwidget       Class
  657.     ---------       -----
  658.     selection       ComboBox
  659.     filter       ComboBox
  660.     dirlist       ScrolledListBox
  661.     filelist       ScrolledListBox"""
  662.  
  663.     def __init__(self, master, cnf={}, **kw):
  664.        TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
  665.        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
  666.        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
  667.  
  668. class ExFileSelectBox(TixWidget):
  669.     """ExFileSelectBox - MS Windows style file select box.
  670.     It provides an convenient method for the user to select files.
  671.  
  672.     Subwidget       Class
  673.     ---------       -----
  674.     cancel       Button
  675.     ok              Button
  676.     hidden       Checkbutton
  677.     types       ComboBox
  678.     dir              ComboBox
  679.     file       ComboBox
  680.     dirlist       ScrolledListBox
  681.     filelist       ScrolledListBox"""
  682.  
  683.     def __init__(self, master, cnf={}, **kw):
  684.        TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
  685.        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
  686.        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
  687.        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
  688.        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
  689.        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
  690.        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
  691.        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
  692.        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
  693.  
  694.     def filter(self):
  695.        self.tk.call(self._w, 'filter')
  696.  
  697.     def invoke(self):
  698.        self.tk.call(self._w, 'invoke')
  699.  
  700.  
  701. # Should inherit from a Dialog class
  702. class DirSelectDialog(TixWidget):
  703.     """The DirSelectDialog widget presents the directories in the file
  704.     system in a dialog window. The user can use this dialog window to
  705.     navigate through the file system to select the desired directory.
  706.  
  707.     Subwidgets       Class
  708.     ----------       -----
  709.     dirbox       DirSelectDialog"""
  710.  
  711.     def __init__(self, master, cnf={}, **kw):
  712.        TixWidget.__init__(self, master, 'tixDirSelectDialog',
  713.                         ['options'], cnf, kw)
  714.        self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
  715.        # cancel and ok buttons are missing
  716.        
  717.     def popup(self):
  718.        self.tk.call(self._w, 'popup')
  719.  
  720.     def popdown(self):
  721.        self.tk.call(self._w, 'popdown')
  722.  
  723.  
  724. # Should inherit from a Dialog class
  725. class ExFileSelectDialog(TixWidget):
  726.     """ExFileSelectDialog - MS Windows style file select dialog.
  727.     It provides an convenient method for the user to select files.
  728.  
  729.     Subwidgets       Class
  730.     ----------       -----
  731.     fsbox       ExFileSelectBox"""
  732.  
  733.     def __init__(self, master, cnf={}, **kw):
  734.        TixWidget.__init__(self, master, 'tixExFileSelectDialog',
  735.                         ['options'], cnf, kw)
  736.        self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
  737.  
  738.     def popup(self):
  739.        self.tk.call(self._w, 'popup')
  740.  
  741.     def popdown(self):
  742.        self.tk.call(self._w, 'popdown')
  743.  
  744. class FileSelectBox(TixWidget):
  745.     """ExFileSelectBox - Motif style file select box.
  746.     It is generally used for
  747.     the user to choose a file. FileSelectBox stores the files mostly
  748.     recently selected into a ComboBox widget so that they can be quickly
  749.     selected again.
  750.     
  751.     Subwidget       Class
  752.     ---------       -----
  753.     selection       ComboBox
  754.     filter       ComboBox
  755.     dirlist       ScrolledListBox
  756.     filelist       ScrolledListBox"""
  757.  
  758.     def __init__(self, master, cnf={}, **kw):
  759.        TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
  760.        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
  761.        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
  762.        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
  763.        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
  764.  
  765.     def apply_filter(self):              # name of subwidget is same as command
  766.        self.tk.call(self._w, 'filter')
  767.  
  768.     def invoke(self):
  769.        self.tk.call(self._w, 'invoke')
  770.  
  771. # Should inherit from a Dialog class
  772. class FileSelectDialog(TixWidget):
  773.     """FileSelectDialog - Motif style file select dialog.
  774.  
  775.     Subwidgets       Class
  776.     ----------       -----
  777.     btns       StdButtonBox
  778.     fsbox       FileSelectBox"""
  779.  
  780.     def __init__(self, master, cnf={}, **kw):
  781.        TixWidget.__init__(self, master, 'tixFileSelectDialog',
  782.                         ['options'], cnf, kw)
  783.        self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
  784.        self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
  785.  
  786.     def popup(self):
  787.        self.tk.call(self._w, 'popup')
  788.  
  789.     def popdown(self):
  790.        self.tk.call(self._w, 'popdown')
  791.  
  792. class FileEntry(TixWidget):
  793.     """FileEntry - Entry field with button that invokes a FileSelectDialog.
  794.     The user can type in the filename manually. Alternatively, the user can
  795.     press the button widget that sits next to the entry, which will bring
  796.     up a file selection dialog.
  797.  
  798.     Subwidgets       Class
  799.     ----------       -----
  800.     button       Button
  801.     entry       Entry"""
  802.  
  803.     def __init__(self, master, cnf={}, **kw):
  804.        TixWidget.__init__(self, master, 'tixFileEntry',
  805.                         ['dialogtype', 'options'], cnf, kw)
  806.        self.subwidget_list['button'] = _dummyButton(self, 'button')
  807.        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
  808.  
  809.     def invoke(self):
  810.        self.tk.call(self._w, 'invoke')
  811.  
  812.     def file_dialog(self):
  813.        # XXX return python object
  814.        pass
  815.  
  816. class HList(TixWidget):
  817.     """HList - Hierarchy display  widget can be used to display any data
  818.     that have a hierarchical structure, for example, file system directory
  819.     trees. The list entries are indented and connected by branch lines
  820.     according to their places in the hierachy.
  821.  
  822.     Subwidgets - None"""
  823.  
  824.     def __init__ (self,master=None,cnf={}, **kw):
  825.        TixWidget.__init__(self, master, 'tixHList',
  826.                         ['columns', 'options'], cnf, kw)
  827.  
  828.     def add(self, entry, cnf={}, **kw):
  829.        return apply(self.tk.call,
  830.                    (self._w, 'add', entry) + self._options(cnf, kw))
  831.  
  832.     def add_child(self, parent=None, cnf={}, **kw):
  833.        if not parent:
  834.            parent = ''
  835.        return apply(self.tk.call,
  836.                    (self._w, 'addchild', parent) + self._options(cnf, kw))
  837.  
  838.     def anchor_set(self, entry):
  839.        self.tk.call(self._w, 'anchor', 'set', entry)
  840.  
  841.     def anchor_clear(self):
  842.        self.tk.call(self._w, 'anchor', 'clear')
  843.  
  844.     def column_width(self, col=0, width=None, chars=None):
  845.        if not chars:
  846.            return self.tk.call(self._w, 'column', 'width', col, width)
  847.        else:
  848.            return self.tk.call(self._w, 'column', 'width', col,
  849.                             '-char', chars)
  850.  
  851.     def delete_all(self):
  852.        self.tk.call(self._w, 'delete', 'all')
  853.  
  854.     def delete_entry(self, entry):
  855.        self.tk.call(self._w, 'delete', 'entry', entry)
  856.  
  857.     def delete_offsprings(self, entry):
  858.        self.tk.call(self._w, 'delete', 'offsprings', entry)
  859.  
  860.     def delete_siblings(self, entry):
  861.        self.tk.call(self._w, 'delete', 'siblings', entry)
  862.  
  863.     def dragsite_set(self, index):
  864.        self.tk.call(self._w, 'dragsite', 'set', index)
  865.  
  866.     def dragsite_clear(self):
  867.        self.tk.call(self._w, 'dragsite', 'clear')
  868.  
  869.     def dropsite_set(self, index):
  870.        self.tk.call(self._w, 'dropsite', 'set', index)
  871.  
  872.     def dropsite_clear(self):
  873.        self.tk.call(self._w, 'dropsite', 'clear')
  874.  
  875.     def header_create(self, col, cnf={}, **kw):
  876.         apply(self.tk.call,
  877.               (self._w, 'header', 'create', col) + self._options(cnf, kw))
  878.  
  879.     def header_configure(self, col, cnf={}, **kw):
  880.        if cnf is None:
  881.            return _lst2dict(
  882.               self.tk.split(
  883.                   self.tk.call(self._w, 'header', 'configure', col)))
  884.        apply(self.tk.call, (self._w, 'header', 'configure', col)
  885.              + self._options(cnf, kw))
  886.  
  887.     def header_cget(self,  col, opt):
  888.        return self.tk.call(self._w, 'header', 'cget', col, opt)
  889.  
  890.     def header_exists(self,  col):
  891.        return self.tk.call(self._w, 'header', 'exists', col)
  892.  
  893.     def header_delete(self, col):
  894.         self.tk.call(self._w, 'header', 'delete', col)
  895.  
  896.     def header_size(self, col):
  897.         return self.tk.call(self._w, 'header', 'size', col)
  898.  
  899.     def hide_entry(self, entry):
  900.        self.tk.call(self._w, 'hide', 'entry', entry)
  901.  
  902.     def indicator_create(self, entry, cnf={}, **kw):
  903.         apply(self.tk.call,
  904.               (self._w, 'indicator', 'create', entry) + self._options(cnf, kw))
  905.  
  906.     def indicator_configure(self, entry, cnf={}, **kw):
  907.        if cnf is None:
  908.            return _lst2dict(
  909.               self.tk.split(
  910.                   self.tk.call(self._w, 'indicator', 'configure', entry)))
  911.        apply(self.tk.call,
  912.              (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw))
  913.  
  914.     def indicator_cget(self,  entry, opt):
  915.        return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
  916.  
  917.     def indicator_exists(self,  entry):
  918.        return self.tk.call (self._w, 'indicator', 'exists', entry)
  919.  
  920.     def indicator_delete(self, entry):
  921.         self.tk.call(self._w, 'indicator', 'delete', entry)
  922.  
  923.     def indicator_size(self, entry):
  924.         return self.tk.call(self._w, 'indicator', 'size', entry)
  925.  
  926.     def info_anchor(self):
  927.        return self.tk.call(self._w, 'info', 'anchor')
  928.  
  929.     def info_children(self, entry=None):
  930.        c = self.tk.call(self._w, 'info', 'children', entry)
  931.        return self.tk.splitlist(c)
  932.  
  933.     def info_data(self, entry):
  934.        return self.tk.call(self._w, 'info', 'data', entry)
  935.  
  936.     def info_exists(self, entry):
  937.        return self.tk.call(self._w, 'info', 'exists', entry)
  938.  
  939.     def info_hidden(self, entry):
  940.        return self.tk.call(self._w, 'info', 'hidden', entry)
  941.  
  942.     def info_next(self, entry):
  943.        return self.tk.call(self._w, 'info', 'next', entry)
  944.  
  945.     def info_parent(self, entry):
  946.        return self.tk.call(self._w, 'info', 'parent', entry)
  947.  
  948.     def info_prev(self, entry):
  949.        return self.tk.call(self._w, 'info', 'prev', entry)
  950.  
  951.     def info_selection(self):
  952.        c = self.tk.call(self._w, 'info', 'selection')
  953.        return self.tk.splitlist(c)
  954.  
  955.     def item_cget(self, entry, col, opt):
  956.        return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
  957.  
  958.     def item_configure(self, entry, col, cnf={}, **kw):
  959.        if cnf is None:
  960.            return _lst2dict(
  961.               self.tk.split(
  962.                   self.tk.call(self._w, 'item', 'configure', entry, col)))
  963.        apply(self.tk.call, (self._w, 'item', 'configure', entry, col) +
  964.              self._options(cnf, kw))
  965.  
  966.     def item_create(self, entry, col, cnf={}, **kw):
  967.        apply(self.tk.call,
  968.              (self._w, 'item', 'create', entry, col) + self._options(cnf, kw))
  969.  
  970.     def item_exists(self, entry, col):
  971.        return self.tk.call(self._w, 'item', 'exists', entry, col)
  972.  
  973.     def item_delete(self, entry, col):
  974.        self.tk.call(self._w, 'item', 'delete', entry, col)
  975.  
  976.     def nearest(self, y):
  977.        return self.tk.call(self._w, 'nearest', y)
  978.  
  979.     def see(self, entry):
  980.        self.tk.call(self._w, 'see', entry)
  981.  
  982.     def selection_clear(self, cnf={}, **kw):
  983.        apply(self.tk.call,
  984.              (self._w, 'selection', 'clear') + self._options(cnf, kw))
  985.  
  986.     def selection_includes(self, entry):
  987.        return self.tk.call(self._w, 'selection', 'includes', entry)
  988.  
  989.     def selection_set(self, first, last=None):
  990.        self.tk.call(self._w, 'selection', 'set', first, last)
  991.  
  992.     def show_entry(self, entry):
  993.        return self.tk.call(self._w, 'show', 'entry', entry)
  994.  
  995.     def xview(self, *args):
  996.        apply(self.tk.call, (self._w, 'xview') + args)
  997.  
  998.     def yview(self, *args):
  999.        apply(self.tk.call, (self._w, 'yview') + args)
  1000.  
  1001. class InputOnly(TixWidget):
  1002.     """InputOnly - Invisible widget.
  1003.  
  1004.     Subwidgets - None"""
  1005.  
  1006.     def __init__ (self,master=None,cnf={}, **kw):
  1007.        TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
  1008.  
  1009. class LabelEntry(TixWidget):
  1010.     """LabelEntry - Entry field with label. Packages an entry widget
  1011.     and a label into one mega widget. It can beused be used to simplify
  1012.     the creation of ``entry-form'' type of interface.
  1013.  
  1014.     Subwidgets       Class
  1015.     ----------       -----
  1016.     label       Label
  1017.     entry       Entry"""
  1018.  
  1019.     def __init__ (self,master=None,cnf={}, **kw):
  1020.        TixWidget.__init__(self, master, 'tixLabelEntry',
  1021.                         ['labelside','options'], cnf, kw)
  1022.        self.subwidget_list['label'] = _dummyLabel(self, 'label')
  1023.        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
  1024.  
  1025. class LabelFrame(TixWidget):
  1026.     """LabelFrame - Labelled Frame container. Packages a frame widget
  1027.     and a label into one mega widget. To create widgets inside a
  1028.     LabelFrame widget, one creates the new widgets relative to the
  1029.     frame subwidget and manage them inside the frame subwidget.
  1030.  
  1031.     Subwidgets       Class
  1032.     ----------       -----
  1033.     label       Label
  1034.     frame       Frame"""
  1035.  
  1036.     def __init__ (self,master=None,cnf={}, **kw):
  1037.        TixWidget.__init__(self, master, 'tixLabelFrame',
  1038.                         ['labelside','options'], cnf, kw)
  1039.        self.subwidget_list['label'] = _dummyLabel(self, 'label')
  1040.        self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
  1041.  
  1042.  
  1043. class ListNoteBook(TixWidget):
  1044.     """A ListNoteBook widget is very similar to the TixNoteBook widget:
  1045.     it can be used to display many windows in a limited space using a
  1046.     notebook metaphor. The notebook is divided into a stack of pages
  1047.     (windows). At one time only one of these pages can be shown.
  1048.     The user can navigate through these pages by
  1049.     choosing the name of the desired page in the hlist subwidget."""
  1050.  
  1051.     def __init__(self, master, cnf={}, **kw):
  1052.        TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
  1053.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1054.        self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb')
  1055.  
  1056.  
  1057.     def add(self, name, cnf={}, **kw):
  1058.        apply(self.tk.call,
  1059.              (self._w, 'add', name) + self._options(cnf, kw))
  1060.        self.subwidget_list[name] = TixSubWidget(self, name)
  1061.        return self.subwidget_list[name]
  1062.  
  1063.     def raise_page(self, name):              # raise is a python keyword
  1064.        self.tk.call(self._w, 'raise', name)
  1065.  
  1066. class Meter(TixWidget):
  1067.     """The Meter widget can be used to show the progress of a background
  1068.     job which may take a long time to execute.
  1069.     """
  1070.  
  1071.     def __init__(self, master=None, cnf={}, **kw):
  1072.        TixWidget.__init__(self, master, 'tixMeter',
  1073.                         ['options'], cnf, kw)
  1074.  
  1075. class NoteBook(TixWidget):
  1076.     """NoteBook - Multi-page container widget (tabbed notebook metaphor).
  1077.  
  1078.     Subwidgets       Class
  1079.     ----------       -----
  1080.     nbframe       NoteBookFrame
  1081.     <pages>       page widgets added dynamically with the add method"""
  1082.  
  1083.     def __init__ (self,master=None,cnf={}, **kw):
  1084.        TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
  1085.        self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
  1086.                                                 destroy_physically=0)
  1087.  
  1088.     def add(self, name, cnf={}, **kw):
  1089.        apply(self.tk.call,
  1090.              (self._w, 'add', name) + self._options(cnf, kw))
  1091.        self.subwidget_list[name] = TixSubWidget(self, name)
  1092.        return self.subwidget_list[name]
  1093.  
  1094.     def delete(self, name):
  1095.        self.tk.call(self._w, 'delete', name)
  1096.  
  1097.     def page(self, name):
  1098.        return self.subwidget(name)
  1099.  
  1100.     def pages(self):
  1101.        # Can't call subwidgets_all directly because we don't want .nbframe
  1102.        names = self.tk.split(self.tk.call(self._w, 'pages'))
  1103.        ret = []
  1104.        for x in names:
  1105.            ret.append(self.subwidget(x))
  1106.        return ret
  1107.  
  1108.     def raise_page(self, name):              # raise is a python keyword
  1109.        self.tk.call(self._w, 'raise', name)
  1110.  
  1111.     def raised(self):
  1112.        return self.tk.call(self._w, 'raised')
  1113.  
  1114. class NoteBookFrame(TixWidget):
  1115.     """Will be added when Tix documentation is available !!!"""
  1116.     pass
  1117.  
  1118. class OptionMenu(TixWidget):
  1119.     """OptionMenu - creates a menu button of options.
  1120.  
  1121.     Subwidget       Class
  1122.     ---------       -----
  1123.     menubutton       Menubutton
  1124.     menu       Menu"""
  1125.  
  1126.     def __init__(self, master, cnf={}, **kw):
  1127.        TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw)
  1128.        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
  1129.        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
  1130.  
  1131.     def add_command(self, name, cnf={}, **kw):
  1132.        apply(self.tk.call,
  1133.              (self._w, 'add', 'command', name) + self._options(cnf, kw))
  1134.  
  1135.     def add_separator(self, name, cnf={}, **kw):
  1136.        apply(self.tk.call,
  1137.              (self._w, 'add', 'separator', name) + self._options(cnf, kw))
  1138.  
  1139.     def delete(self, name):
  1140.        self.tk.call(self._w, 'delete', name)
  1141.  
  1142.     def disable(self, name):
  1143.        self.tk.call(self._w, 'disable', name)
  1144.  
  1145.     def enable(self, name):
  1146.        self.tk.call(self._w, 'enable', name)
  1147.  
  1148. class PanedWindow(TixWidget):
  1149.     """PanedWindow - Multi-pane container widget
  1150.     allows the user to interactively manipulate the sizes of several
  1151.     panes. The panes can be arranged either vertically or horizontally.The
  1152.     user changes the sizes of the panes by dragging the resize handle
  1153.     between two panes.
  1154.  
  1155.     Subwidgets       Class
  1156.     ----------       -----
  1157.     <panes>       g/p widgets added dynamically with the add method."""
  1158.  
  1159.     def __init__(self, master, cnf={}, **kw):
  1160.        TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
  1161.  
  1162.     def add(self, name, cnf={}, **kw):
  1163.        apply(self.tk.call,
  1164.              (self._w, 'add', name) + self._options(cnf, kw))
  1165.        self.subwidget_list[name] = TixSubWidget(self, name,
  1166.                                            check_intermediate=0)
  1167.        return self.subwidget_list[name]
  1168.  
  1169.     def panes(self):
  1170.        names = self.tk.call(self._w, 'panes')
  1171.        ret = []
  1172.        for x in names:
  1173.            ret.append(self.subwidget(x))
  1174.        return ret
  1175.  
  1176. class PopupMenu(TixWidget):
  1177.     """PopupMenu widget can be used as a replacement of the tk_popup command.
  1178.     The advantage of the Tix PopupMenu widget is it requires less application
  1179.     code to manipulate.
  1180.  
  1181.  
  1182.     Subwidgets       Class
  1183.     ----------       -----
  1184.     menubutton       Menubutton
  1185.     menu       Menu"""
  1186.  
  1187.     def __init__(self, master, cnf={}, **kw):
  1188.        TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
  1189.        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
  1190.        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
  1191.  
  1192.     def bind_widget(self, widget):
  1193.        self.tk.call(self._w, 'bind', widget._w)
  1194.  
  1195.     def unbind_widget(self, widget):
  1196.        self.tk.call(self._w, 'unbind', widget._w)
  1197.  
  1198.     def post_widget(self, widget, x, y):
  1199.        self.tk.call(self._w, 'post', widget._w, x, y)
  1200.  
  1201. class ResizeHandle(TixWidget):
  1202.     """Internal widget to draw resize handles on Scrolled widgets."""
  1203.  
  1204.     def __init__(self, master, cnf={}, **kw):
  1205.        # There seems to be a Tix bug rejecting the configure method
  1206.        # Let's try making the flags -static
  1207.        flags = ['options', 'command', 'cursorfg', 'cursorbg',
  1208.                 'handlesize', 'hintcolor', 'hintwidth',
  1209.                 'x', 'y']
  1210.        # In fact, x y height width are configurable
  1211.        TixWidget.__init__(self, master, 'tixResizeHandle',
  1212.                            flags, cnf, kw)
  1213.  
  1214.     def attach_widget(self, widget):
  1215.        self.tk.call(self._w, 'attachwidget', widget._w)
  1216.  
  1217.     def detach_widget(self, widget):
  1218.        self.tk.call(self._w, 'detachwidget', widget._w)
  1219.  
  1220.     def hide(self, widget):
  1221.        self.tk.call(self._w, 'hide', widget._w)
  1222.  
  1223.     def show(self, widget):
  1224.        self.tk.call(self._w, 'show', widget._w)
  1225.  
  1226. class ScrolledHList(TixWidget):
  1227.     """ScrolledHList - HList with automatic scrollbars."""
  1228.  
  1229.     def __init__(self, master, cnf={}, **kw):
  1230.        TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
  1231.                         cnf, kw)
  1232.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1233.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1234.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1235.  
  1236. class ScrolledListBox(TixWidget):
  1237.     """ScrolledListBox - Listbox with automatic scrollbars."""
  1238.  
  1239.     def __init__(self, master, cnf={}, **kw):
  1240.        TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
  1241.        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
  1242.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1243.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1244.  
  1245. class ScrolledText(TixWidget):
  1246.     """ScrolledText - Text with automatic scrollbars."""
  1247.  
  1248.     def __init__(self, master, cnf={}, **kw):
  1249.        TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
  1250.        self.subwidget_list['text'] = _dummyText(self, 'text')
  1251.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1252.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1253.  
  1254. class ScrolledTList(TixWidget):
  1255.     """ScrolledTList - TList with automatic scrollbars."""
  1256.  
  1257.     def __init__(self, master, cnf={}, **kw):
  1258.        TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
  1259.                         cnf, kw)
  1260.        self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
  1261.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1262.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1263.  
  1264. class ScrolledWindow(TixWidget):
  1265.     """ScrolledWindow - Window with automatic scrollbars."""
  1266.  
  1267.     def __init__(self, master, cnf={}, **kw):
  1268.        TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
  1269.        self.subwidget_list['window'] = _dummyFrame(self, 'window')
  1270.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1271.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1272.  
  1273. class Select(TixWidget):
  1274.     """Select - Container of button subwidgets. It can be used to provide
  1275.     radio-box or check-box style of selection options for the user.
  1276.  
  1277.     Subwidgets are buttons added dynamically using the add method."""
  1278.  
  1279.     def __init__(self, master, cnf={}, **kw):
  1280.        TixWidget.__init__(self, master, 'tixSelect',
  1281.                         ['allowzero', 'radio', 'orientation', 'labelside',
  1282.                          'options'],
  1283.                         cnf, kw)
  1284.        self.subwidget_list['label'] = _dummyLabel(self, 'label')
  1285.  
  1286.     def add(self, name, cnf={}, **kw):
  1287.        apply(self.tk.call,
  1288.              (self._w, 'add', name) + self._options(cnf, kw))
  1289.        self.subwidget_list[name] = _dummyButton(self, name)
  1290.        return self.subwidget_list[name]
  1291.  
  1292.     def invoke(self, name):
  1293.        self.tk.call(self._w, 'invoke', name)
  1294.  
  1295. class StdButtonBox(TixWidget):
  1296.     """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """
  1297.  
  1298.     def __init__(self, master=None, cnf={}, **kw):
  1299.        TixWidget.__init__(self, master, 'tixStdButtonBox',
  1300.                         ['orientation', 'options'], cnf, kw)
  1301.        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
  1302.        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
  1303.        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
  1304.        self.subwidget_list['help'] = _dummyButton(self, 'help')
  1305.  
  1306.     def invoke(self, name):
  1307.        if self.subwidget_list.has_key(name):
  1308.            self.tk.call(self._w, 'invoke', name)
  1309.  
  1310. class TList(TixWidget):
  1311.     """TList - Hierarchy display widget which can be
  1312.     used to display data in a tabular format. The list entries of a TList
  1313.     widget are similar to the entries in the Tk listbox widget. The main
  1314.     differences are (1) the TList widget can display the list entries in a
  1315.     two dimensional format and (2) you can use graphical images as well as
  1316.     multiple colors and fonts for the list entries.
  1317.  
  1318.     Subwidgets - None"""
  1319.  
  1320.     def __init__ (self,master=None,cnf={}, **kw):
  1321.        TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
  1322.  
  1323.     def active_set(self, index):
  1324.        self.tk.call(self._w, 'active', 'set', index)
  1325.  
  1326.     def active_clear(self):
  1327.        self.tk.call(self._w, 'active', 'clear')
  1328.  
  1329.     def anchor_set(self, index):
  1330.        self.tk.call(self._w, 'anchor', 'set', index)
  1331.  
  1332.     def anchor_clear(self):
  1333.        self.tk.call(self._w, 'anchor', 'clear')
  1334.  
  1335.     def delete(self, from_, to=None):
  1336.        self.tk.call(self._w, 'delete', from_, to)
  1337.  
  1338.     def dragsite_set(self, index):
  1339.        self.tk.call(self._w, 'dragsite', 'set', index)
  1340.  
  1341.     def dragsite_clear(self):
  1342.        self.tk.call(self._w, 'dragsite', 'clear')
  1343.  
  1344.     def dropsite_set(self, index):
  1345.        self.tk.call(self._w, 'dropsite', 'set', index)
  1346.  
  1347.     def dropsite_clear(self):
  1348.        self.tk.call(self._w, 'dropsite', 'clear')
  1349.  
  1350.     def insert(self, index, cnf={}, **kw):
  1351.        apply(self.tk.call,
  1352.               (self._w, 'insert', index) + self._options(cnf, kw))
  1353.  
  1354.     def info_active(self):
  1355.        return self.tk.call(self._w, 'info', 'active')
  1356.  
  1357.     def info_anchor(self):
  1358.        return self.tk.call(self._w, 'info', 'anchor')
  1359.  
  1360.     def info_down(self, index):
  1361.        return self.tk.call(self._w, 'info', 'down', index)
  1362.  
  1363.     def info_left(self, index):
  1364.        return self.tk.call(self._w, 'info', 'left', index)
  1365.  
  1366.     def info_right(self, index):
  1367.        return self.tk.call(self._w, 'info', 'right', index)
  1368.  
  1369.     def info_selection(self):
  1370.        c = self.tk.call(self._w, 'info', 'selection')
  1371.        return self.tk.splitlist(c)
  1372.  
  1373.     def info_size(self):
  1374.        return self.tk.call(self._w, 'info', 'size')
  1375.  
  1376.     def info_up(self, index):
  1377.        return self.tk.call(self._w, 'info', 'up', index)
  1378.  
  1379.     def nearest(self, x, y):
  1380.        return self.tk.call(self._w, 'nearest', x, y)
  1381.  
  1382.     def see(self, index):
  1383.        self.tk.call(self._w, 'see', index)
  1384.  
  1385.     def selection_clear(self, cnf={}, **kw):
  1386.        apply(self.tk.call,
  1387.              (self._w, 'selection', 'clear') + self._options(cnf, kw))
  1388.  
  1389.     def selection_includes(self, index):
  1390.        return self.tk.call(self._w, 'selection', 'includes', index)
  1391.  
  1392.     def selection_set(self, first, last=None):
  1393.        self.tk.call(self._w, 'selection', 'set', first, last)
  1394.  
  1395.     def xview(self, *args):
  1396.        apply(self.tk.call, (self._w, 'xview') + args)
  1397.  
  1398.     def yview(self, *args):
  1399.        apply(self.tk.call, (self._w, 'yview') + args)
  1400.  
  1401. class Tree(TixWidget):
  1402.     """Tree - The tixTree widget can be used to display hierachical
  1403.     data in a tree form. The user can adjust
  1404.     the view of the tree by opening or closing parts of the tree."""
  1405.  
  1406.     def __init__(self, master=None, cnf={}, **kw):
  1407.        TixWidget.__init__(self, master, 'tixTree',
  1408.                         ['options'], cnf, kw)
  1409.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1410.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1411.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1412.  
  1413.     def autosetmode(self):
  1414.        self.tk.call(self._w, 'autosetmode')
  1415.  
  1416.     def close(self, entrypath):
  1417.        self.tk.call(self._w, 'close', entrypath)
  1418.  
  1419.     def getmode(self, entrypath):
  1420.        return self.tk.call(self._w, 'getmode', entrypath)
  1421.  
  1422.     def open(self, entrypath):
  1423.        self.tk.call(self._w, 'open', entrypath)
  1424.  
  1425.     def setmode(self, entrypath, mode='none'):
  1426.        self.tk.call(self._w, 'setmode', entrypath, mode)
  1427.  
  1428.  
  1429. # Could try subclassing Tree for CheckList - would need another arg to init
  1430. class CheckList(TixWidget):
  1431.     """The CheckList widget
  1432.     displays a list of items to be selected by the user. CheckList acts
  1433.     similarly to the Tk checkbutton or radiobutton widgets, except it is
  1434.     capable of handling many more items than checkbuttons or radiobuttons.
  1435.     """
  1436.  
  1437.     def __init__(self, master=None, cnf={}, **kw):
  1438.         TixWidget.__init__(self, master, 'tixCheckList',
  1439.                            ['options'], cnf, kw)
  1440.         self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1441.         self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1442.         self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1443.         
  1444.     def autosetmode(self):
  1445.         self.tk.call(self._w, 'autosetmode')
  1446.  
  1447.     def close(self, entrypath):
  1448.         self.tk.call(self._w, 'close', entrypath)
  1449.  
  1450.     def getmode(self, entrypath):
  1451.         return self.tk.call(self._w, 'getmode', entrypath)
  1452.  
  1453.     def open(self, entrypath):
  1454.         self.tk.call(self._w, 'open', entrypath)
  1455.  
  1456.     def getselection(self, mode='on'):
  1457.         '''Mode can be on, off, default'''
  1458.         self.tk.call(self._w, 'getselection', mode)
  1459.  
  1460.     def getstatus(self, entrypath):
  1461.         self.tk.call(self._w, 'getstatus', entrypath)
  1462.  
  1463.     def setstatus(self, entrypath, mode='on'):
  1464.         self.tk.call(self._w, 'setstatus', entrypath, mode)
  1465.  
  1466.  
  1467. ###########################################################################
  1468. ### The subclassing below is used to instantiate the subwidgets in each ###
  1469. ### mega widget. This allows us to access their methods directly.       ###
  1470. ###########################################################################
  1471.  
  1472. class _dummyButton(Button, TixSubWidget):
  1473.     def __init__(self, master, name, destroy_physically=1):
  1474.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1475.  
  1476. class _dummyCheckbutton(Checkbutton, TixSubWidget):
  1477.     def __init__(self, master, name, destroy_physically=1):
  1478.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1479.  
  1480. class _dummyEntry(Entry, TixSubWidget):
  1481.     def __init__(self, master, name, destroy_physically=1):
  1482.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1483.  
  1484. class _dummyFrame(Frame, TixSubWidget):
  1485.     def __init__(self, master, name, destroy_physically=1):
  1486.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1487.  
  1488. class _dummyLabel(Label, TixSubWidget):
  1489.     def __init__(self, master, name, destroy_physically=1):
  1490.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1491.  
  1492. class _dummyListbox(Listbox, TixSubWidget):
  1493.     def __init__(self, master, name, destroy_physically=1):
  1494.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1495.  
  1496. class _dummyMenu(Menu, TixSubWidget):
  1497.     def __init__(self, master, name, destroy_physically=1):
  1498.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1499.  
  1500. class _dummyMenubutton(Menubutton, TixSubWidget):
  1501.     def __init__(self, master, name, destroy_physically=1):
  1502.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1503.  
  1504. class _dummyScrollbar(Scrollbar, TixSubWidget):
  1505.     def __init__(self, master, name, destroy_physically=1):
  1506.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1507.  
  1508. class _dummyText(Text, TixSubWidget):
  1509.     def __init__(self, master, name, destroy_physically=1):
  1510.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1511.  
  1512. class _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
  1513.     def __init__(self, master, name, destroy_physically=1):
  1514.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1515.        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
  1516.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1517.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1518.  
  1519. class _dummyHList(HList, TixSubWidget):
  1520.     def __init__(self, master, name, destroy_physically=1):
  1521.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1522.  
  1523. class _dummyScrolledHList(ScrolledHList, TixSubWidget):
  1524.     def __init__(self, master, name, destroy_physically=1):
  1525.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1526.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1527.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1528.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1529.  
  1530. class _dummyTList(TList, TixSubWidget):
  1531.     def __init__(self, master, name, destroy_physically=1):
  1532.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1533.  
  1534. class _dummyComboBox(ComboBox, TixSubWidget):
  1535.     def __init__(self, master, name, destroy_physically=1):
  1536.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1537.        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
  1538.        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
  1539.        # I'm not sure about this destroy_physically=0 in all cases;
  1540.        # it may depend on if -dropdown is true; I've added as a trial
  1541.        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
  1542.                                                         'slistbox',
  1543.                                                         destroy_physically=0)
  1544.        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox',
  1545.                                                  destroy_physically=0)
  1546.  
  1547. class _dummyDirList(DirList, TixSubWidget):
  1548.     def __init__(self, master, name, destroy_physically=1):
  1549.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1550.        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
  1551.        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
  1552.        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
  1553.  
  1554. class _dummyDirSelectBox(DirSelectBox, TixSubWidget):
  1555.     def __init__(self, master, name, destroy_physically=1):
  1556.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1557.        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
  1558.        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
  1559.  
  1560. class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
  1561.     def __init__(self, master, name, destroy_physically=1):
  1562.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1563.        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
  1564.        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
  1565.        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
  1566.        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
  1567.        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
  1568.        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
  1569.        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
  1570.        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
  1571.  
  1572. class _dummyFileSelectBox(FileSelectBox, TixSubWidget):
  1573.     def __init__(self, master, name, destroy_physically=1):
  1574.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1575.        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
  1576.        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
  1577.        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
  1578.        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
  1579.  
  1580. class _dummyFileComboBox(ComboBox, TixSubWidget):
  1581.     def __init__(self, master, name, destroy_physically=1):
  1582.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1583.        self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
  1584.  
  1585. class _dummyStdButtonBox(StdButtonBox, TixSubWidget):
  1586.     def __init__(self, master, name, destroy_physically=1):
  1587.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1588.        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
  1589.        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
  1590.        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
  1591.        self.subwidget_list['help'] = _dummyButton(self, 'help')
  1592.  
  1593. class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget):
  1594.     def __init__(self, master, name, destroy_physically=0):
  1595.        TixSubWidget.__init__(self, master, name, destroy_physically)
  1596.  
  1597. ########################
  1598. ### Utility Routines ###
  1599. ########################
  1600.  
  1601. # Returns the qualified path name for the widget. Normally used to set
  1602. # default options for subwidgets. See tixwidgets.py
  1603. def OptionName(widget):
  1604.     return widget.tk.call('tixOptionName', widget._w)
  1605.  
  1606. # Called with a dictionary argument of the form
  1607. # {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'}
  1608. # returns a string which can be used to configure the fsbox file types
  1609. # in an ExFileSelectBox. i.e.,
  1610. # '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}'
  1611. def FileTypeList(dict):
  1612.     s = ''
  1613.     for type in dict.keys():
  1614.        s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
  1615.     return s
  1616.  
  1617. # Still to be done:
  1618. class CObjView(TixWidget):
  1619.     """This file implements the Canvas Object View widget. This is a base
  1620.     class of IconView. It implements automatic placement/adjustment of the
  1621.     scrollbars according to the canvas objects inside the canvas subwidget.
  1622.     The scrollbars are adjusted so that the canvas is just large enough
  1623.     to see all the objects.
  1624.     """
  1625.     pass
  1626.  
  1627.