On Fri, 2005-08-05 at 14:03 +0000, Vinay Reddy wrote:
> I want to set the default width of a TreeColumnView at the start of my
> application. Although it sounds very simple, I couldn't find a
> function to do it.
> I don't want to set the max or min size (set_max_width or
> set_min_width). I also want the columns to be resizable.

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,
-- 
Pete

_______________________________________________
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