Geeky Projects Chapter Two
I had so much fun creating the plots on Monday, that I decided to look at the project in chapter two of the book “PYTHON PLAYGROUND: Geeky Projects for the Curious Programmer.” To my pleasure, the project involved using python’s turtle module to make spirographs. I loved drawing spirographs as a kid. I was never good at drawing, but making spirographs allowed me to feel like an artist. On top of this, I loved programming in Logo as a kid. For a few hours, I was a kid again today….
Some of my goals in doing the projects in this book (apart from fun) are: (1) getting familiar with reading code and trying to figure out what it does, because this is something I expect to do frequently; (2) getting more exposure to how others code since there is often more than one way to do something and those who are writing books (hopefully) write good code; and (3) learning how to use new libraries and functionality in whatever language I am using.
This program is a great example of object oriented programming: there is a Spiro class that draws the spirograph with a series of methods, a SpiroAnimator class that animates the spirographs with a series of methods, a function to save the drawing as a .png file using the Pillow library (I tried, unsuccessfully, to to use the pillow library to save it as a jpeg), and a function with a set of command line arguments to make run the program.
Here is one of the spirographs I saved: