def METHOD_NAME(self):
    grid = QGridLayout()
    grid.setVerticalSpacing(2)
    grid.setHorizontalSpacing(1)
    grid.setContentsMargins(0, 4, 0, 0)
    rows = 6
    cols = (max_chars + rows - 1) // rows
    grid.addWidget(self.refresh_button, 0, cols + 1)
    for n, button in enumerate(self.page_buttons):
        grid.addWidget(button, n + 1, cols + 1)
    for n, button in enumerate(self.char_buttons):
        grid.addWidget(button, n // cols, n % cols)
    grid.setColumnMinimumWidth(cols, app_state.app.dpi / 12)
    return grid