Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- from turtle import *
- tina=Turtle()
- tina.screen.colormode(255)
- def randomcolour(name_turtle):
- red=randint(0,255)
- green=randint(0,255)
- blue=randint(0,255)
- name_turtle.color(red,green,blue)
- def randomplace(name_turtle):
- x=randint(-100,100)
- y=randint(-100,100)
- name_turtle.goto(x,y)
- def randomsize_circle(name_turtle):
- radius=randint(0,100)
- name_turtle.dot(radius*2)
- def base_rectangle(name_turtle,distance):
- name_turtle.forward(distance)
- name_turtle.right(90)
- def drawrectangle(name_turtle):
- name_turtle.penup()
- randomcolour(name_turtle)
- randomplace(name_turtle)
- length=randint(10,100)
- height=randint(10,100)
- name_turtle.begin_fill()
- base_rectangle(tina,length)
- base_rectangle(tina,height)
- base_rectangle(tina,length)
- name_turtle.forward(height)
- name_turtle.end_fill()
- name_turtle.pendown()
- def draw_circle_random(name_turtle):
- name_turtle.penup()
- randomcolour(name_turtle)
- randomsize_circle(name_turtle)
- pos_turtle=name_turtle.position()
- print("original position> "+ str(pos_turtle))
- randomplace(name_turtle)
- print("new_position of "+ str(name_turtle) + " is " + str(name_turtle.position()))
- name_turtle.pendown()
- for i in range(25):
- draw_circle_random(tina)
- drawrectangle(tina)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement