发射爱心
1 #2.14 2 from turtle import* 3 from time import sleep 4 5 def go_to(x,y): 6 up() 7 goto(x,y) 8 down() 9 10 def head(x,y,r): 11 go_to(x,y) 12 speed(1) 13 circle(r) 14 leg(x,y) 15 16 def leg(x,y): 17 18 right(90) 19 forward(180) 20 right(30) 21 forward(100) 22 left(120) 23 go_to(x,y-180) 24 forward(100) 25 right(120) 26 forward(100) 27 left(120) 28 hand(x,y) 29 30 def hand(x,y): 31 go_to(x,y-60) 32 forward(100) 33 left(60) 34 forward(100) 35 go_to(x,y-90) 36 right(60) 37 forward(100) 38 right(60) 39 forward(100) 40 left(60) 41 eye(x,y) 42 43 def eye(x,y): 44 go_to(x-50,y+130) 45 right(90) 46 forward(50) 47 go_to(x+40,y+130) 48 forward(50) 49 left(90) 50 51 def big_Circle(size): 52 speed(20) 53 for i in range(150): 54 forward(size) 55 right(0.3) 56 def line(size): 57 speed(1) 58 forward(51*size) 59 60 def small_Circle(size): 61 speed(10) 62 for i in range(210): 63 forward(size) 64 right(0.786) 65 66 def heart(x,y,size): 67 go_to(x,y) 68 left(150) 69 begin_fill() 70 line(size) 71 big_Circle(size) 72 small_Circle(size) 73 left(120) 74 small_Circle(size) 75 big_Circle(size) 76 line(size) 77 end_fill() 78 79 def main(): 80 pensize(2) 81 color('red','pink') 82 head(-120,100,100) 83 heart(250,-80,1) 84 go_to(200,-300) 85 write("To:智慧与美貌其存的你 yyh",move=True,align="left",font=("楷体",20, "normal")) 86 done() 87 88 main()