Lab 8: Drawing Polygons
shapes.poly(display, x, y, point_array, color, fill_flag) draws any shape you can list points for — triangles, stars, a rocket, whatever you can describe as a sequence of offsets from a center point. The array type moved from 'B' (unsigned bytes) on the OLED kit to 'h' (signed shorts) here, since placing a shape relative to a center means half its offsets are negative.
Sample Program Code
Filled and outlined versions of every shape, each placed by moving the same point array's anchor:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
Here's what that program draws:

Filling a Polygon the Driver Can't Fill
This driver has no poly() at all, filled or otherwise, so shapes.poly() has to build the fill itself — with a scanline fill: for every row the shape covers, find where its edges cross that row, sort the crossings, and fill between them in pairs. That's the same algorithm essentially every 2-D graphics library on earth uses, and it fits in about twenty readable lines in shapes.py.
A polygon is the one shape in this kit that can point in a direction, which is exactly why Lab 14 reaches for it to build a curved, angled eyebrow — a shape no ellipse or straight line can produce on its own.