import gtk

def reset_model(*a):
    model = gtk.ListStore(str)
    model.append(["foo"])
    model.append(["fluxx"])
    model.append(["flux capacitor"])
    completer.set_model(model)
    completer.set_text_column(0)
    entry.grab_focus()

w = gtk.Window()

completer = gtk.EntryCompletion()
completer.set_popup_completion(True)
entry = gtk.Entry()
entry.set_completion(completer)

button = gtk.Button('Set model')
button.connect('clicked', reset_model)

vbox = gtk.VBox(spacing=6)
vbox.add(button)
vbox.add(entry)

w.set_border_width(6)
w.add(vbox)
w.show_all()

reset_model()
gtk.main()
