[pygtk] liststore using glade3, gtkbuilder, and the glade designer

Stephen George steve_geo at optusnet.com.au
Thu Jul 16 07:00:54 WST 2009


Hi Jon

Have you added any renderers to the treeview cell?

A snippet of my program where I had the same problem (empty lines) with 
a combo box until I added the renderer

        self.builder = gtk.Builder()
        self.builder.add_from_file('app.glade')
        self.window = self.builder.get_object('scanapp')
        self.window.set_size_request(1000, 800)
        self.builder.connect_signals(self)
        cell = gtk.CellRendererText()
        self.combobox = self.builder.get_object('ScanTypeCombo')
        self.combobox.pack_start(cell, True)
        self.combobox.add_attribute(cell, 'text', 0)

You need to tell the listview how to render the cell (it could be an 
image, or text), and I couldn't work out how to do that within Glade, so 
I did it in the initialisation code for my application.
You will need a cell renderer for each column in your treeview.
I haven't done a treeview/liststore with gtk.Builder yet.

pygtk-demo has a good example of how you program it yourself  (not using 
glade designer)

- Steve


Jon Black wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I've created a dialog using a treeview and liststore in glade designer
> which is saved to the gtkbuilder format. I am able to programatically
> access these items through gtk.Builder.
>
> However, whenever I try to add rows to the liststore, the row is added
> without any data:
>
> 	self.liststore_vocab.prepend(["test", "test", "test"])
>
> So the above row results in a clickable row that is empty rather than
> having "test" written in each column.
>
> I also tried creating the liststore myself and setting it in the
> treeview, but got the same result.
>
> Any help is appreciated.
> Jon.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkoZEGQACgkQH3browtnCkseRACggYLuLLUMhAEY3RqdDr7fir0J
> vpMAoLTgkxYL23I5LYmJWeSOLp8Ufqgx
> =lu37
> -----END PGP SIGNATURE-----
> _______________________________________________
> 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