Hi guys, I'm in the process of learning pygtk, and so far it's been great; good documentation and a well structured API have helped a lot. However, I'm having problems with the Treeview concept. I've read the tutorial at:
http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html and that's what I'm basing 90% of my attempts on. Basically, i want a list view of some data pulled from a database. It all runs fine, but what should appear as text on the screen (like people's name, phone number etc. etc.) appears as numbers.... I've been through the code several times, and I'm now completely stumped ;( I'm hoping someone here can point out a really stupid mistake I've made.. here's the code snippet: --<snip>-- #create treee views for the employees list. self.emodel = gtk.ListStore(gobject.TYPE_INT,gobject.TYPE_CHAR,gobject.TYPE_CHAR,gobject.TYPE_CHAR,gobject.TYPE_CHAR) #get data for all employeesin DB: data = self.dbi.execute('''select EID,first_name,last_name,home_phone,cell_phone from employees;''') #insert rows into list model, one line at a time: for line in data: iter = self.emodel.append() for i in range(4): self.emodel.set_value(iter,i,line[i]) #crate the view widget: self.eview = gtk.TreeView(self.emodel) #create the columns one at a time: renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("EID", renderer, text=1) self.eview.append_column(column) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("First Name", renderer, text=1) self.eview.append_column(column) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("Last Name", renderer, text=1) self.eview.append_column(column) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("Home Phone", renderer, text=1) self.eview.append_column(column) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("Cell Phone", renderer, text=1) self.eview.append_column(column) #set up some nice settings: self.eview.set_headers_clickable(gtk.TRUE) #pack this widget into it's parent window: self.scrollwindow.add(self.eview) --</snip>-- I apologise for the wrapping.... but it all runs without any errors... attached is a screenshot of what happens when i run the code: Thanks for any light you're able to throw onto this ;) -- Thomi Richards, http://once.sourceforge.net/
<<attachment: snapshot3.png>>
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
