Share

Python megawidgets

Tracker: Bugs

5 PmwScrolledListBox's getcurselection() produces tcl error - ID: 2097054
Last Update: Comment added ( nanotube )

Calling getcurselection on PmwScrolledListBox when nothing is selected gets
this error:

File
"C:\Python25\Lib\site-packages\Pmw\Pmw_1_3\lib\PmwScrolledListBox.py", line
129, in getcurselection
rtn.append(self._listbox.get(sel))
File "C:\Python25\lib\lib-tk\Tkinter.py", line 2499, in get
return self.tk.call(self._w, 'get', first)
TclError: bad listbox index "None": must be active, anchor, end, @x,y, or a
number

This is fixed by changing the method to:

def getcurselection(self):
rtn = []
for sel in self.curselection():
if sel != "None":
rtn.append(self._listbox.get(sel))
return tuple(rtn)


Nobody/Anonymous ( nobody ) - 2008-09-06 15:24

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2009-07-07 15:33
Sender: nanotube

Hi
Which version of python and Pmw does this happen on? I cannot reproduce
using either python 2.5.2 or python 2.6.2. In my testing I see that
getcurselection with nothing selected gets a "sel" that's an empty list
returned from self.curselection(), the for loop thus doesn't do anything,
and the return value is again an empty tuple...


Log in to comment.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.