diff options
| author | Georg Brandl <georg@python.org> | 2008-05-29 07:18:49 (GMT) | 
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-05-29 07:18:49 (GMT) | 
| commit | 7943a3295d32daa88c7759d0a22e6e93642673b2 (patch) | |
| tree | 225824559e26d7e8d0b05484e3267ee10723e879 /Lib/lib-tk/Tkinter.py | |
| parent | 457501bf20a43b51dc14bc8106f1ee6fadd44727 (diff) | |
| download | cpython-7943a3295d32daa88c7759d0a22e6e93642673b2.zip cpython-7943a3295d32daa88c7759d0a22e6e93642673b2.tar.gz cpython-7943a3295d32daa88c7759d0a22e6e93642673b2.tar.bz2  | |
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Diffstat (limited to 'Lib/lib-tk/Tkinter.py')
| -rw-r--r-- | Lib/lib-tk/Tkinter.py | 34 | 
1 files changed, 19 insertions, 15 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 5e3938d..8bd3f50 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1053,6 +1053,12 @@ class Misc:                  if k[-1] == '_': k = k[:-1]                  if callable(v):                      v = self._register(v) +                elif isinstance(v, (tuple, list)): +                    for item in v: +                        if not isinstance(item, (basestring, int)): +                            break +                    else: +                        v = ' '.join(map(str, v))                  res = res + ('-'+k, v)          return res      def nametowidget(self, name): @@ -1092,7 +1098,6 @@ class Misc:              if self._tclCommands is None:                  self._tclCommands = []              self._tclCommands.append(name) -        #print '+ Tkinter created command', name          return name      register = _register      def _root(self): @@ -1747,10 +1752,11 @@ class Pack:          after=widget - pack it after you have packed widget          anchor=NSEW (or subset) - position widget according to                                    given direction -                before=widget - pack it before you will pack widget +        before=widget - pack it before you will pack widget          expand=bool - expand widget if parent size grows          fill=NONE or X or Y or BOTH - fill widget if widget grows          in=master - use master to contain this widget +        in_=master - see 'in' option description          ipadx=amount - add internal padding in x direction          ipady=amount - add internal padding in y direction          padx=amount - add padding in x direction @@ -1788,29 +1794,26 @@ class Place:      Base class to use the methods place_* in every widget."""      def place_configure(self, cnf={}, **kw):          """Place a widget in the parent widget. Use as options: -        in=master - master relative to which the widget is placed. +        in=master - master relative to which the widget is placed +        in_=master - see 'in' option description          x=amount - locate anchor of this widget at position x of master          y=amount - locate anchor of this widget at position y of master          relx=amount - locate anchor of this widget between 0.0 and 1.0                        relative to width of master (1.0 is right edge) -            rely=amount - locate anchor of this widget between 0.0 and 1.0 +        rely=amount - locate anchor of this widget between 0.0 and 1.0                        relative to height of master (1.0 is bottom edge) -            anchor=NSEW (or subset) - position anchor according to given direction +        anchor=NSEW (or subset) - position anchor according to given direction          width=amount - width of this widget in pixel          height=amount - height of this widget in pixel          relwidth=amount - width of this widget between 0.0 and 1.0                            relative to width of master (1.0 is the same width -                  as the master) -            relheight=amount - height of this widget between 0.0 and 1.0 +                          as the master) +        relheight=amount - height of this widget between 0.0 and 1.0                             relative to height of master (1.0 is the same -                   height as the master) -            bordermode="inside" or "outside" - whether to take border width of master widget -                                               into account -            """ -        for k in ['in_']: -            if kw.has_key(k): -                kw[k[:-1]] = kw[k] -                del kw[k] +                           height as the master) +        bordermode="inside" or "outside" - whether to take border width of +                                           master widget into account +        """          self.tk.call(                ('place', 'configure', self._w)                + self._options(cnf, kw)) @@ -1845,6 +1848,7 @@ class Grid:          column=number - use cell identified with given column (starting with 0)          columnspan=number - this widget will span several columns          in=master - use master to contain this widget +        in_=master - see 'in' option description          ipadx=amount - add internal padding in x direction          ipady=amount - add internal padding in y direction          padx=amount - add padding in x direction  | 
