Issue 621511: Tix Checklist getselection getstatus bug (original) (raw)

Created on 2002-10-10 19:09 by kerrywclark, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (8)
msg12717 - (view) Author: Kerry W. Clark (kerrywclark) Date: 2002-10-10 19:09
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?
msg12718 - (view) Author: Internet Discovery (idiscovery) Date: 2002-10-11 17:14
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
msg12719 - (view) Author: Kerry W. Clark (kerrywclark) Date: 2002-10-11 19:57
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
msg12720 - (view) Author: Kerry W. Clark (kerrywclark) Date: 2002-10-11 20:10
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
msg12721 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-10-15 00:42
Logged In: YES user_id=6380 idiscovery, can you mail me a patch?
msg12722 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-10-18 16:57
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.)
msg12723 - (view) Author: Internet Discovery (idiscovery) Date: 2002-11-14 06:09
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.
msg12724 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-12-10 02:21
Logged In: YES user_id=33168 This was fixed in Tix 1.13
History
Date User Action Args
2022-04-10 16:05:44 admin set github: 37303
2002-10-10 19:09:12 kerrywclark create