def create_grid(self, x_hint_list, rows_to_create):
#x_hint_list is a list of ints, relating to the intended
#width of each column in the grid.
for row in range(rows_to_create):
for x_hint in x_hint_list:
grid_button = Button(text = '', valign = 'middle', shorten = True, size_hint_y = None,
height = 30, size_hint_x = x_hint, background_color = cfg_primary_neutral,
background_normal = '', color = cfg_primary_dark)
grid_button.bind(size=grid_button.setter('text_size'))
grid_button.bind(on_touch_down=self.button_press)
self.add_widget(grid_button)
self._avail += rows_to_create
评论列表
文章目录