Prints a line of characters between the specified points.
(points, character)
| 113 | |
| 114 | |
| 115 | def drawLinesBetweenPoints(points, character): |
| 116 | """Prints a line of characters between the specified points.""" |
| 117 | for i, point in enumerate(points): |
| 118 | pointA = point |
| 119 | if i == len(points) - 1: |
| 120 | # The last point draws a line to the first point: |
| 121 | pointB = points[0] |
| 122 | else: |
| 123 | # Draw the line to the next point: |
| 124 | pointB = points[i + 1] |
| 125 | # Loop over every x, y point from pointA to pointB: |
| 126 | for x, y in line(pointA[X], pointA[Y], pointB[X], pointB[Y]): |
| 127 | bext.goto(x, y) |
| 128 | print(character, end='') |
| 129 | |
| 130 | |
| 131 | def line(x1, y1, x2, y2): |