Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import Turtle
- tut=Turtle()
- tut.getscreen().bgcolor('#cccccc')
- tut.speed(3)
- def draw_poly(t,x,y,sides,length,c,bg):
- t.pensize(5)
- t.penup()
- t.goto(x,y)
- t.color(c,bg)
- t.setheading(0)
- t.begin_fill()
- t.pendown()
- angle=360//sides
- for i in range(sides):
- t.forward(length)
- t.left(angle)
- t.end_fill()
- tut.hideturtle()
- draw_poly(tut,0,0,3,100,'black','red')
- draw_poly(tut,300,0,5,100,'black','yellow')
- draw_poly(tut,-300,0,7,100,'black','blue')
- draw_poly(tut,0,200,9,50,'black','white')
- draw_poly(tut,0,-200,4,50,'black','green')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement