Home > Uncategorized > Python Project: Face

Python Project: Face


Drawing Face

In this fast python code we will draw a Face using 3 circles and one line.

We need to import a library for this called turtle, and we will use functions to help us in our mission, so let’s start.

#Python #code to #draw #face

import turtle
t=turtle.Turtle()
t.speed(9) #this will set the drawing speed to 9.

t.pencolor(“black”) #you can change the color to red, blue, or any other.

# Now we will create a functions taking circle size(s), the position (x,y) and our turtle name (t)

def d_c(t,s,x,y)
t.penup() #take pen up of the canvas.
t.goto(x,y) #goto position x,y
t.pendown()

t.circle(s) # draw the circle.

d_c(t,50,25,0) # call to draw the face
d_c(t,7,5,50) #call to draw the eye.
d_c(t,7,50,50) #call to draw second eye
t.penup()

#now we will draw the mouth
t.goto(15,20)
t.pendown()
t.goto(50,20)

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: