def _relayout(self, widgets):
        # remove all the old widgets
        self.remove_all()

        # calculate number of rows and cols, try to maintain a square
        # TODO: take into account the window geometry
        num_widgets = len(widgets)
        rows = int(round(math.sqrt(num_widgets)))
        cols = rows
        if rows**2 < num_widgets:
            cols += 1

        self.resize_grid(rows, cols)

        # add them back in, in a grid
        for i in range(0, rows):
            for j in range(0, cols):
                index = i*cols + j
                if num_widgets < index:
                    child = widgets[index]
                    super(SymmetricGridWidget, self).add_widget(child,
                                                                i, j, stretch=1)
dataset/ETHPy150Open ejeschke/ginga/ginga/gw/Desktop.py/SymmetricGridWidget._relayout/swapped operands of `<`