# Untitled

unknown
plain_text
2 years ago
4.7 kB
5
Indexable
Never
```#Create a creature program!

#sets canvas size and stores half of height and width as a shorter name to simplify placing the shapes
set_size(400, 400)
height = get_height() /2
width = get_width() /2

##############################

rect = Rectangle(300, 300)
rect.set_position(50,50)
rect.set_color(Color.red)

#draws the square eyes
def rect_eyes():
lreye = Rectangle(40,40)
lreye.set_position(255, 160)
lreye.set_color(Color.black)
rreye = Rectangle(40,40)
rreye.set_position(105, 160)
rreye.set_color(Color.black)

#draws the pointed mouth option
def rect_smile():
smle = Line(125, 285, 275, 285)
lsmle = Line(125, 255, 125, 285)
rsmle = Line(275, 285, 275, 255)

#############################

test = Circle(150)
test.set_position(width, height)
test.set_color(Color.red)

#draws the round eyes
def circ_eyes():
lreye = Circle(20)
lreye.set_position(width + 75, height- 20)
lreye.set_color(Color.black)
rreye = Circle(20)
rreye.set_position(width - 75, height- 20)
rreye.set_color(Color.black)

#draws the curved mouth
def circ_smile():
x = Line(width - 75, height + 75, width -37.5, height + 85)
y = Line(width + 75, height + 75, width + 37.5, height + 85)
z = Line(162.5, 285, 237.5, 285)

#############################

#this list is used to keep track of the users choices, to print out the information at the end
lst = []

lst.append("square")
lst.append("circle")
else:
q = input("That is not an option, please enter a valid option. Type to continue")

#asks user what eyes they want, and puts in their choice in lst
def eye_q():
q2 = input("What shape do you want the eyes to be? (Square or Circle) ")
q2 = q2.lower()
if q2 == "square":
lst.append("square")
elif q2 == "circle":
lst.append("circle")
else:
q = input("That is not an option, please enter a valid option. Type to continue")
eye_q()

#asks user what smile they want, and puts it in lst
def smile_q():
q3 = input("What shape do you want the smile to be? (Sharp or Round) ")
q3 = q3.lower()
if q3 == "sharp":
lst.append("sharp")
elif q3 == "round":
lst.append("round")
else:
q = input("That is not an option, please enter a valid option. Type to continue")
smile_q()

#puts together the creature using the users previous options
#uses a list to later describe the information about the creature
def put_together():
if (lst[0]) == "circle":
if (lst[0]) == "square":

if (lst[1]) == "circle":
circ_eyes()
if (lst[1]) == "square":
rect_eyes()

if (lst[2]) == "sharp":
rect_smile()
if (lst[2]) == "round":
circ_smile()

#goes through list of colors, adds one to x each time if the color is not listed. since
#there are 9 colors, if x = 10, then the input is not one of the colors and it is not a valid option, it
#then goes on to repeat the question

#Asks user their favorite color to change the name of the friend to that color.
def name_color():
COLORS = ["red", "green", "blue", "yellow", "cyan", "orange", "black", "gray", "purple"]

while(True):
col = input("Whats your favorite color? ")
col = col.lower()

if col in COLORS:
color = str("Color." + col)
break
else:
n = input("That is not an option, please enter a valid option. Type to continue")

#gets the name and prints it out using the color above.
name = input("What do you name your friend?")
txt = Text(name)
txt.set_position(40, 390)
txt.set_color(col)
txt.set_font("30pt Arial")