Options

The line item supports the following options, via the create_line method, and the itemconfig and itemcget configuration methods.

Table 16-1. Canvas Line Options

Option

Type

Description

width

distance

The width of the line. Default is 1 pixel.

fill

color

The color to use for the line. Default is "black".

stipple

bitmap

The name of a bitmap which is used as a stipple brush when drawing the line. Typical values are "gray12", "gray25", "gray50", or "gray75". Default is a solid brush (no bitmap).

arrow

constant

If set to a value other than NONE, the line is drawn as an arrow. The option value defines where to draw the arrow head: FIRST, LAST, or BOTH. Default is NONE.

The FIRST and LAST constants are not defined in Python 1.5.2 and earlier. For compatibility, use the strings "first" and "last" instead.

arrowshape

3-tuple

Controls the shape of the arrow. Default is (8, 10, 3).

capstyle

constant

For wide lines, this option controls how to draw the line ends. Use one of BUTT, PROJECTING, ROUND. Default is BUTT.

These constants are not defined in Python 1.5.2 and earlier. For compatibility, use the strings "butt", "projecting", and "round" instead.

joinstyle

const

For wide lines, this option controls how to draw the joins between edges. Use one of BEVEL, MITER, or ROUND. Default is ROUND.

These constants are not defined in Python 1.5.2 and earlier. For compatibility, use the strings "bevel", "miter", and "round" instead.

smooth

flag

If non-zero, the given coordinates are interpreted as b-spline vertices.

splinesteps

int

The number of steps to use when smoothing this line. Default is 12.

tags

tags

One or more tags to associate with this item. If only a single tag is to be used, you can use a single string instead of a tuple of strings.