Commit 6c80c33c authored by Joseph Insley's avatar Joseph Insley
Browse files

Upload new file

parent 60209d09
#! /usr/bin/env python
import time
red=[1.0, 0.0, 0.0]
green=[0.0, 1.0, 0.0]
blue=[0.0, 1.0, 0.0]
yellow=[1.0, 1.0, 0.0]
purple=[0.5, 0.0, 1.0]
orange=[1.0, 0.5, 0.0]
cyan=[0.0, 1.0, 1.0]
black=[0.0, 0.0, 0.0]
white=[1.0, 1.0, 1.0]
import sys, turtle
def mysquare(size, color=black, filled=True):
t.color(color)
if filled:
t.begin_fill()
for x in range(4):
t.forward(size)
t.left(90)
if filled:
t.end_fill()
def myrectangle(size1, size2, color=black, filled=True):
t.color(color)
if filled:
t.begin_fill()
for x in range(2):
t.forward(size1)
t.left(90)
t.forward(size2)
t.left(90)
if filled:
t.end_fill()
def mycircle(size, color=yellow, filled=True):
t.color(color)
if filled:
t.begin_fill()
t.circle(size)
if filled:
t.end_fill()
def mytriangle(size, color=red, filled=True):
t.color(color)
if filled:
t.begin_fill()
for x in range(3):
t.forward(size)
t.left(120)
if filled:
t.end_fill()
t=turtle.Pen()
t.up()
# Draw the face
t.goto(0, -350)
t.setheading(0)
t.down()
mycircle(350)
t.up()
# Draw the left eye
t.goto(-200, 100)
t.setheading(0)
t.down()
mysquare(100)
t.up()
# Draw the right eye
t.goto(100, 100)
t.setheading(0)
t.down()
mysquare(100)
t.up()
# Draw the nose
t.goto(-50, 0)
t.setheading(0)
t.down()
mytriangle(100)
t.up()
# Draw the mouth
t.goto(-200, -200)
t.setheading(0)
t.down()
myrectangle(400,75)
t.up()
# Feeling adventurous?
# Draw the teeth
# First the bottom row of 3
t.goto(-150, -200)
t.setheading(0)
t.down()
mytriangle(50, yellow)
t.up()
t.goto(-25, -200)
t.setheading(0)
t.down()
mytriangle(50, yellow)
t.up()
t.goto(100, -200)
t.setheading(0)
t.down()
mytriangle(50, yellow)
t.up()
# Then the top row of 2
t.goto(100, -125)
t.setheading(180)
t.down()
mytriangle(50, yellow)
t.up()
t.goto(-50, -125)
t.setheading(180)
t.down()
mytriangle(50, yellow)
t.up()
# Now move the turtle/curser out of the way
t.forward(300)
time.sleep(10)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment