How can I sort the Items in ListStore attached to a CellRendererCombo
cellrenderer_combo = gtk.CellRendererCombo()
...
liststore = gtk.ListStore(str)
item_list = ["Item1", "Item2", "Item3", "Item4", "Item5", "Item6"]
for item in item_list:
liststore.append([item])
self.cellrenderer_combo.set_property("model", self.liststore)
How can I sort the “Items” in Liststore in Descending order ???
Thanks in advance. 🙂
If the items are not going to change, then just sort them before you add them to the list store:
If the items are going to change and you want to keep them sorted in the combo box, then use a gtk.TreeModelSort: