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

grid library and grid()

Posted by Alexey on Jul 31, 2009

Can I somehow use simple grid() function while using grid library for layout somehow?
thanks in advance


 
Posted by Josh Caswell on Jul 31, 2009

Just assign the grid library to a different name; instead of the usual:

grid = ximport("grid")
you can do:
gridlib = ximport("grid")



Posted by Alexey Golev on Jul 31, 2009

naah...doesn't help...
here's the code

try: 
    gridlib = ximport("grid")
except:
    gridlib = ximport("__init__")
    reload(gridlib)
 
size(500, 500)
background(0.1, 0, 0.1)
 
g = gridlib.create(5, 5, WIDTH-10, HEIGHT-10)
 
for x,y in grid(3,5,10,10):
    oval(x,y,10,10)
Thanks anyway... further suggestions?



Posted by Josh Caswell on Aug 01, 2009

Well, you can save the grid function before you do the import:

gridfunc = grid
gridlib = ximport("grid")
 
g = gridlib.create(5, 5, WIDTH-10, HEIGHT-10)
 
for x, y in gridfunc(3, 5, 10, 10):
    oval(x, y, 10, 10)



Posted by Alexey on Aug 05, 2009

Thanks a lot! It works