[Linuxtrent] problema con treeview e formattazione dei numeri

  • From: luca <sanluca78@xxxxxxxxx>
  • To: linuxtrent <linuxtrent@xxxxxxxxxxxxx>
  • Date: Thu, 29 Dec 2005 16:51:19 +0100

ciao a tutti,
ho un problema nella visualizzazione dei numeri interi nel treeview
delle pygtk,
vi pasto un po di codice

def tree_test():
        
        
        listview=ApplicazioneGlade.get_widget("treeview2")
        listmodel = gtk.ListStore(int, str, str, float, float, float, float,
float, float, float, float, float, float)
        listview.set_model(listmodel)

        renderer = gtk.CellRendererText()
        
        i = 0
        for c in ['Id', 'Data', 'Vasca', 'Ph', 'Kh', 'Gh', 'No2', 'No3',
'Conducibilità', 'Ammoniaca', 'Ferro', 'Rame', 'Fosfati']:
                column = gtk.TreeViewColumn(c,renderer, text=i)
                i += 1
                column.set_cell_data_func()
                
                column.set_sort_column_id(i)
                column.set_clickable(True)
                column.set_resizable(True)
                listview.append_column(column)
                
        
        connessione=sqlite.connect("db")
        cursore=connessione.cursor()
        cursore.execute("select * from test")
        for y in cursore.fetchall():
                connessione=sqlite.connect("db")
                cursore=connessione.cursor()
                cursore.execute("select * from vasca")
                for a in cursore.fetchall():
                        
                        listmodel.append([y[0], y[1], a[3], y[2], y[3], y[4], 
y[5], y[6],
y[7], y[8], y[9], y[10], y[11]])

ho provato a mettere "%0.2f" %y[6] per esempio ma mi da errore.

grazie a tutti
ciao
-- 
Luca
PY-ACQUA software per l''acquariofilia (licenza GPL 2)
web - http://pyacqua.altervista.org
Email - pyacqua (at) gmail com

-- 
Per iscriversi  (o disiscriversi), basta spedire un  messaggio con OGGETTO
"subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxx


Other related posts: