Playing with ipythonblocks

For more on ipythonblocks see the home page at https://github.com/jiffyclub/ipythonblocks.

In [1]:
from ipythonblocks import BlockGrid
In [2]:
import math
In [3]:
w = 100
h = 100
r = 35

grid = BlockGrid(w, h, block_size=4)

for block in grid:
    val = math.fabs(math.sqrt((w / 2. - block.col) ** 2 + (h / 2. - block.row) ** 2) - r) ** 1.5 / r * 255
    block.red = val
    block.green = val
    block.blue = val

grid.show()