Search code examples
pythonpython-3.xtreeviewgtkgtk3

GTK3 - Python Treeview Fixed Height Mode Property Problem


I have a GTK3 GUI called by using Python 3. There is a treeview on the GUI and I add a large data to the treeview. To be able to increase the performance, I changed fixed-height-mode property to True but it gives the following output:

(test.py:6423): Gtk-CRITICAL **: 09:49:48.375: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

(test.py:6423): Gtk-CRITICAL **: 09:49:48.375: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

(test.py:6423): Gtk-CRITICAL **: 09:49:48.375: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

(test.py:6423): Gtk-CRITICAL **: 09:49:48.376: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

(test.py:6423): Gtk-CRITICAL **: 09:49:48.376: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

(test.py:6423): Gtk-CRITICAL **: 09:49:48.377: gtk_tree_view_insert_column: assertion 'gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED' failed

What is the solution to fix this problem?

Note: I am using treeview with treestore to add the data. set_headers_clickable, set_headers_visible, set_search_column are also used.

Here is the information about fixed_height_mode (GTK2, but GTK3 also suports this feature. There is an option for it on Glade Designer interface.).


Solution

  • Try this:

    This inserts the column into the self at position. If position is -1, then the column is inserted at the end. If self has “fixed_height” mode enabled, then column must have its “sizing” property set to be Gtk.TreeViewColumnSizing.FIXED.

    This is from treeview.insert_column

    BTW, I strongly recommend using up-to-date documentation for your version of toolkit. Use GTK2 tutorials just to get an overview, but switch to GTK3 docs ASAP.