> 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.
Cheers
Jarek Zgoda
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/