FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 14.13 | Next Entry >>

14.13. How do I add items into GtkCombo

This code add one or many items to GtkCombo object named combo

Just add one item like this

 listitem = gtk.ListItem("String 1")
 combo.list.append_items([Listitem])
 listitem.show()
Or if you like you can add two:

 listitem_a = gtk.ListItem("String 2")
 listitem_b = gtk.ListItem("String 3")
 combo.list.append_items([listitem_a, listitem_b])
 listitem_a.show()
 listitem_b.show()

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org