[pygtk] Looking for help with comboboxes

Neil Muller drnlmuller+gtk at gmail.com
Wed Apr 15 02:06:23 WST 2009


On Tue, Apr 14, 2009 at 6:25 PM, Gerald Britton
<gerald.britton at gmail.com> wrote:
> Thanks Neil,
>
> So, with your suggestion in place, I have the program below.  I still
> must be missing something though, since my combobox is still empty.

I'm puzzled by that. It works fine for me (with minor modifications
since I'm not running against gtk+ 2.16).  It correctly populates the
list store, and the values are available in the combobox drop-down..

The comobox doesn't have a default value though, so the initial
display will be empty. This can be fixed by adding a call to
set_active after filling the list store (c.set_active(0) for example)

> I'm wondering about your comment about linking the model to the
> renderer.

The CellRendere needs to be told which column from the model to grab
values from, This is accomplished by using the <attributes> property
in GtkBuilder or the add_attributes method.

-- 
Neil Muller
drnlmuller at gmail.com

I've got a gmail account. Why haven't I become cool?


More information about the pygtk mailing list