def _update_param_grid_rows(self, grid: Gtk.Grid,
                             params: Dict[str, pyspiel.GameParameter]):
   actual_grid_rows = num_grid_rows(grid)
   expected_num_rows = len(params)
   if expected_num_rows == actual_grid_rows:
     pass
   elif expected_num_rows < actual_grid_rows:
     # Remove
     for i in range(expected_num_rows, actual_grid_rows):
       label = grid.get_child_at(left=0, top=i)
       tv = grid.get_child_at(left=1, top=i)
       grid.remove(label)
       grid.remove(tv)
   else:
     # Add
     num_row_additions = expected_num_rows - actual_grid_rows
     for _ in range(num_row_additions):
       tv = make_row_entry(grid, "", lambda: Gtk.TextView(monospace=True))
       tv.connect("key-press-event", self._on_param_change)
示例#2
0
 def grid_remove_all (grid: Gtk.Grid) -> None:
     for child in grid.get_children ():
         grid.remove (child)
示例#3
0
 def grid_remove_all(grid: Gtk.Grid) -> None:
     for child in grid.get_children():
         grid.remove(child)