sakibalhasannaim

Create Emoji With Python Source Code

Jul 21st, 2023
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | Source Code | 0 0
  1. from turtle import *
  2. import random
  3.  
  4. bgcolor("black")
  5. speed(0)
  6. colors = ["red", "orange", "yellow", "green", "blue", "purple", "white"]
  7. shapes = ["turtle", "circle", "square", "triangle", "classic"]
  8.  
  9. # Function to draw a colorful random shape
  10. def draw_random_shape():
  11. color(random.choice(colors))
  12. shape(random.choice(shapes))
  13. for _ in range(36):
  14. forward(20)
  15. left(10)
  16.  
  17. # Draw a colorful rotating spiral of random shapes
  18. for _ in range(12):
  19. draw_random_shape()
  20. right(30)
  21.  
  22. # Draw a funny face with eyes and a smile
  23. penup()
  24. goto(0, -200)
  25. pendown()
  26.  
  27. color("yellow")
  28. begin_fill()
  29. circle(200)
  30. end_fill()
  31.  
  32. penup()
  33. goto(-60, 80)
  34. pendown()
  35.  
  36. color("black")
  37. begin_fill()
  38. circle(30)
  39. end_fill()
  40.  
  41. penup()
  42. goto(60, 80)
  43. pendown()
  44.  
  45. begin_fill()
  46. circle(30)
  47. end_fill()
  48.  
  49. penup()
  50. goto(-80, -50)
  51. pendown()
  52.  
  53. width(10)
  54. right(90)
  55. circle(80, 180)
  56.  
  57. hideturtle()
  58. done()
  59.  
Advertisement
Add Comment
Please, Sign In to add comment