Prakash's Turtle class extension

by Prakash-sa

24 Nov 2022

I wrote the helix spiral code with turtle.

def helix_spiral(self, number,color='black', x=None, y=None,speedN=2):

  self.pendown()
  self.color(color)
  self.speed(speedN)

  # program to draw the sprial helix pattern
  for i in range(number):
    self.circle(5*i)
    self.circle(-5*i)
    self.left(i)

  self.penup()
  self.hideturtle()

I made the extend the turtle class by coded the TurtleExtension class. At first time, I forgot to add turtle.Turtle in the class argument. After debuging and researching I realised my mistake and added that part.

I have taken the x coordinate, y coordinate, color, speed of the turtle and number of helix spiral from the user. I have also added the interface to provide the flexibility wheter user wants to continue the program or exit it.

Developer Find Prakash-sa on Twitter, Github, and on the web.