[pygtk] What have I got wrong? (using glade, gtk.TreeView, and gtk.ListStore)

Michael R Head burner at suppressingfire.org
Fri Aug 19 02:25:35 WST 2005

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


class WidgetsWrapper:
        def __init__(self):
                self.widgets = gtk.glade.XML('labelator.glade',
                dic = {'gtk_main_quit': gtk.main_quit,
                           'on_quit1_activate': self.on_quit1_activate}

                table = self.widgets.get_widget('MainTable')

                liststore =

                for column in ("Column 1", "Column 2"):
                        table_column = gtk.TreeViewColumn(column)

                for row in (("Column 1/Row 1", "Column 2/Row 1"),
("Column 1/Row 2", "Column 2/Row 2")):


        def on_quit1_activate(self, event):

if __name__ == "__main__":
        widgets = WidgetsWrapper()

The glade file and (small) screenshot of my run are attached.


Michael R Head <burner at suppressingfire.org>
burner | suppressingfire | firestorm | phoenix | firefighter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-Labelator.png
Type: image/png
Size: 6627 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20050818/77bbba6d/Screenshot-Labelator.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: labelator.glade
Type: application/x-glade
Size: 2025 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20050818/77bbba6d/labelator.bin

More information about the pygtk mailing list