|FAQ Index - Search - Recent Changes - Everything - Add entry|
13.58. How do I hide the row expanders (or How do I share a model between tree and table view)?
The trick is to use one model and one view but to control the visibility of row expanders. All we have to do is to add a first dummy column (with no model column equivalent), keep it hidden all the time and switch the 'expander-column' property between this and next column (having 'expander-column' set to column that is not visible effectively hides the expanders).
Please note the user has no way how to expand/collapse the rows when the expanders are hidden - it is useful to expand all rows prior to hiding the expanders.
hide the dummy column:
treeview.get_column(0).set_property('visible', False)hide the expanders:
treeview.expand_all() treeview.set_property('expander-column', self.treeview.get_column(0))show the expanders:
treeview.set_property('expander-column', self.treeview.get_column(1))See also en.wikibooks.org/wiki/GTK+_By_Example/Tree_View/Miscellaneous