This is essential what I am looking to do, but it doesn't work. I appreciate your response.
>>> gtk.TreeStore( str * 5 ) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for *: 'type' and 'int' >>> gtk.TreeStore( [str] * 5 ) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: could not get typecode from object >>> a = [str] * 5 >>> a [<type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>] >>> gtk.TreeStore( a ) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: could not get typecode from object Thank you, -Alex Goretoy http://launchpad.net/~a1g On Sat, Nov 27, 2010 at 10:39 PM, John Stowers <[email protected] > wrote: > On Sat, 2010-11-27 at 20:40 -0600, alex goretoy wrote: > > Currently I am having to do this in my application to create dynamic > > treestore; is the a better way to do this? > > You could do > > treestore = gtk.TreeStore(object) > > where obj contains the list of strings. However you would then have to > write your own display functions [1] for the (presumed) treeview > columns. > > John > > [1] see gtk.TreeViewColumn.set_cell_data_func > > > > > > > def get_treestore(n): > > if n == 0: > > treestore = gtk.TreeStore(str); > > elif n == 1: > > treestore = gtk.TreeStore(str); > > elif n == 2: > > treestore = gtk.TreeStore(str, str); > > elif n == 3: > > treestore = gtk.TreeStore(str, str, str); > > elif n == 4: > > treestore = gtk.TreeStore(str, str, str, str); > > else: > > treestore = gtk.TreeStore(str); > > > > > > return treestore > > > > > > > > > > Thank you in advance, > > -Alex Goretoy > > > > _______________________________________________ > > 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/
