creation d'un combobox avec un liststore
Bonjour,
J'arrive à créer un combobox de la façon suivante :
Code:
1 2 3
| self.simulation_combobox = gtk.combo_box_new_text()
for s in self.simulations:
self.simulation_combobox.append_text(s) |
Cela marche parfaitement.
J'arrive à créer un comboboxentry :
Code:
1 2 3 4
| liststore = gtk.ListStore(str)
for s in self.simulations:
liststore.append([s])
self.simulation_combobox = gtk.ComboBoxEntry(liststore,0) |
Cela marche aussi.
Mais par contre, un combobox avec un liststore ne m'affiche aucun choix:
Code:
1 2 3 4
| liststore = gtk.ListStore(str)
for s in self.simulations:
liststore.append([s])
self.simulation_combobox = gtk.ComboBox(liststore) |
Ou y a t'il un problème ?
En fait, je ne saurais l'expliquer, mais le fait de rajouter un cellrendertext résous le pb:
Code:
1 2 3 4 5 6 7
| liststore = gtk.ListStore(str)
for s in self.simulations:
liststore.append([s])
self.simulation_combobox = gtk.ComboBox(liststore)
cell = gtk.CellRendererText()
self.simulation_combobox.pack_start(cell, True)
self.simulation_combobox.add_attribute(cell, 'text', 0) |
Alors, pourquoi un comportement different avec le ComboBoxEntry ?
Merci