As displayed, a polygon has two parts: its outline and its interior. Its geometry is specified as a series of vertices [(x0, y0), (x1, y1), … (xn, yn)], but the actual perimeter includes one more segment from (xn, yn) back to (x0, y0). In this example, there are five vertices:
To create a new polygon object on a canvas
:C
id
=C
.create_polygon (x0
,y0
,x1
,y1
, ...,option
, ... )
The constructor returns the object ID for that object. Options:
fill | You can color the interior by setting this
option to a color. The default appearance for
the interior of a polygon is transparent, and you
can set fill="" to get
this behavior. See Section 4.3, “Colors”. |
outline | Color of the outline; defaults to
outline="black" . Use
outline="" to make the
outline transparent. |
smooth | The default outline uses straight lines to
connect the vertices; use
smooth=0 to get that
behavior. If you use
smooth=1 , you get a
continuous spline curve. Moreover, if you set
smooth=1 , you can make any
segment straight by duplicating the coordinates
at each end of that segment. |
splinesteps | If the smooth option
is true, each spline is rendered as a number of
straight line segments. The
splinesteps option
specifies the number of segments used to
approximate each section of the line; the default
is splinesteps=12 . |
stipple | A bitmap indicating how the interior of the
polygon will be stippled. Default is
stipple="" , which
means a solid color. A typical value would be
stipple="gray25" . Has no
effect unless the fill has
been set to some color. See Section 4.7, “Bitmaps”. |
tags | The tags to be associated with the object, as a sequence of strings. See Section 6.1.4, “Canvas tags”. |
width | Width of the outline; defaults to 1. See Section 4.1, “Dimensions”. |