from gi.repository import Gtk, GLib

class ComboBoxWindow(Gtk.Window):

    def __init__(self):
        Gtk.Window.__init__(self, title="ComboBox Example")

        self.set_border_width(10)

        name_store = Gtk.ListStore(int, str, int)
        name_store.append([1, "Billy Bob", 0])
        name_store.append([11, "Billy Bob Junior", 0])
        name_store.append([12, "Sue Bob", 0])
        name_store.append([18, "SEPARATOR", 1])
        name_store.append([2, "Joey Jojo", 0])
        name_store.append([3, "Rob McRoberts", 0])
        name_store.append([31, "Xavier McRoberts", 0])

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)

        name_combo = Gtk.ComboBox.new_with_model_and_entry(name_store)

        def func(model, iter_):
            return model.get_value(iter_, 2)

        name_combo.set_row_separator_func(func)
        name_combo.set_entry_text_column(1)
        vbox.pack_start(name_combo, False, False, 0)
        self.add(vbox)

win = ComboBoxWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
GLib.unix_signal_add(0, 2, Gtk.main_quit)
Gtk.main()
