[pygtk] gobject.Warnings with GtkTreeModelFilter
BJörn Lindqvist
bjourne at gmail.com
Wed Sep 10 22:39:48 WST 2008
2008/9/7 Darren Hart <darren at dvhart.com>:
> I've been running into this problem trying to eliminate an apparently harmless
> Warning message from my application. It appears in a number of locations:
>
> gui_datastores.py:66: Warning: unable to set property `text' of type
> `gchararray' from value of type `PyObject'
> braindump.py:259: Warning: unable to set property `text' of type
> `gchararray' from value of type `PyObject'
>
> gui_datastores.py:66 is running "f.refilter()" on a GtkTreeModelFilter
> braindump.py:259 is running the ever so explicit "gtk.main()" :-(
>
> I've loaded the app in the python debugger and set breakpoints at these lines
> and have stepped through, but I never end up in the gtk or gobject code, so the
> error has gone and went by the time I notice it. Two questions:
>
> 1) Does anyone know offhand why these errors occur?
> 2) How can I determine what the PyObject is that the Warnings refer to?
It's almost impossible to know for sure without seeing the source. I'm
guessing that you have a gtk.TreeModel in which you have a column
whose column type is a PyObject other than str or int and that you are
trying to display that column with a gtk.CellRendererText so the
conversion to a printable string fails. E.g:
store = gtk.ListStore(object)
store.append(['hi'])
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn("c1", gtk.CellRendererText(), text = 0)
view = gtk.TreeView(store)
view.append_column(col)
view.show_all()
win = gtk.Window()
win.add(view)
win.show_all()
--
mvh Björn
More information about the pygtk
mailing list