Next / Previous / Contents

5.12. Cap and join styles

For pleasant and effective rendering of diagrams, sometimes it is a good idea to pay attention to cap and join styles.

  • The cap style of a line is the shape of the end of the line. Styles are:

    • tk.BUTT: The end of the line is cut off square at a line that passes through the endpoint.

    • tk.PROJECTING: The end of the line is cut off square, but the cut line projects past the endpoint a distance equal to half the line's width.

    • tk.ROUND: The end describes a semicircle centered on the endpoint.

  • The join style describes the shape where two line segments meet at an angle.

    • tk.ROUND: The join is a circle centered on the point where the adjacent line segments meet.

    • tk.BEVEL: A flat facet is drawn at an angle intermediate between the angles of the adjacent lines.

    • tk.MITER: The edges of the adjacent line segments are continued to meet at a sharp point.

This illustration shows how Tkinter's cap and join options work with a line made of two connected line segments. Small red circles show the location of the points that define this line.