Having looked through the source for the grid library again I discover that there are classes defined for both 'row' and 'rows' and also 'column' and 'columns'.
Therefore, why I was experiencing the error I mentioned in my previous post and why the change I made fixed it is a total mystery to me.
I'm puzzled.
Al
The "rows" and "columns" classes are simply lists of, mm, rows and columns, wrapped with some navigational sugar. Nothing to worry about. All functionality is in the "row" and "column" classes.
The error occurs because the same function refers both to a class named "column" and a variable named "column", which is not allowed. It's a typical thing in recursive code that you run out of names to label stuff.
The bug is fixed in the latest release of the Grid library.
grid flow bug
Posted by Al on Dec 04, 2008Hello everyone,
the problem will be solved.I've recently been struggling with setting the flow of the grid library to horizontal with grid.flow_horizontal(). When calling draw() I'd then get the following error message.
File "/Users/al/Library/Application Support/NodeBox/grid/__init__.py", line 883, in _traverse
UnboundLocalError: local variable 'column' referenced before assignment
After much tinkering with the code I was writing to no avail, I finally found the courage to open up the grid library file and try and track down the problem there. Fortunately, it wasn't too difficult.
If you change line 883 of file "__init__.py" in the grid library to the following:
The original code referred to the classes 'row' and 'column'. The classes are actually defined as 'rows' and 'columns'.
Kind regards,
Al