Advertisement
Juan101

arte moderno circulos y rectangulos

Dec 12th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. from turtle import *
  2. from random import *
  3.  
  4. colormode(255)
  5.  
  6. def randomcolor():
  7.     red = randint(0, 255)
  8.     green = randint(0, 255)
  9.     blue = randint(0, 255)
  10.     color(red, green, blue)
  11.  
  12. def randomplace():
  13.     penup()
  14.     x = randint(-200, 200)
  15.     y = randint(-200, 200)
  16.     goto(x, y)
  17.     pendown()
  18.  
  19. def randomheading():
  20.     numero = randint(1, 360)
  21.     setheading(numero)
  22.  
  23. def drawcirculo():
  24.     r = randint(3, 150)
  25.     randomcolor()
  26.     randomplace()
  27.     #randomheading()
  28.     hideturtle()
  29.     dot(r)
  30.    
  31. def drawrectangulo():
  32.     randomcolor()
  33.     randomplace()
  34.     #randomheading()
  35.     hideturtle()
  36.     largo = randint(3, 150)
  37.     alto = randint(3, 150)
  38.     begin_fill()
  39.     forward(largo)
  40.     right(90)
  41.     forward(alto)
  42.     right(90)
  43.     forward(largo)
  44.     right(90)
  45.     forward(alto)
  46.     right(90)
  47.     end_fill()
  48.  
  49.  
  50. shape()
  51. speed(90)
  52.  
  53. clear()
  54. setheading(0)
  55.  
  56. for i in range(60):
  57.     drawcirculo()
  58.  
  59. for i in range (40):
  60.     drawrectangulo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement