Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing an application using Quickly. I have a Gtk.TreeView with a Gtk.ListStore as its model. The selection mode of the Gtk.SelectionMode is set to Gtk.SelectionMode.MULTIPLE.

The problem is that the Gtk.SelectionMode does not behave as it should:

  • Only one row can be selected at a time.
  • Impossible to select multiple rows using the Ctrl or Shift key.
  • Once a row is selected, it can't be deselected using the Ctrl key.
  • Nothing happens when I press the arrow keys.

The problem can be easily reproduced by creating a new Ubuntu application using Quickly (or you can download a test application below).

$ quickly create ubuntu-application test
$ cd test
$ quickly design

Create a TreeView with a ListStore as its model. Set the mode of the GtkTreeSelection to 'Multiple'. Add some columns and values to the ListStore. Add some TreeViewColumns with CellRendererTexts to the Treeview.

$ quickly run -v

Note you can't select multiple rows.

Some things I've already tried, but did not change anything:

  • Setting the selection mode in the code.




  • Moving the GtkTreeSelection <child> below the GtkTreeViewColumn <child> in the UI file.

  • Deleting the GtkTreeSelection from the UI file and setting the selection with


Am I overlooking something obvious? Or could this be a bug?

On a side note, if you set the selection to 'Single', it's also not possible to deselect the row.


If you'd like to help me out, you can download a test application here instead of creating a new project with Quickly on your own. Please note you need Quickly to run it.

$ cd test
$ quickly run

I've implemented some callbacks for testing purposes in test/test/ You can find the UI definition in test/data/ui/TestWindow.ui.

share|improve this question

I can't give a full answer, but wanted to share it. If asking a programming question, always include a minimal working example so others can quickly (ha, pun intended) run and test in your code. I will have to install Quickly, create a Quickly project and change code just to see what your question is about and try to fix it, which I won't.

That being said, here is a minimal working example which behaves correctly, so my guess is Quickly does some magic somewhere which overrides this behaviour.

from gi.repository import Gtk

class TestWindow(Gtk.Window):
    def __init__(self):
        self.resize(400, 400)
        self.connect("delete-event", Gtk.main_quit)

        ls = Gtk.ListStore(str)
        ls.append(["Testrow 1"])
        ls.append(["Testrow 2"])
        ls.append(["Testrow 3"])
        tv = Gtk.TreeView(ls)
        tr = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn("Testcolumn", tr, text=0)
        sel = tv.get_selection()


if __name__ == "__main__":
    app = TestWindow()

Note that you are using an incorrect treeselection mode in your question, the correct one is Gtk.SelectionMode.MULTIPLE.

share|improve this answer
My mistake, thanks for pointing that out. I've corrected the selection mode in the question. In my project I was using the correct one, thankfully. ;-) I'll create an example project tomorrow and upload it somewhere. Thanks for the feedback. – tectux May 9 '13 at 21:34
I've updated my question as you advised and provided an example to download. – tectux May 10 '13 at 15:02
up vote 0 down vote accepted

I found the solution to my own problem.

The 'can-focus' property of the Gtk.TreeView is set to False by default. Setting this to True fixes the strange selection behavior, as well as other strange behavior that might occur, like not being able to resize a column while its 'resizable' property is set to True.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.