Advertisement
sriyanto

Smiling Face

May 27th, 2023
977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | Source Code | 0 0
  1. import turtle
  2. screen = turtle.Screen()
  3. t = turtle.Turtle()
  4. screen.setup(500,500)
  5.  
  6. t.width(1)
  7. t.speed(1)
  8.  
  9. # Set screen color
  10. screen.bgcolor('teal')
  11. # Draw the face
  12. t.penup()
  13. t.goto(0, -100)
  14. t.fillcolor('yellow')
  15. t.begin_fill()
  16. t.pendown()
  17. t.circle(100)
  18. t.penup()
  19. t.end_fill()
  20.  
  21. # draw the  left eye
  22. t.goto(-30, -20)
  23. t.fillcolor('white')
  24. t.begin_fill()
  25. t.pendown()
  26. t.circle(30)
  27. t.penup()
  28. t.end_fill()
  29.  
  30. t.goto(-30, -10)
  31. t.fillcolor('black')
  32. t.begin_fill()
  33. t.pendown()
  34. t.circle(10)
  35. t.penup()
  36. t.end_fill()
  37.  
  38. # draw the right eye
  39. t.goto(30, -20)
  40. t.fillcolor('white')
  41. t.begin_fill()
  42. t.pendown()
  43. t.circle(30)
  44. t.penup()
  45. t.end_fill()
  46.  
  47. t.goto(30, -10)
  48. t.fillcolor('black')
  49. t.begin_fill()
  50. t.pendown()
  51. t.circle(10)
  52. t.penup()
  53. t.end_fill()
  54.  
  55. # smile
  56. t.goto(-55,-40)
  57. t.pendown()
  58. t.right(45)
  59. t.circle(80,90)
  60. t.penup()
  61.  
  62. #draw a hat
  63. t.goto(-40,90)
  64. t.right(45) #set the direction forward
  65. t.fillcolor('red')
  66. t.begin_fill()
  67. t.pendown()
  68. #draw triangle
  69. t.forward(80)
  70. t.left(120)
  71. t.forward(80)
  72. t.left(120)
  73. t.forward(80)
  74. t.left(120)
  75. t.end_fill()
  76. t.penup()
  77. t.hideturtle()
Tags: turtle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement