Search code examples
pythongtkpygtk

How do I disable edition of a PyGtk Combobox?


I want the user to be able to select the items on a PyGTK ComboBox, while not being able to write in the combo. He/She should be allowed just to select one of the items. So I can't use set_active(False), for it will disable the combo.

How can I do this ?


Solution

  • GTK+ 2 has a type GtkComboBoxEntry that always has the entry box you don't want (and handles some model-related things). Your Glade file uses a GtkComboBoxEntry. Change it to GtkComboBox and, assuming everything else is set up properly (your model is correct and you have a GtkCellRendererText), you should be good to go.

    (Thanks to gregier in irc.gimp.net/#gtk+ for some information.)