[pygtk] dynamic treestore

2010-11-27 Thread alex goretoy
Currently I am having to do this in my application to create dynamic treestore; is the a better way to do this? def get_treestore(n): if n == 0: treestore = gtk.TreeStore(str); elif n == 1: treestore = gtk.TreeStore(str); elif n == 2:

Re: [pygtk] dynamic treestore

2010-11-27 Thread John Stowers
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

Re: [pygtk] dynamic treestore

2010-11-27 Thread alex goretoy
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

Re: [pygtk] dynamic treestore

2010-11-27 Thread John Stowers
On Sun, 2010-11-28 at 00:48 -0600, alex goretoy wrote: This is essential what I am looking to do, but it doesn't work. I appreciate your response. import gtk ts = gtk.ListStore(object) ts.append(([a,b],)) ts.append(([c,d],)) tv = gtk.TreeView(ts) r = gtk.CellRendererText() c =

Re: [pygtk] dynamic treestore

2010-11-27 Thread Marco Giusti
On Sat, Nov 27, 2010 at 08:40:46PM -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? def get_treestore(n): if n == 0: treestore = gtk.TreeStore(str); elif n == 1:

Re: [pygtk] dynamic treestore

2010-11-27 Thread alex goretoy
wow, thank you. This is exactly what I was looking for :) def get_treestore(n=1): if n: return gtk.TreeStore(*((str,) * n)) return gtk.TreeStore(str) Thank you, -Alex Goretoy http://launchpad.net/~a1g On Sun, Nov 28, 2010 at 1:40 AM, Marco Giusti