Skip to content

Instantly share code, notes, and snippets.

@akiross
Created June 2, 2015 23:15
Show Gist options
  • Save akiross/1584110cce7c4210f4ae to your computer and use it in GitHub Desktop.
Save akiross/1584110cce7c4210f4ae to your computer and use it in GitHub Desktop.
Drawing the yin-yang with Python3 turtle.
from turtle import *
RAD = 100
RAD2 = RAD / 2
RAD6 = RAD / 6
degrees() # Switch to degrees
# Draw the circle, radius 100, half black
fillcolor('black')
begin_fill()
circle(RAD, 180)
end_fill()
circle(RAD, 180)
# Draw smaller black semi-circle
left(180)
penup()
goto(0, RAD)
pendown()
begin_fill()
circle(RAD2, 180)
end_fill()
# Draw smaller white semi-circle
penup()
goto(0, RAD)
pendown()
fillcolor('white')
begin_fill()
circle(RAD2, 180)
end_fill()
# Draw smaller circles
penup()
goto(0, RAD2 + RAD6)
begin_fill()
circle(RAD6)
end_fill()
fillcolor('black')
goto(0, 2 * (RAD - RAD6))
begin_fill()
circle(RAD6)
end_fill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment