Fork me on GitHub

Cowabunga, Dude

by

09 Sep 2013

So, I really like circles. Here's my python code!

import turtle
canvas = turtle.Turtle()
palate = turtle.Screen()


turtle.pensize(5)
palate.bgcolor('white')
turtle.hideturtle()


turtle.color('purple')
turtle.circle(20)
turtle.circle(-20)
turtle.setheading(90)
turtle.circle(20)
turtle.circle(-20)


palate.bgcolor('green')
turtle.color('red')
turtle.circle(50)
turtle.circle(-50)
turtle.setheading(180)
turtle.circle(50)
turtle.circle(-50)


palate.bgcolor('lightblue')
turtle.color('white')
turtle.circle(100)
turtle.circle(-100)
turtle.setheading(90)
turtle.circle(100)
turtle.circle(-100)


turtle.done()

Screenshot: This is where a pythonian turtle should be.  The horror!

This turtle changes background color as it draws, which you can't really tell from the screen shot.

There's probably a better way to do all the repeating circles. Anyone have any ideas?

Source: Python Turtle Library Documentation

Find on Twitter, Github, and on the web.
comments powered by Disqus