Class Extension Turtlehack

by nemothefish260

02 Dec 2022

Link to my Trinket https://trinket.io/python/26745c7a78

Ideation

Using class extension was particularly fun for me because it allowed me to draw beautiful colorful spirals with random variables with multiple turtles. I have been wanting to learn how to draw with loops since the beginning of the course when I tried to code a rose and a few animals ( a cat, a panda and a dog). Letting the variables do their own thing fed my craving for chaos and aesthetic pleasure.

The Lightbulbs and the Confusions I had fun with this project as I named my turtles after the Kardashian sisters. At the same time, I got to know what an attibute error is and how to resolve it. The trick was to define the values I was trying to assign to the turtles at the end of my code in the function under ‘class’ instead.

def init(self, x, y): # First, set up BoxTurtles like regular Turtles: turtle.Turtle.init(self)

I also incidentally learnt what global variable but ended up assigning ‘side = 50’ within a loop since I did not need to reuse the same.

This code was also fun because it generates everything from spirals in the shape of hexagons, squares and ‘fireworks’, depending on the values you assign and allows room for interesting experimentation.

Hi! I am an ex-iterature major who is transitioning user design and research! Find nemothefish260 on Twitter, Github, and on the web.