[pygtk] Liststore model

Volker Helm Helm.volker at gmx.de
Fri Jan 12 23:23:16 WST 2007


Hi Steve.

This was my intention, because the query against the database is fixed, maybe modified. But the result is defined for each column.

So, first a query against the database, result a the definition of the columns including the types and the names of each column. cur.description() is really nice ;).
Second I would generate the model, but I couldn't find a way to do dynamically. This would be an object the generate the treeview dynamically, so the header, the types of gtk.ListStore()  will be defined.

Hope I made myself clear,

Volker

-------- Original-Nachricht --------
Datum: Fri, 12 Jan 2007 07:56:21 -0500
Von: "Steve McClure" <sMcClure at racemi.com>
An: Volker Helm <Helm.volker at gmx.de>
Betreff: Re: [pygtk] Liststore model

> 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
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the pygtk mailing list