TreeView complains about wrong row-content-array length

Marcel tanuva at googlemail.com
Sun Aug 17 19:09:41 CEST 2008


Hello,

I'm trying to set up a TreeView for displaying the contents of a folder and 
want two buttons to appear next to each entry as 2nd and 3rd column. I have 
configured the columns like this:

clnFiles = gtk.TreeViewColumn("Files", self.cellRenderer)
clnFiles.set_expand(True)
self.fileTree.append_column(clnFiles)
self.fileTree.append_column(gtk.TreeViewColumn("Play", self.cellRenderer))
self.fileTree.append_column(gtk.TreeViewColumn("Add", self.cellRenderer))

Now the first column should display the file name (what it does not atm...), 
the second and third contain a button each:

contents = os.listdir(self.musicdir)
for file in contents:
	rowContents = [file, gtk.Button("Play"), gtk.Button("Add")]
	print rowContents.__len__() # => "3"
	self.rows.append(self.fileStore.append(None, rowContents))

Here gtk complains about the length of row being "wrong", although there are 3 
columns and the length is clearly 3, too.
Using
self.rows.append(self.fileStore.append(None, [file])) # file is only the 
filename from the loop above
instead works fine, although there's no filename displayed then. (Don't know 
if that's related to this...)

What am I doing terribly wrong here?

Marcel



More information about the devel mailing list