On Sun, Jan 11, 2009 at 11:52 AM, ksadil <[email protected]> wrote: > Hello, > > > > I am trying to make my treeview handling code a bit cleaner (and less > verbose). I find myself rewriting very similar code each time that could be > > wrapped up in classes or methods, as I tend to make and use them in a > similar way each time. I would like to create a "spec" file, and have the > > script read the spec file and return the treeview and corresponding > treestore. The only problem is that I don't know how to pass a list of > types > > to the gtk.treestore() method at runtime. > > I would like to be able to do something like: > > column_types=[] > > column_types.append(gtk.gdk.Pixbuf) > > column_types.append(gobject.TYPE_STRING) > > column_types.append(gobject.TYPE_INT) > > my_treestore = gtk.treestore(column_types)
The asterisk is your friend... Try gtk.TreeStore(*column_types) to benefit from Python's arg magic. > > > > Any ideas or suggestions would be greatly appreciated. > > > > Thanks, > > Kim > > _______________________________________________ > pygtk mailing list [email protected] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://faq.pygtk.org/ > _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
