[Python-bugs-list] [ python-Bugs-621511 ] Tix Checklist getselection getstatus bug
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 13 Nov 2002 22:09:31 -0800
Bugs item #621511, was opened at 2002-10-10 19:09
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=621511&group_id=5470
Category: Tkinter
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Kerry W. Clark (kerrywclark)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Tix Checklist getselection getstatus bug
Initial Comment:
The Tix Checklist widget commands getselection and
getstatus always return "none" instead of a list of
selected items.
When looking at the /Lib/lib-tk/Tix.py both these
routines are missing return statements:
def getselection(self, mode='on'):
'''Mode can be on, off, default'''
self.tk.call(self._w, 'getselection', mode)
def getstatus(self, entrypath):
self.tk.call(self._w, 'getstatus', entrypath)
When return statements are added these commands work as
advertised:
def getselection(self, mode='on'):
'''Mode can be on, off, default'''
return self.tk.call(self._w, 'getselection', mode)
def getstatus(self, entrypath):
return self.tk.call(self._w, 'getstatus',
entrypath)
This was seen in Python 2.2.1 but appears to be there
for earlier
releases as well. Is there a reason for this?
----------------------------------------------------------------------
Comment By: Internet Discovery (idiscovery)
Date: 2002-11-14 06:09
Message:
Logged In: YES
user_id=33229
the answer is just (untested)
return list (self.tk.split(self.tk.call(self._w, 'getselection', mode )))
isn't it?
I'll test it out and contribute an updated version of Tix.py - it looks
like there may be some others that should be using return.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-10-18 16:57
Message:
Logged In: YES
user_id=33168
I've got mail from Mike Clarkson with other changes in Tix.
I will sync up with Mike and fix this problem (he confirmed
this is bug.)
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-10-15 00:42
Message:
Logged In: YES
user_id=6380
idiscovery, can you mail me a patch?
----------------------------------------------------------------------
Comment By: Kerry W. Clark (kerrywclark)
Date: 2002-10-11 20:10
Message:
Logged In: YES
user_id=626964
Forgot the case with no selection:
def getselection(self, mode='on'):
'''Mode can be on, off, default'''
cnf = []
x = self.tk.call(self._w, 'getselection', mode)
if string.find (x, ' ') == -1:
if len(x) > 0:
cnf.append (x)
else:
cnf = list (self.tk.split(x))
return cnf
----------------------------------------------------------------------
Comment By: Kerry W. Clark (kerrywclark)
Date: 2002-10-11 19:57
Message:
Logged In: YES
user_id=626964
You are right. How would this look?
def getselection(self, mode='on'):
'''Mode can be on, off, default'''
cnf = []
x = self.tk.call(self._w, 'getselection', mode)
if string.find (x, ' ') == -1:
cnf.append (x)
else:
cnf = list (self.tk.split(x))
return cnf
----------------------------------------------------------------------
Comment By: Internet Discovery (idiscovery)
Date: 2002-10-11 17:14
Message:
Logged In: YES
user_id=33229
You're right - there should be values returned.
Ideally, getselection should return a Python list,
not just a Tcl string which is a list to Tcl.
Mike
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=621511&group_id=5470