Пример #1
0
 def load_favourites(self):
     row, column, max_h = 0, 0, 6
     for grid_config in self.get_favourites():
         grid = Grid(self, font=(grid_config[1], 12))
         grid.set(grid_config[0])
         self.grids.append(grid)
         grid.place(x=column * 40, y=row * 40, width=40, height=40)
         if row == max_h - 1:
             column += 1
             row = 0
         else:
             row += 1
     self.body.config(width=(column + 1) * 40, height=max_h * 40)
Пример #2
0
 def init_grids(self):
     w_ratio = 1 / MAX_GRID_WIDTH
     h_ratio = 1 / MAX_GRID_HEIGHT
     for i in range(MAX_GRID_WIDTH):
         column = []
         for j in range(MAX_GRID_HEIGHT):
             grid = Grid(self)
             column.append(grid)
             self.grid_cluster.append(grid)
             grid.place(relx=i * w_ratio,
                        rely=j * h_ratio,
                        relwidth=w_ratio,
                        relheight=h_ratio)
         self.grids.append(column)