Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. import turtle
  2. turtle.shape('turtle')
  3. turtle.speed('fastest')
  4.  
  5. def circle_lf(x, y, rgb): # Draw a color circle. (x, y) - parameters set the length of the perimeter of the circle. (rgb) - circle color.
  6.     turtle.begin_fill()
  7.     for i in range(360):
  8.         turtle.left(y)
  9.         turtle.forward(x)
  10.     turtle.color(rgb)
  11.     turtle.end_fill()
  12.     turtle.color('black')
  13.  
  14. def arc_rg(x, y, rgb): # Draw a color arc. (x, y) - parameters set the length of the arc. (rgb) - arc color.
  15.     turtle.color(rgb)
  16.     for i in range(180):
  17.         turtle.right(y)
  18.         turtle.forward(x)
  19.     turtle.color('black')
  20.  
  21. # Draw a smile face
  22. circle_lf(1.5, 1, 'yellow')
  23.  
  24. # Draw a smile left eye
  25. turtle.penup()
  26. turtle.left(90)
  27. turtle.forward(120)
  28. turtle.left(90)
  29. turtle.forward(25)
  30. turtle.right(90)
  31. turtle.pendown()
  32. circle_lf(0.25, 1, 'blue')
  33.  
  34. # Draw a smile right eye
  35. turtle.penup()
  36. turtle.right(90)
  37. turtle.forward(50)
  38. turtle.right(90)
  39. turtle.pendown()
  40. circle_lf(0.25, 1, 'blue')
  41.  
  42. # Draw a smile nose
  43. turtle.penup()
  44. turtle.right(90)
  45. turtle.forward(25)
  46. turtle.left(90)
  47. turtle.forward(25)
  48. turtle.pendown()
  49. turtle.width(8)
  50. turtle.forward(25)
  51.  
  52. # Draw a smile mouth
  53. turtle.penup()
  54. turtle.forward(20)
  55. turtle.left(90)
  56. turtle.forward(40)
  57. turtle.right(90)
  58. turtle.pendown()
  59. turtle.width(8)
  60. arc_rg(0.7, 1, 'red')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement