Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import Turtle
- luna = Turtle()
- def draw_circle(t_name, r, col, Xdir, Ydir):
- t_name.penup()
- t_name.goto(Xdir, Ydir)
- t_name.color(col)
- t_name.dot(r*2)
- def draw_rectangle(t_name, col, xLoc, yLoc, xDim, yDim ):
- #input coloUr and corner co-ordinates ^^^
- #Draw the rectangle
- t_name.color(col)
- t_name.penup()
- t_name.goto(xLoc,yLoc)
- t_name.fillcolor(col)
- t_name.begin_fill()
- t_name.pendown()
- t_name.forward(xDim)
- t_name.right(90)
- t_name.forward(yDim)
- t_name.right(90)
- t_name.forward(xDim)
- t_name.right(90)
- t_name.forward(yDim)
- t_name.end_fill()
- #call up some circles
- draw_circle(luna, 150, "blue", -110, -20)
- draw_circle(luna, 100, "red", 180, 100)
- draw_circle(luna, 50, "yellow", 200, -202)
- #now do some rectangles
- draw_rectangle(luna, "green", -350, 360, 100, 150)
- draw_rectangle(luna, "teal", 220, 100, 35, 159)
- draw_rectangle(luna, "magenta", 350, -182, 65, 15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement