[pygtk] Liststore model

Steve McClure sMcClure at racemi.com
Fri Jan 12 21:56:21 WST 2007


On Fri, 2007-01-12 at 13:45 +0100, Volker Helm wrote:
> Hi,
> 
> I'm trying to implement programm based on a database. Since there are a lot of columns in a database I'd like to generate a gtk.ListStore model dynamicly.
> 
> normally, I'd do something like this:
> 
> import pygtk
> ...
> win = gtk.Window()
> listmodel = gtk.ListStore(str,str,str,int,str)
> tv = gtk.TreeView(listmodel)
> ...
> 
> I'd prefer:
> 
> import gtk
> ...
> win = gtk.Window()
> listmodel = gtk.Liststore(str)
> # now append some column to the model
> 
> # go on
> tv = gtk.Treeview(listmodel)
> 
> Does anybody has an idea, how to solve this problem without using completly the generic model?
> 
> Thanks in advance,
> 
> Volker

Can you fetch your schema before creating the ListStore and then,
knowing the schema at that point, pass the correct types to it?
-- 
Steve McClure                                   Racemi
email: smcclure at racemi.com                      380 Interstate North Pkwy, SE
voice: 404-892-5850                             Suite 250
fax: 404-892-7215                               Atlanta, GA 30339
                                                http://www.racemi.com



More information about the pygtk mailing list