[EMAIL PROTECTED] wrote:
> Hi,
> I have a Tktable object (self.table) and when I click on a row the
> whole row is selected.
>
> If I click of a button to get the row contents then
>
> self.table.curselection() fails with a traceback of:
>
> Traceback (most recent call last):
>   File
> "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/lib-tk/Tkinter.py",
> line 1345, in __call__
>     return self.func(*args)
>   File "/Users/jerry/python/PyPgExplorerUni/Resources/editor.py", line
> 159, in deleteRow
>     print self.table.curselection()
>   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/Tktable.py",
> line 139, in curselection
>     return self._getCells(self.tk.call(self._w, 'curselection'))
>   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/Tktable.py",
> line 106, in _getCells
>     for i in string.split(cellString):
>   File
> "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/string.py",
> line 292, in split
>     return s.split(sep, maxsplit)
> AttributeError: 'tuple' object has no attribute 'split'
>
> It is my reading that curselection will return the indices of the
> selected cells...
>
> Help,
>
> Jerry

looking into Tktable the curselection function is defined by:

    def curselection(self, setValue = None):
                if setValue != None:
                        self.tk.call(self._w, 'curselection', 'set', setValue)
                else:
                        return self._getCells(self.tk.call(self._w, 
'curselection'))

looking at getCells we see:

    def _getCells(self, cellString):
              #JHL
              print cellString
                res = []
                for i in string.split(cellString):
                        res.append(tuple(map(int, string.split(i, ','))))
                return res

When I run my program and select a row the value of cellString is

       ('3,0', '3,1', '3,2', '3,3', '3,4', '3,5', '3,6')

Which is the correct results...( ie the "fourth" row is selected and
there are six
columns...

Unfortunately the above is *not* a string and hence the "for" statement
fails.

It is hard to believe that I am the first person to attempt to retrieve
a selection
from a Tktable object....

Am I overlooking something obvious?

Jerry

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to