[pygtk] Quick qt about button press event in listviews

hvastani at vt.edu hvastani at vt.edu
Thu Aug 9 23:11:00 WST 2007


I'm having problems with listview and button press event

Ive connected button_press_event to my ListView and have set the resizable
property of my TreeViewColumn to be True
So now when I try to resize my columns, by clicking on the divider between the
columns to drag them, it generates a button press event as if I had clicked on
the first column in the first row. I dont want this behavior and was wondering
how to work around it.

Before appending my column to the list, I do: column.set_property("resizable",
True)

And this is my button press event code
on_list_button_press_event (self, widget, *args):
    event = args[0]
    if event.type == gdk.BUTTON_PRESS and event.button == 1:
        x = int(event.x)
        y = int(event.y)
        tuple = self.list.get_path_at_pos(x, y)
        if tuple is not None:
            rowpath, col, cellx, celly = tuple
            print rowpath, col.get_title()

So whenever I try to resize my column, this callback gets called and the value
of rowpath is (0,) and the title is that of the first column. This gets printed
out no matter which column I try to resize.

Any help is appreciated.


More information about the pygtk mailing list