[pygtk] How to add items to an empty ComboBox / ComboBoxEntry (created with glade) ?
Mats Taraldsvik
mats.taraldsvik at bickeringleague.net
Mon Sep 22 02:12:13 WST 2008
If I try to add an item to an empty combobox, I get an error. And it
does not work with 'combobox.get_model().append_text('text')'.
On Sun, 2008-09-21 at 19:23 +0200, Mats Taraldsvik wrote:
> On Mon, 2008-09-22 at 02:53 +1000, Neil Dugan wrote:
> > Mats Taraldsvik wrote:
> > > Dear list,
> > >
> > > I'm creating an application with pyGTK and Glade. In this I want to
> > > populate a combobox(2) depending on the selected item in another
> > > combobox(1).
> > >
> > > Usually, I add None as an item of the comboboxes in glade, because
> > > nothing happens when I try to add items to an empty combobox. However,
> > > since I have to repopulate a combobox(2), I need the proper solution,
> > > since I have to empty it depending on combobox(1).
> > >
> > > Regards,
> > > Mats Taraldsvik
> > >
> >
> > Hi,
> >
> > This is untested!
> > A 'combobox.get_model().clear()' should clear what is all ready in the
> > combobox, then a 'combobox.append_text()' should add new entries to
> > the combobox.
> >
> >
> > note: this will most likely only work with a combobox created by
> > gtk.combo_box_new_text().
> >
>
> That did solve my problem! I was trying combobox.clear()! Thank you!
>
> When I'm at it, is ComboBoxEntry a better choice than ComboBox (both are
> in Glade)? It looks like the former has more options.
>
> > Regards Neil.
> > _______________________________________________
> > pygtk mailing list pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
More information about the pygtk
mailing list