Polygon objects are created using the following functions. Polygons are drawn by specifying their corners using two parallel lists of x and y coordinates.
|Polygon(xPoints, yPoints)||Creates a Polygon with corners specified by the xPoints and yPoints lists. The two lists are parallel, i.e., the first items correspond to the first polygon corner (x1, y1), the next items to the second corner (x2, y2), and so on.|
|Polygon(xPoints, yPoints, color, fill, thickness)||Creates a Polygon with corners specified by the xPoints and yPoints lists, color (e.g. Color.BLACK (default), Color.ORANGE or Color(255, 0, 255), using specific RGB values), fill (boolean – default is False), and thickness (default is 1 (pixel)).|
Once a Polygon has been created, it may be added to a Display specifying where to place its top-left corner point.
poly1 = Polygon([312, 366, 510, 443], [244, 210, 312, 346])