[pygtk] Trouble getting a ListStore with dynamic column number.

Tim Evans t.evans at aranz.com
Fri Feb 1 09:54:37 WST 2008


Neil Dugan wrote:
[snip]
> I think it would be handy to be able to use a list or tuple to specify 
> the types as well.

You can do that.  For example, to create a list store with 10 str 
columns, do this:

    columns = [str] * 10
    liststore = gtk.ListStore(*columns)

The first line takes a list containing one 'str' type and repeats the 
list 10 times.  The second line uses the python "*args" syntax to expand 
the list into a list of arguments.

-- 
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/


More information about the pygtk mailing list