I want to put 3 columns into a treeview and set their initial widths. It should be possible to change the width of the first 2 columns directly by dragging their headers. The width of the third column should adjust to fill remaining space. I demonstrate in the attached program that it is not possible to get this behavior using set_expand(). Apparently, the expand property really means what it says: the column will only expand, not contract, to fill available space.
I found that it is possible to achieve the desired behavior by setting the sizing type to TREE_VIEW_COLUMN_AUTOSIZE. The documentation says that with this sizing type "Columns resize to be the optimal size every time the model changes." Maximizing the window or changing the width of the other columns is not a change in the model, so the documentation is at least incomplete. I am, however, glad that there is a way to achieve the result that I desire. I wonder whether experts agree that setting the sizing type to TREE_VIEW_COLUMN_AUTOSIZE and leaving expand at its default value is the correct solution to my problem. I should note that with this solution, column.get_width() always returns 0 for the width of the last column, not its actual width. This behavior seems like a bug to me. I would also like to note that the method set_fixed_width and the sizing type TREE_VIEW_COLUMN_FIXED are named misleadingly as the width can, in fact, be changed. -- Jeffrey Barish
colwidth.py
Description: application/python
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
