Hi Jarek,

> > 1. A select is send to a database:
> > cur.execute("select position,article,name,amount,value from
> table_bill_pos")
> > pos = cur.fetchall()
> > 
> > 2. depending on the result, I generate the model:
> > listmodel = gtk.ListStore(int,str,str,str,str)
> > 
> > 3. create the TreeView:
> > tv = gtk.TreeView(listmodel)
> > 
> > My problem is the second part, since I've got many queries against the
> database and changing the queries quite often. 
> > So, I want to generate the _listmodel_ dynamically. Next time, maybe the
> query could be something like (int,str,str,str,str,str,int), because I
> added two  columns.
> 
> Cursor objects have description. It's a tuple, where second element is
> typecode. You can build your ListStore using that information.

that sound great, but I'm blocked. I using cur.description to get the 
information of each column (type and header). But I don't know a way to 
generate the gtk.ListStore() dynamically.

Can you give me some code that shows the way of doing it. I tried to generate a 
basic gtk.ListStore(int) model, then appending further columns, but I could get 
it work. 

If I solve this problem, I would make a little tutorial about this, maybe 
someone has similar problems.

Thanks you,


-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to