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 path CapStyle + JoinStyle

Posted by Giorgio O. on Oct 27, 2007

A small piece of code that allows to set the line caps and join styles. It's based on the linedash example found it the tutorial PyObjC.

from AppKit import NSBezierPath
size(400, 400)
x0,y0 = 30,100
x1,y1 = 130,100
x2,y2 = 200,140
x3,y3 = 200,50
x4,y4 = 300,50
   MiterLine JoinStyle = 0
   RoundLine JoinStyle = 1
   BevelLine JoinStyle = 2
   ButtLine CapStyle   = 0
   RoundLine CapStyle  = 1
   SquareLine CapStyle = 2
def capstyle(path, style): 
    return path
def joinstyle(path, style): 
    return path
l = BezierPath()
l.moveto(x0, y0)
l.lineto(x1, y1)
l.lineto(x2, y2)
l.lineto(x3, y3)
l.lineto(x4, y4)
capstyle(l, 1)
joinstyle(l, 2)
g = BezierPath()
g.moveto(x0, y0+150)
g.lineto(x1, y1+150)
g.lineto(x2, y2+150)
g.lineto(x3, y3+150)
g.lineto(x4, y4+150)
capstyle(g, 3)
joinstyle(g, 1)

Posted by fdb on Nov 06, 2007

They sound interesting enough to include in the next release.

I added a ticket in Trac, so you can follow up on this issue:


Kind regards,


Posted by Dimitre on Sep 06, 2011

Not sure if its Nodebox or PyObjC issue, it is not working anymore in OS X Lion, Nodebox 1.9.7rc1