[pygtk] Looking for help with comboboxes
Gerald Britton
gerald.britton at gmail.com
Wed Apr 15 02:34:20 WST 2009
Ok I think I found it. The thing that made it work for me is changing:
<child>
<object class="GtkCellRendererText" id="cellrenderertext1" />
<attributes>
<attribute name="text">0</attribute>
</attributes>
to:
<child>
<object class="GtkCellRendererText" id="text" />
<attributes>
<attribute name="text">0</attribute>
</attributes>
Is it true that the id="text" in the object must correspond to the
name="text" in the attribute?
On Tue, Apr 14, 2009 at 2:06 PM, Neil Muller <drnlmuller+gtk at gmail.com> wrote:
> 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?
>
--
Gerald Britton
More information about the pygtk
mailing list