How to delete PyGTK ComboBox entries?

Maël Benjamin Mettler mbm at mediamonger.ch
Mon Feb 26 10:08:56 EST 2007


Hello list!

I need to repopulate PyGTK ComboBox on a regular basis. In order to do
so I have to remove all the entries and then add the new ones. I tried
to remove all entries like that:

def clear_comboboxes(boxreference):
    try:
        while True:
            boxreference.remove_text(0)
    except:
        pass

And then repopulate by iterating through the list of desired entries and
calling ComboBox.append_text(text). It works, but is painfully
sloooooooow! Is there a faster way to completely change the entries in a
ComboBox, by using an all erase method or overwriting the container
object? I haven't found anything with google, as the searches are too
ambiguous to yield usable results.

Thanks,

Maël



More information about the Python-list mailing list