Commit 47d5500f authored by John Domyancich's avatar John Domyancich
Browse files

Upload new file

parent e91fad04
#! /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.right(90)
t.forward(350)
t.left(90)
t.down()
mycircle(350)
t.up()
# Draw the left eye
t.left(90)
t.forward(450)
t.left(90)
t.forward(200)
t.right(180)
t.down()
mysquare(100)
t.up()
# Draw the right eye
# Move to the correct position
# (HINT: there is one blank line for each turn/move required)
t.down()
mysquare(100)
t.up()
draw_nose=False
# Draw the nose
# Move to the correct position
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_nose):
t.down()
mytriangle(100)
t.up()
draw_mouth=False
# Draw the mouth
# Move to the correct position
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_mouth):
t.down()
myrectangle(400,75)
t.up()
# Feeling adventurous?
# Draw the teeth
# First the bottom row of 3
draw_bottom_tooth_l=False
# Left tooth
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_bottom_tooth_l):
t.down()
mytriangle(50, yellow)
t.up()
draw_bottom_tooth_c=False
# Center tooth
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_bottom_tooth_c):
t.down()
mytriangle(50, yellow)
t.up()
draw_bottom_tooth_r=False
# Right tooth
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_bottom_tooth_c):
t.down()
mytriangle(50, yellow)
t.up()
# Then the top row of 2
draw_top_tooth_r=False
# Right tooth
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_top_tooth_r):
t.down()
mytriangle(50, yellow)
t.up()
draw_top_tooth_l=False
# Left tooth
# (HINT: there is one blank line for each turn/move required)
# Dont for get to indent.
if (draw_top_tooth_l):
t.down()
mytriangle(50, yellow)
t.up()
# Now move the turtle/curser out of the way
t.forward(800)
# Save the image as a postscript file
ts=turtle.getscreen()
ts.getcanvas().postscript(file='my_name.eps')
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