Custom Search

PYTHON: A Turtle Graphics Project

A Snowman

(December 2022)

import turtle
count=0
#set up screen
screen=turtle.Screen(500,500)
screen.bgcolor("#123456")
# set the screen background
screen.bgpic("snow.png")
#add graphics for cursor
screen.addshape("fairySihouettewhite.png")#add the cursor
fairy = turtle.Turtle("fairySihouettewhite.png")
fairy.color("dark green")
fairy.shape("fairySihouettewhite.png")
fairy.fillcolor("dark green")
fairy.width(4)
#draw tree
fairy.up()
fairy.goto(0,-100)
fairy.down()
fairy.begin_fill()
fairy.circle(200,50)
fairy.rt(200)
fairy.circle(-170,40)
fairy.rt(140)
fairy.circle(130,40)
fairy.rt(220)
fairy.circle(-110,40)
fairy.rt(120)
fairy.circle(130,30)
fairy.rt(250)
fairy.circle(-60,49)
fairy.up()
fairy.goto(0,-100)
fairy.lt(38)
fairy.down()
fairy.circle(-200,50)
fairy.lt(200)
fairy.circle(170,40)
fairy.lt(140)
fairy.circle(-130,40)
fairy.lt(220)
fairy.circle(110,40)
fairy.lt(120)
fairy.circle(-130,30)
fairy.lt(250)
fairy.circle(60,52)
fairy.end_fill()
#draw star
fairy.width(1)
fairy.lt(30)
fairy.color("white")
fairy.begin_fill()
while count<5:
fairy.forward(35)
fairy.rt(216)
count=count+1
else:count=0
fairy.end_fill()
#draw stalk
fairy.width(3)
fairy.up()
fairy.goto(-5,-100)
fairy.down()
fairy.color("#663300")
fairy.fillcolor("#663300")
fairy.rt(70)#face east
fairy.begin_fill()
fairy.forward(20)
fairy.rt(90)
fairy.forward(40)
fairy.rt(90)
fairy.forward(20)
fairy.rt(90)
fairy.forward(40)
fairy.rt(90)
fairy.end_fill()
fairy.up()
#chains
x=-28
y=67
while count<3:
fairy.width(6)
fairy.goto(x-18,y-5)
fairy.color("red")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x-11,y-7)
fairy.color("yellow")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x-4,y-9)
fairy.color("blue")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+3,y-9)
fairy.color("magenta")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+10,y-9)
fairy.color("cyan")
fairy.down()
fairy.up()
fairy.goto(x+10,y-7)
fairy.color("lime")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+18,y-5)
fairy.color("#ccccff")
fairy.down()
fairy.circle(2,360)
fairy.up()
count=count+1
x = x+32
else:
count = 0
x=-60
y=7
while count<3:
fairy.width(6)
fairy.goto(x-18,y-5)
fairy.color("red")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x-10,y-8)
fairy.color("yellow")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x-2,y-11)
fairy.color("blue")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+6,y-11)
fairy.color("magenta")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+14,y-11)
fairy.color("cyan")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+22,y-8)
fairy.color("lime")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+30,y-5)
fairy.color("#ccccff")
fairy.down()
fairy.circle(2,360)
fairy.up()
count=count+1
x = x+53
else:
count = 0
x=-112
y=-50
while count<4:
fairy.width(8)
fairy.goto(x-18,y-5)
fairy.color("red")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x-8,y-9)
fairy.color("yellow")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+2,y-13)
fairy.color("blue")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+12,y-13)
fairy.color("magenta")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+22,y-13)
fairy.color("cyan")
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.color("lime")
fairy.goto(x+32,y-9)
fairy.down()
fairy.circle(2,360)
fairy.up()
fairy.goto(x+42,y-5)
fairy.color("#ccccff")
fairy.down()
fairy.circle(2,360)
fairy.up()
count=count+1
x = x+64
else:
count = 0
fairy.goto(-170,-150)
fairy.lt(810)
#Greeting
screen.addshape("MerryXmas.png")#add text message
text = turtle.Turtle("MerryXmas.png")
text.shape("MerryXmas.png")
text.up()
text.rt(630)
text.forward(156)