[pygtk] gtkbuilder and glade - pygtk's object type

Mats Taraldsvik mats.taraldsvik at bickeringleague.net
Thu Jun 25 00:09:15 WST 2009


On Wed, 2009-06-24 at 10:54 -0400, Laszlo Pandy wrote:
> Try:
> self.previewStore = gtk.ListStore( str, gobject.TYPE_PYOBJECT )
> What type are you adding to your ListStore when it gives an error?
> 

I'm sorry if I was unclear, but the code above works perfectly. However,
I'm trying to avoid writing the raw code, and do it all (that is,
creating and initializing the treeview + liststore) in Glade with
GTKBuilder instead.

I have managed to get string columns working, but not GObjects as I
don't know what to put in the treeview->hierarchy (dialog) for the
GObject.

Is this possible?



> Laszlo
> 

Mats

> On Mon, Jun 22, 2009 at 3:49 PM, Mats
> Taraldsvik<mats.taraldsvik at bickeringleague.net> wrote:
> > Hi,
> >
> > I am trying to move an app from using libglade to the new gtkbuilder.
> > However, when creating a TreeView and ListStore, I don't know how to
> > handle an object ( as in a class object ) / what data type to use.
> >
> > With libglade I did this:
> >
> >
> > self.previewStore = gtk.ListStore( str, object )
> >
> > self.previewView = self.wTree.get_widget("previewTree")
> > self.previewView.set_model(self.previewStore)
> >
> > render=gtk.CellRendererText()
> > col=gtk.TreeViewColumn("Original Name",render,text=0)
> > col.set_resizable(True)
> > self.previewView.append_column(col)
> >
> > col=gtk.TreeViewColumn()
> > col.set_visible(False)
> > self.previewView.append_column(col)
> >
> > self.previewView.show()
> >
> >
> > However, I get a "TypeError: value is of wrong type for this column"
> > when trying to add items. Works just fine if I remove the data/object
> > column.
> >
> > Regards,
> > Mats Taraldsvik
> >
> >
> > _______________________________________________
> > pygtk mailing list   pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> >



More information about the pygtk mailing list