Hello,

Prash wrote:
What signal is emitted when a user clicks on a row? I've tried a few
like row_activated but it emits a signal only when "return" is
pressed.

If you mean "double click on a row", try 'row-activated'. If you really want to catch basic mouse clicks, try 'button-pressed-event'. You can then determine the position from the event:

x = int(event.x)
y = int(event.y)

Of course you usually want to know where you clicked, so you use something along the lines given here:


try:
    path, col, cellx, celly = widget.get_path_at_pos(x, y)
except TypeError:
    # blank region selected (no row)
    pass
else:
    # example what to do if user clicked on a valid cell:
    # If user clicked on a row, then select it.
    selection = widget.get_selection()
    if selection.count_selected_rows() == 0:
        widget.grab_focus()
        widget.set_cursor( path, col, 0)


I think this code snippet has been taken from an example on popup menus in the FAQ.

Another problem is I'm using a button called "Expand" to expand
everything using treeview.expand_all() but it shows the expanded tree
only if I use alt+tab back and forth terminal and GUI - it appears
there is some refresh problem. Any ideas?

I remember me asking a similar question and I think this problem was solved in some gtk release. What gtk+ version are you using? If you don't want to update your gtk+, you can issue a redraw. I am not 100% sure, but I think you use widget.queue_draw() for this.

Niklas.
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to