Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7580213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:51:38+00:00 2026-05-30T17:51:38+00:00

I have a combobox widget in python that I would like to be able

  • 0

I have a combobox widget in python that I would like to be able to choose multiple items, but I’m starting to think this is not possible. I see that it is possible on using Gtk.TreeView() by setting the mode to multiple. Is there a way to get a combobox to do this? If no, can a treeview be placed inside a combobox and if so how (short coding example, please)? I’m using GTK3, but I could probably translate it from a GTK2 example.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:51:39+00:00Added an answer on May 30, 2026 at 5:51 pm

    After much research, I think it is simply a limitation of the combobox that it can only hold one item. So, the answer is:

    Yes, a combobox can be set up to select multiple (if it has a TreeView in it)

    and, thus,

    Yes, a TreeView can be placed inside a ComboBox.

    BUT, it doesn’t behave correctly as the ComboBox acts as a container with the TreeView always visible, not just when activating the ComboBox. It can be set to select multiple useing Gtk.TreeSelection (gotten from Gtk.Treeview.get_selection()).

    Here is the code:

    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    
    from gi.repository import Gtk
    
    PEOPLE =    [
                "Frank",
                "Martha",
                "Jim Bob",
                "Francis"
                ]
    
    class TreeCombo(object):
        def __init__(self):
            self.win = Gtk.Window(title="Combo with liststore")
            self.win.connect('delete-event', Gtk.main_quit)
    
            self.store = Gtk.ListStore(str)
            for person in PEOPLE:
                self.store.append([person])
    
            # self.combo = Gtk.ComboBox.new_with_model(self.store)
            self.combo = Gtk.ComboBox()
    
            self.tree = Gtk.TreeView(self.store)
            self.selector = self.tree.get_selection()
            self.selector.set_mode(Gtk.SelectionMode.MULTIPLE)
    
            self.combo_cell_text = Gtk.CellRendererText()
    
            self.column_text = Gtk.TreeViewColumn("Text", self.combo_cell_text, text=0)
    
            self.tree.append_column(self.column_text)
    
            self.combo.add(self.tree)
    
            self.win.add(self.combo)
    
            self.win.show_all()
    
    
    
    
    def main():
        prog = TreeCombo()
        Gtk.main()
    
    if __name__ == "__main__":
        main()
    

    I’m going to mess around with hiding and showing the treeview with activation of the combobox. I’ll let you know how it goes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ComboBox that I set up like this: this.cmbCustomerJob.DisplayMember = display; this.cmbCustomerJob.AutoCompleteMode
I have comboBox component and i am adding items like comboBox1.Items.Add(Item1) . But i
I have a combobox that passes along values in text, but they can have
I have a Combobox where user can choose an icon. I'd like the dropdown
I have a combobox on my form that is bound to a generic list
I have a combobox from which i need to programmatically disable items depending on
I have: ComboBox.DataSource = System.Enum.GetValues(typeof(ImageLayout)); but how do I set the ComboBox.SelectedItem to an
i use this example as a base: http://jqueryui.com/demos/autocomplete/#combobox its cool. But if you type
I have ComboBox that takes data from another class public partial class MainWindow :
I have a combobox in my winform, and I wish change the button that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.