Path Properties¶
-
strokeWidth
(value)¶ Sets stroke width.
# set no fill fill(None) # set black as the stroke color stroke(0) # loop over a range of 10 for i in range(20): # in each loop set the stroke width strokeWidth(i) # draw a line line((100, 100), (200, 900)) # and translate the canvas translate(30, 0)
-
miterLimit
(value)¶ Set a miter limit. Used on corner points.
# create a path path = BezierPath() # move to a point path.moveTo((100, 100)) # line to a point path.lineTo((150, 700)) path.lineTo((300, 100)) # set stroke color to black stroke(0) # set no fill fill(None) # set the width of the stroke strokeWidth(50) # draw the path drawPath(path) # move the canvas translate(500, 0) # set a miter limit miterLimit(5) # draw the same path again drawPath(path)
-
lineJoin
(value)¶ Set a line join.
Possible values are miter, round and bevel.
# set the stroke color to black stroke(0) # set no fill fill(None) # set a stroke width strokeWidth(30) # set a miter limit miterLimit(30) # create a bezier path path = BezierPath() # move to a point path.moveTo((100, 100)) # line to a point path.lineTo((100, 600)) path.lineTo((160, 100)) # set a line join style lineJoin("miter") # draw the path drawPath(path) # translate the canvas translate(300, 0) # set a line join style lineJoin("round") # draw the path drawPath(path) # translate the canvas translate(300, 0) # set a line join style lineJoin("bevel") # draw the path drawPath(path)
-
lineCap
(value)¶ Set a line cap.
Possible values are butt, square and round.
# set stroke color to black stroke(0) # set a strok width strokeWidth(50) # translate the canvas translate(150, 50) # set a line cap style lineCap("butt") # draw a line line((0, 200), (0, 800)) # translate the canvas translate(300, 0) # set a line cap style lineCap("square") # draw a line line((0, 200), (0, 800)) # translate the canvase translate(300, 0) # set a line cap style lineCap("round") # draw a line line((0, 200), (0, 800))
-
lineDash
(*value)¶ Set a line dash with any given amount of lenghts. Uneven lenghts will have a visible stroke, even lenghts will be invisible.
# set stroke color to black stroke(0) # set a strok width strokeWidth(50) # translate the canvas translate(150, 50) # set a line dash lineDash(2, 2) # draw a line line((0, 200), (0, 800)) # translate the canvas translate(300, 0) # set a line dash lineDash(2, 10, 5, 5) # draw a line line((0, 200), (0, 800)) # translate the canvase translate(300, 0) # reset the line dash lineDash(None) # draw a line line((0, 200), (0, 800))