Hi, [EMAIL PROTECTED] schrieb am 03/16/2007 09:19 AM: >> for a small filemanager I would like to set the width of the columns >> according to the window size. I have five columns, displaying an >> icon, the filename, size, mode and date. I want to set a fixed size >> for the icon and the last three columns; these columns should be >> visible in the set size at the right end of the treeview (obviously >> the icon a the left side); just like the midnight commander is doing >> it. The sizing should adjust as soon as I enlarge the window. > Maybe it's not exactly what you want, but I have nice working solution for > this. Instead of setting fixed size for 1st, 3rd, 4th and 5th columns, you > can just set their sizing mode to gtk.TREE_VIEW_COLUMN_AUTOSIZE. And to be > sure that they don't take more space than needed, set expand to False. This > way you don't have to compute columns' widths by yourself, and all column > content - including column name in the header - is visible (not cropped). For > the 2nd column to take up remaining space, you set its sizing mode to > gtk.TREE_VIEW_COLUMN_FIXED and expand to True. > As an example below is code for setting up columns for three column treeview. > First resizes itself to maximum (as your 2nd column is supposed to). Second > and third just take as much space as necessary, and nothing more. > > nameColumn = gtk.TreeViewColumn(u'Name', gtk.CellRendererText(), text=0) > -> nameColumn.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) > -> nameColumn.set_expand(True) > nameColumn.set_sort_column_id(0) > self._wnd.append_column(nameColumn) > > cell = gtk.CellRendererText() > cell.set_property(u'xalign', 1.0) > sizeColumn = gtk.TreeViewColumn(u'Size', cell, text=1) > -> sizeColumn.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) > -> sizeColumn.set_expand(False) > sizeColumn.set_alignment(1.0) > sizeColumn.set_sort_column_id(1) > self._wnd.append_column(sizeColumn) > > cell = gtk.CellRendererText() > cell.set_property(u'xalign', 1.0) > copiedColumn = gtk.TreeViewColumn(u'Copied', cell, text=2) > -> copiedColumn.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) > -> copiedColumn.set_expand(False) > copiedColumn.set_alignment(1.0) > copiedColumn.set_sort_column_id(2) > self._wnd.append_column(copiedColumn)
Somehow it does not work like wanted ... I will try it a bit more. Thanks for your help! Greetings! Fabian _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
