njvb
njvb

Reputation: 1377

gtk tree view single click callback

I have a gtk treeview that I'm using like a list view and I want to give it a callback that activates when the user clicks (single click, not double click) a single entry in it. I know the activated callback for the treeview widget activates for double clicks, and if I have only been able to set up the gtk.gdk.event for single click on the entire treeview widget witch is not the behavior that I'm looking for. Further more the cellrenderer objects inside it don't inherit the widget class which makes it so I can't give the callback to that one in particular. Can someone please tell me how to get the callback for a single click on an item in a gtk treeview working?

P.S. Any language is fine, but I would prefer python since that's what my app is written in.

Upvotes: 1

Views: 2472

Answers (1)

Mark
Mark

Reputation: 108567

If you are using a gtk.SELECTION_SINGLE or gtk.SELECTION_MULTIPLE with your treeview, a single left-click would select the row. You can attach to this event by using the set_select_function or attaching to the changed signal.

Upvotes: 1

Related Questions