Monday, August 01, 2016

Thinking Through Ideas With Python Turtle

I like that you can program a screen turtle very easily with a straightforward Python installation and no additional setup. I was playing with it on a plane ride and went through a progression of ideas that I figure might be nice for people to see, along with the code. Using the screen turtle is a good way to move from Logo environments like Turtle Art to more challenging text-based coding with Python.

Starting With an Iterated Shape

I learned the basics of how to program the screen turtle in Python from this blog post. From there I went to coding many shapes (flowers) randomly distributed to make a garden.

Here is the source code.

Columns and Rows

I decided I wanted a more orderly display of shapes, and after tinkering started thinking of Islamic tile mosaics and gradually came up with this.

Uniform Grid

From there I moved on to thinking of streets, grids, and light posts. There was not much to change but changing the base shape from 8 sides to 4, and to add a dot on a second pass over the grid.

Off Kilter Grid

Finally, I felt like throwing the balance of the perfect grid off a bit by turning the turtle a slight random heading at the beginning of each section of the grid.
Enough thinking for one plane ride...

No comments :