## ## random_grid.py ## ## by Kristina Striegnitz ## ## version 2/10/2010 ## ## Creates a grid of 30 rows by 30 columns. Each cell is assigned a ## random color. ## import random from grid_display import run_display def make_grid(rows, cols): # create the grid representation grid = [] for r in range(0, rows): row = [] for c in range(0, cols): row += [random.randint(0,9)] grid += [row] # display the grid cell_size = 20 run_display(grid, cell_size, on_click) def on_click(grid, row, col): """ This function need to be defined, but since we don't need it for this exercise, it is not really doing anything. """ return grid make_grid(30, 30)