I want to popup a context menu when the user right-clicks on the header row of a Gtk.TreeView
. In GTK3, Gtk.TreeViewColumn
has a get_button() method, which makes this easy; simply attach the menu to the button and connect it to a 'clicked' event. However, in GTK2, this won't work. You can only call a get_widget()
method, which returns None if you haven't set a widget via set_widget()
. I've tried putting a Gtk.Label
with the column name into a Gtk.EventBox
and set that as the widget After connecting the EventBox
to a callback for the 'button_press_event', clicking on it doesn't generate the event.
I tried to do something like what's listed here but doing get_parent()
on the column widget returns None, and never reaches the button as their code implies.
What solutions have people found for this?