Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' At the moment all our circles are drawn at the centre of the screen. Can you add parameters to the draw_circle function so that you can
- draw circles at different locations on the screen?
- The goto(x, y) function moves the turtle to a specific location.
- The penup() function lifts the pen so that the turtle doesn’t draw when it’s moving.
- What do you think is the best order for the input parameters for your function?
- Can you create a similar function that draws rectangles of different sizes and shapes? You can look at the Modern Art project
- for help with drawing rectangles.
- Use your functions to draw a picture or create some art.
- '''
- from turtle import *
- from time import sleep
- tina = Turtle()
- def draw_circle(x,y,t_name, r, col, shape):
- t_name.goto(x,y)
- t_name.pendown()
- t_name.color(col)
- if shape=="circle":
- t_name.dot(r*2)
- else:
- t_name.shape(shape)
- t_name.penup()
- draw_circle(5,5,tina, 150, "blue","turtle")
- draw_circle(100,100,tina, 100, "red","square")
- draw_circle(20,100,tina, 50, "yellow","circle")
- sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement