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

Line feed does not work with Graph library?

Posted by Paolo on Jun 26, 2007

Hello, I have been experiencing with the graph library, and noticed that it seems to be impossible to add nodes that do hold more than one line.

For example, this simple script produces the output that is shown in picture:

size(600,700)
 
g = ximport("graph")
reload(g)
 
 
network = g.network(0, 0, 600, 700, style="deepsea")
 
id1 = "Test1\nTest4"
node1 = network.add(id1, type = network.style.randomtype())
id2 = "Test2"
node2 = network.add(id2, type = network.style.randomtype())
id3 = "Test3"
node3 = network.add(id3, type = network.style.randomtype())
 
network.connect(id1,id2)
 
network.solve()
 
for node in network.nodes:
    node.type = "light"
 
# Draw the network.
network.draw(orphans=True, core=False)
Is there any workaround for this?


 
Posted by Paolo on Jun 26, 2007

It seems that the image does not get associated with the post. Basically what happens is that the node with id "Test1\nTest4" gets completely screwed - it becomes enormously large and does not contain any text.



Posted by Tom De Smedt on Jun 27, 2007

Hi Paolo,

Please download the latest version, I've added a fix that handles \n correctly.



Posted by Paolo on Jun 29, 2007

Tom, thanks for the quick fix! Now it works like a charm ;)