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 lib : Background gradient color doesn't work

Posted by sham on Jul 11, 2009

Hi,

When I try the following code from the Grid library, I have a blank canvas. Apparently there is a problem when I want to use a gradient for the background. Have I miss something ?

grid = ximport("grid")
size(600, 600)
 
g = grid.create(2, 2, 150, 150)
g.cell(0,0).split(2, 2)
g.styles.margin = 1
g.styles.background = (
    color(0.5, 0.55, 0.6), 
    color(0.4, 0.45, 0.5)
)
g.draw()
Best Regards,

Note : tested on Leopard 10.5.7 / iMac intel


 
Posted by Josh Caswell on Jul 14, 2009

I copied and pasted your code, and it worked without a hitch. A four-cell grid, the first cell itself divided in four, and a grey gradient. I'm on 10.4.10 and PPC, but I don't know why that would make much difference. Are you running NodeBox 1.9.4 and the latest version of the Grid library?



Posted by Tom De Smedt on Jul 14, 2009

You'll need to have the Colors library installed to do gradients. If you don't have it the Grid library will fail silently when attempting to draw a gradient. I've uploaded a new version of the Grid library that will issue a warning when you don't have the Colors library.



Posted by jason on Apr 30, 2012

There is so much that goes into the color here. You really have to do your homework to get this right. I hope things will work with this in the future. TESOL