> I'm doing much the same thing. I have resizable columns that I set up
> like so:
> titlecolumn = gtk.TreeViewColumn('Title', cell, text=1)
> titlecolumn.set_resizable(True)
> titlecolumn.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
> authorcolumn = gtk.TreeViewColumn('Author', cell, text=2)
> authorcolumn.set_resizable(True)
> authorcolumn.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
> self.booktree.append_column(authorcolumn)
> self.booktree.append_column(titlecolumn)
>
> The important bit is set_sizing to set the sizing model. Then you can
> use set_fixed_width to give them an absolute width.
> # Set column sizes based on the allocated width of our treeview
> authorcolumn.set_fixed_width(self.booktree.allocation.width/3)
> titlecolumn.set_fixed_width(2*self.booktree.allocation.width/3)
>
> (of course there's nothing stopping you from using an absolute width, I
> just wanted to fit everything in to the given window size)
>
> Despite the name, using fixed column sizing still allows you to resize
> columns if set_resizable is called.
>
> Hope that helps,
> --
Thanks a lot. It works like a charm.
I was misled by the name TREE_VIEW_COLUMN_FIXED. The statement
"Columns are a fixed numbers of pixels wide" (in pyGTK reference
manual) seemed to indicate that columns would not be resizable if this
flag was set.
Cheers,
Vinay
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/