全部博文(343)
分类: Python/Ruby
2011-02-17 01:34:06
store = gtk.ListStore(gobject.TYPE_STRING) store.append (["testing1"]) store.append (["testing2"]) store.append (["testing3"]) store.append (["testing4"])For a ComboBoxEntry, it's then a matter of assigning the model to the combo and specifying the text column:
combo = tree.get_widget("comboboxentry1")
combo.set_model(store)
combo.set_text_column(0)
For a ComboBox, pack a renderer into it, specifying the text cell: combo = tree.get_widget("combobox1")
combo.set_model(store)
cell = gtk.CellRendererText()
combo.pack_start(cell, True)
combo.add_attribute(cell, 'text',0)