1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Reference | grid()


Syntax
grid(cols, rows, colsize=1, rowsize=1)

DescriptionThe grid() command returns an iteratable object, something that can be traversed in a for-loop (like the range() command for example). The grid() is a more complex, but very powerful command. The first two parameters define the number of columns and rows in the grid. The next two parameters are optional, and set the width and height of one cell in the grid. Each iteration in a for-loop, the offset for the current column and row is returned.
Returnstuples of x/y coordinates that can be used in a for-loop


Example
fill(0.2)
for x, y in grid(7, 5, 12, 12):
    rect(10+x, 10+y, 10, 10)