Skip to content

Commit

Permalink
Merge pull request #67 from chris-greening/add-width-feature
Browse files Browse the repository at this point in the history
Add width feature
  • Loading branch information
chris-greening authored Mar 25, 2023
2 parents a225cb6 + 0bde491 commit 0b47ba6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="spyrograph",
version="0.17.1",
version="0.17.2",
author="Chris Greening",
author_email="chris@christophergreening.com",
description="Library for drawing spirographs in Python",
Expand Down
12 changes: 9 additions & 3 deletions spyrograph/_trochoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def plot(self, **kwargs) -> Tuple["matplotlib.matplotlib.Figure", "matplotlib.ax
def trace(
self, screen_size: Tuple[Number, Number] = (1000, 1000),
screen_color: str = "white", exit_on_click: bool = False,
color: str = "black", hide_turtle: bool = True,
color: str = "black", width: Number = 1, hide_turtle: bool = True,
show_circles: bool = False, frame_pause: Number = 0,
screen: "turtle.Screen" = None, circle_color: str = "black",
show_full_path: bool = False, full_path_color: str = "grey",
Expand All @@ -109,6 +109,8 @@ def trace(
Pause the final animation until the user clicks to exit the window
color: str = "black"
Color of the primary tracing
width: Number
Width of the turtle tracing
hide_turtle: bool = True
Hide the turtle icon while tracing
show_circles: bool = False
Expand Down Expand Up @@ -136,7 +138,7 @@ def trace(
screen = self._init_screen(screen, screen_size, screen_color)
turtle.tracer(False)

turtles = self._init_turtles(color, circle_color, full_path_color, hide_turtle)
turtles = self._init_turtles(color, circle_color, full_path_color, hide_turtle, width)
shape_turtle, pre_draw_turtle, rolling_circle_turtle, fixed_circle_turtle = turtles

if show_full_path:
Expand Down Expand Up @@ -344,7 +346,8 @@ def _init_screen(
return screen

def _init_turtles(
self, color: str, circle_color: str, full_path_color: str, hide_turtle: bool
self, color: str, circle_color: str, full_path_color: str,
hide_turtle: bool, width: Number
) -> Tuple["turtle.Turtle", "turtle.Turtle", "turtle.Turtle", "turtle.Turtle"]:
"""Return a shape turtle, rolling circle turtle, and fixed circle turtle"""

Expand All @@ -367,6 +370,9 @@ def _init_turtles(
fixed_circle_turtle.color(circle_color)
pre_draw_turtle.color(full_path_color)

# Set turtle width
shape_turtle.width(width)

return shape_turtle, pre_draw_turtle, rolling_circle_turtle, fixed_circle_turtle

def _trace_rolling_circle(
Expand Down

0 comments on commit 0b47ba6

Please sign in to comment.