[pygtk] On gtk.TreeView expanders and more
Klaus Müller
tloeffler3 at googlemail.com
Sat Aug 27 21:55:20 WST 2011
Hey, I've got a couple of questions all somehow related to gtk.TreeViews.
1. I'm looking for a way to replace the expander icon in a gtk.TreeView.
I've spent countless hours searching stackoverflow, the mailing list,
the pygtk docs, pydoc and simple trial-and-error without any success.
The only slightly relevant thing I found was FAQ entry (13.14) where a
CellRendererPixbuf is added to a gtk.TreeViewColumn and its
"pixbuf-expander-closed" property is set accordingly. This however just
adds an image next to the expander which changes based on the state of
the exander. I'm looking for a way to replace the expander itself.
2. On a related note, how would I go about changing the color of grid
lines in a treeview? I'd like to change this programatically, not with a
new entry in my gtrc file since I'd like it theme-independent.
3. Lastly, is there a way to change the effective area of a row in a
treeview? To elaborate on this question, I have a treeview with a single
column where I show a filesystem hierarchy based on a gtk.TreeStore. I
changed the colors of the treeview with a subclassed
gtk.GenericCellRenderer so that selected rows aren't highlighted
completely, but rather just the text in the currently selected row has a
colored background.
Naturally, however, the default behaviour of the CellRenderer is still
intact which means a row is selected when I click anywhere in the row,
not just on the text. I'd like to change the area which reacts to
mouseclicks to the area of the text in the row. I thought about using
the "clicked" signal of the treeviewcolumn to determine the position of
the click and do some geometric checks whether the click position was
atop a row in the treeview, but the information doesn't seem to be
passed on.
I'm really struggling with these things. They seem to be somewhat
straight-forward changes (except for the last one maybe), but I can't
for the life of me find a solution.
Help is really appreciated.
Cheers, Klaus
More information about the pygtk
mailing list