Hi,
You should create a 'renderer' for each column. A piece of some code
that works for me:
"""
self.liststore=gtk.ListStore(int, str)
self.treeview1.set_model(self.liststore)
renderer1 = gtk.CellRendererText()
renderer2 = gtk.CellRendererText()
column1 = gtk.TreeViewColumn("ID ", renderer1, text=0)
column1.set_resizable(True)
column2 = gtk.TreeViewColumn("Feed URL ", renderer2, text=1)
column2.set_resizable(True)
self.treeview1.append_column(column1)
self.treeview1.append_column(column2)
"""
so, a text-renderer for each column. (You can choose a
checkbox-renderer to include a checkbox in each row.)
Hope this helps you out,
Jens Geiregat
On 8/18/05, Michael R Head <[EMAIL PROTECTED]> wrote:
> I'm just starting out with pygtk, and I'm having some trouble putting
> rows into a table. Despite the fact that I am adding rows (and I can
> tell that rows are being added by the selection bar in the screenshot),
> The text in them doesn't appear. I've changed the default cell renderer
> to gtk.CellRendererText and have been able to set the background color,
> but the text of the elements in the row simply doesn't show up.
>
> I must be doing something very simple, but I can't figure out what's so
> different from the various examples of pygtk tables that I've looked at
> and run.
>
> I am using Ubuntu Hoary's packages of python (2.4.1), gtk (2.6.4) and
> pygtk (2.6.1).
>
> Here's my python source:
> ===============================================================
> #!/usr/bin/env python
>
> import gtk
> import gtk.glade
> import gobject
>
> APPNAME="Labelator"
> APPVERSION="0.1"
>
> class WidgetsWrapper:
> def __init__(self):
> """
> """
> self.widgets = gtk.glade.XML('labelator.glade',
> 'Labelator')
> dic = {'gtk_main_quit': gtk.main_quit,
> 'on_quit1_activate': self.on_quit1_activate}
> self.widgets.signal_autoconnect(dic)
>
> table = self.widgets.get_widget('MainTable')
>
> liststore =
> gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
>
> for column in ("Column 1", "Column 2"):
> table_column = gtk.TreeViewColumn(column)
> table.append_column(table_column)
>
> for row in (("Column 1/Row 1", "Column 2/Row 1"),
> ("Column 1/Row 2", "Column 2/Row 2")):
> liststore.append(row)
>
> table.set_model(liststore)
>
> def on_quit1_activate(self, event):
> gtk.main_quit()
>
> if __name__ == "__main__":
> widgets = WidgetsWrapper()
> gtk.main()
> ===============================================================
>
>
> The glade file and (small) screenshot of my run are attached.
>
> thanks,
> mike
>
> --
> Michael R Head <[EMAIL PROTECTED]>
> burner | suppressingfire | firestorm | phoenix | firefighter
>
>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
>
>
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/