Re: [PyGObject] Gtk.TreeView: compute max rows in visible area



I am not absolute sure but I think I got the solution.

Here is the code snipped

def MyTreeView(Gtk.TreeView):
    ...
    def compute_rows_per_page(self):
        # height of first cell
        col = self.get_column(0)
        rect = col.cell_get_size()
        renderer = col.get_cells()[0] 
        ypadding = renderer.get_padding()[1]
        height_row = rect.height + ypadding

        # height of treeview
        height_view = self.get_visible_rect().height

        # result
        print('{} / {} = {}'
              .format(height_view, height_row, (height_view/height_row)))


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