Advertisement
skip420

ModernArt.py

Sep 12th, 2021
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. # python3 ModernArt.py
  2. # Python program to user input pattern
  3. # using Turtle Programming
  4. import turtle #Outside_In
  5. import turtle
  6. import time
  7. import random
  8. # Python program to draw
  9. # Spiral Helix Pattern
  10. # using Turtle Programming
  11. # Python program to draw
  12. # Spiral Helix Pattern
  13. # using Turtle Programming
  14.  
  15. import turtle
  16. loadWindow = turtle.Screen()
  17. turtle.speed(2)
  18.  
  19. for i in range(100):
  20. turtle.circle(5*i)
  21. turtle.circle(-5*i)
  22. turtle.left(i)
  23.  
  24. turtle.exitonclick()
  25.  
  26. print ("This program draws shapes based on the number you enter in a uniform pattern.")
  27. num_str = input("Enter the side number of the shape you want to draw: ")
  28. if num_str.isdigit():
  29. squares = int(num_str)
  30.  
  31. angle = 180 - 180*(squares-2)/squares
  32.  
  33. turtle.up
  34.  
  35. x = 0
  36. y = 0
  37. turtle.setpos(x, y)
  38.  
  39.  
  40. numshapes = 8
  41. for x in range(numshapes):
  42. turtle.color(random.random(), random.random(), random.random())
  43. x += 5
  44. y += 5
  45. turtle.forward(x)
  46. turtle.left(y)
  47. for i in range(squares):
  48. turtle.begin_fill()
  49. turtle.down()
  50. turtle.forward(40)
  51. turtle.left(angle)
  52. turtle.forward(40)
  53. print (turtle.pos())
  54. turtle.up()
  55. turtle.end_fill()
  56.  
  57. time.sleep(11)
  58. turtle.bye()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement