Lines
The lines module contains context managers which change how the turtle
draws lines. A context manager alters the way in which a code block is
executed.
-
class lines.dashes(spacing=20)[source]
A context manager which causes a code block to draw with dashes.
- Parameters
spacing (int) – (Optional) The length of each dash and space in pixels. Defaults to 20.
from lines import dashes
with dashes():
for side in range(4):
forward(100)
right(90)
-
class lines.dots(spacing=10)[source]
A context manager which causes a code block to draw with dots.
- Parameters
spacing (int) – (Optional) The space between each dot in pixels. Defaults to 10.
from lines import dots
with dots():
for side in range(5):
forward(100)
right(360/5)
-
class lines.rainbow(spacing=10, colors=None)[source]
A context manager which causes a code block to draw in rainbow colors.
- Parameters
spacing (int) – (Optional) The length of each color segment. Defaults to 10.
colors (list) – (Optional) A sequence of color names. By default, uses