I have a few problems with the list/tree widgets.
Plese reply CC'ing me as I am not subscribed to the list.

before I forget, here is the  version info

>python
Python 2.2.2 (#1, Jan 15 2003, 01:45:57)
[GCC 3.2.1 20021207 (Red Hat Linux 8.0 3.2.1-2)] on linux2
>>> import gtk
>>> print gtk.gtk_version
(2, 2, 0)


My first problem is with creating a ListStore with
a dynamic numbers of columns.
The best thing I could come up with so far is this:

args = [gobject.TYPE_PYOBJECT] + ([gobject.TYPE_STRING] * len(titles))
model = apply( gtk.ListStore, args)

Is there a better way avoiding the use of "apply"

Second, I am trying to have different background colors for different row
using the first column of of my model to hold the actual color:

 for index in range(len(titles)):

            renderer = gtk.CellRendererText()
            column = gtk.TreeViewColumn(titles[index], renderer, text=index+1)
            column.add_attribute(renderer,"background-gdk",0)
            view.append_column(column)

the values for the rows including  the color rows are set here:

    def redraw_events(self):

        self._model.clear()
        for event in self._events:
            if event.get_type() == TYPE_REGULAR:
                fields = [self._color_normal]
            else:
                fields = [self._color_active]
            fields +=  self._viewer(event)
            iter = self._model.append()
            for i in range(len(fields)):
                self._model.set_value(iter, i, fields[i])
        return


When running the program I get a lot of warnings like:

 GLib-GObject-WARNING **: unable to set property `background-gdk' of type
`GdkColor' from value of type `PyObject'

And, of course, my color settings are ignored. How do I work around this?

Robert



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to