I'm trying to do a keyboard command. When I insert S+some_number+Return I need call a function that will see this number on a column on Gtk.Treeview
and set that row has selected. How can I do that?
Asked
Active
Viewed 7,234 times
13

gpoo
- 8,408
- 3
- 38
- 53

Irish Wolf
- 211
- 2
- 13
-
2can you connect a `key-press-event` to the treeview and use the connected function to build up a search-string until you recieve a Return? Then `ts = treeveiw.get_selection()` should give you a selection-object for the treeview and `ts.select_path(path)`, where path is a proper path according to the input and the structure of your tree-model, should mark the right stuff. I'm not sure though and since I don't have code to test it on... – deinonychusaur Mar 30 '12 at 16:30
-
1Great... should have written it as an answer then.. – deinonychusaur Apr 02 '12 at 21:20
1 Answers
12
<treeview>.set_cursor(0) # for your value of `path` 0
is this what you want? I think treeview will also grab focus.
If you wanted to add given row to selection set rather than clear old selection and set only one row selected, you gotta play with Gtk.TreeSelection
that you get via .get_selection()
method.

gpoo
- 8,408
- 3
- 38
- 53

Dima Tisnek
- 11,241
- 4
- 68
- 120