Thomi Richards <[EMAIL PROTECTED]> writes:
> however, now all the columns display the first name! I'm not sure i completely
> understand this... i associated the correct data with the correct columns in
> the "model" part of the thing....
But you also have to tell the CellRenderer which column to get the
data from. You set up the column with:
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn("First Name", renderer, text=1)
# ^^^^^^
self.eview.append_column(column)
There with 'text=1' you tell the column to get the text from column 1
of the model. (Column numbers start with 0, so the column 1 in your
model is the 'first_name'.)
So you should have 'text=0' for the first column, 'text=1' for the
next, and so on. And if you want to avoid repetitive code, you can do
something like:
column_headers=['EID', 'First Name', 'Last Name', 'Home Phone', 'Cell Phone']
for i in range(5):
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn(column_headers[i], renderer, text=i)
self.eview.append_column(column)
Instead of repeating that three lines five times.
Also, where you load the data into the ListStore, you have the line:
for i in range(4):
Don't you want range(5) instead? range(4) is [0, 1, 2, 3] so you'll
get four columns, but it seems like you want 5.
--
Abel Daniel
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/