简体   繁体   中英

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 ?

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM