def __init__(self, grid_size): Grid.__init__(self) # populate the grid with some stuff # self.resize(grid_size, grid_size) self.setBorderWidth(2) self.setCellPadding(4) self.setCellSpacing(1) self.setStyleName("gameboard") # just doesn't work # Set up game board # # Note that must iterate over indices, rather than Cell # instances, until the table positions are set up here # index = 0 # debug for i in range(grid_size): for j in range(grid_size): cell = HTML(SPACE) # cell.setVisible(False) # causes to ignore click events cell.position = (i, j) # might be handy at some point index+=1; cell.index = index # debug # cell.setStyleName("cell_O") cell.addClickListener(getattr(self, "onCellClicked")) self.setWidget(i, j, cell)