Archive

Archive for November 25, 2018

Python Project: Face

November 25, 2018 Leave a comment

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