-
Notifications
You must be signed in to change notification settings - Fork 695
Open
Description
import turtle
Set up the screen
screen = turtle.Screen()
screen.title("Python Logo")
screen.bgcolor("white")
t = turtle.Turtle()
t.speed(3)
t.width(2)
Colors for the logo
blue = "#306998"
yellow = "#FFD43B"
def draw_snake(color, start_pos, heading):
t.penup()
t.goto(start_pos)
t.pendown()
t.color(color)
t.setheading(heading)
t.begin_fill()
# Draw head
t.circle(20, 180)
# Draw body
t.forward(40)
t.circle(20, 90)
t.forward(40)
t.circle(20, 180)
t.forward(60)
t.circle(20, 90)
t.forward(20)
# Complete tail
t.circle(20, 90)
t.forward(60)
t.circle(20, 180)
t.forward(40)
t.circle(20, 90)
t.forward(20)
t.end_fill()
Draw blue snake (top)
draw_snake(blue, (0, 0), 90)
Draw yellow snake (bottom)
draw_snake(yellow, (0, 0), 270)
Eyes
def draw_eye(pos, color):
t.penup()
t.goto(pos)
t.pendown()
t.color(color)
t.begin_fill()
t.circle(3)
t.end_fill()
draw_eye((-15, 30), "white")
draw_eye((15, -30), "black")
t.hideturtle()
turtle.done()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels