Re: freely re sizable GtkTreeView columns



On Sun, Dec 8, 2013 at 2:45 PM, Max Linke <max_linke gmx de> wrote:
I'm writing my first GTK app with pygobject. I'm struggling with the
resizing of treeview columns.  The data in one column are quite long
strings (filepaths) and I want to be able to dynamically resize the
column to something smaller then the length of the strings.

I'm creating the columns like this

        column = Gtk.TreeViewColumn('id', renderer, text=0)
        column.set_resizable(True)

But then the min column size is the length of the longest string in the
column. It would be nice if I could also resize the column to something
smaller.

The cell renderer should be or be derived from a GtkCellRendererText.
The GtkCellRendererText has an ellipsize property that you can set. If
the text isn't allowed to be ellipsized, then the minimum size of the
column is going to be the length of the longest text row.

https://developer.gnome.org/gtk3/stable/GtkCellRendererText.html#GtkCellRendererText--ellipsize

Hope you are enjoying your first GTK app :)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]