简体   繁体   中英

Gtk Combobox select multiple options

I'm using Python with GTK, and I need to select more than one option in the ComboBox widget, but after searching the documentation, apparently it is not possible.

Does anyone know what I can do this?

When you don't know which widget can get the work done, give a look at the widget gallery of the GTK+ documentation . From the screenshots, GtkListBox looks like a good candidate for what you want to do, as you can have checkboxes for each item, meaning you can have multiple selection.

For anyone needing multiple selection with GTK 2 specifically, you can refer to the answer I wrote on a different post over here .

The idea is to use a TreeView and change its associated TreeSelection :

tree_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)

and it looks like this ( full MWE here ):

带有列表的用户界面,其中显示了多个选定的元素

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