简体   繁体   中英

Python + GTK: How to set a selected row on gtk.treeview

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?

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

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