20181101004,陈浩20181101012,任天旭 1 from turtle import * 2 x = Turtle() 3 y = Turtle() 4 speed(7 ) 5 setup(600,600,200,200 ) 6 # 脸 7 penup() 8 goto(-210 ,0) 9 seth(-90 ) 10 pendown() 11 pencolor( ‘ orange ‘ ) 12 pensize(4 )
20181101004,陈浩 20181101012,任天旭
1 from turtle import* 2 x = Turtle() 3 y = Turtle() 4 speed(7) 5 setup(600,600,200,200) 6 #脸 7 penup() 8 goto(-210,0) 9 seth(-90) 10 pendown() 11 pencolor(‘orange‘) 12 pensize(4) 13 begin_fill() 14 circle(210,360) 15 fillcolor(‘yellow‘) 16 end_fill() 17 pencolor(‘black‘) 18 #画嘴巴 19 pensize(5) 20 penup() 21 goto(-150,-30) 22 pendown() 23 seth(-90) 24 circle(150,180) 25 #左眼眶 26 penup() 27 pensize(4) 28 goto(-180,90) 29 pendown() 30 seth(40) 31 begin_fill() 32 circle(-120,80) 33 penup() 34 goto(-180,90) 35 seth(-130) 36 pendown() 37 circle(15,110) 38 seth(40) 39 circle(-106,83) 40 seth(30) 41 circle(18,105) 42 fillcolor(‘white‘) 43 end_fill() 44 #右眼眶 45 penup() 46 goto(20,90) 47 pendown() 48 seth(40) 49 begin_fill() 50 circle(-120,80) 51 penup() 52 goto(20,90) 53 pendown() 54 seth(-130) 55 circle(15,110) 56 seth(40) 57 circle(-106,83) 58 seth(30) 59 circle(18,105) 60 fillcolor(‘white‘) 61 end_fill() 62 #画眼珠 63 pensize(2) 64 penup() 65 goto(50,95) 66 pendown() 67 pencolor(‘white‘) 68 begin_poly() 69 begin_fill() 70 circle(8,360) 71 fillcolor(‘white‘) 72 end_fill() 73 end_poly() 74 p1 = get_poly() 75 register_shape("1", p1) 76 x.shape(‘1‘) 77 x.penup() 78 x.goto(-45,135) 79 penup() 80 goto(-150,95) 81 pendown() 82 begin_poly() 83 begin_fill() 84 circle(8,360) 85 fillcolor(‘white‘) 86 end_fill() 87 end_poly() 88 p2 = get_poly() 89 register_shape("2", p2) 90 y.penup() 91 y.shape(‘2‘) 92 y.goto(-245,-65) 93 #画腮红 94 pensize(1) 95 pencolor(‘pink‘) 96 begin_fill() 97 penup() 98 goto(-160,50) 99 pendown() 100 seth(-90) 101 for i in range(2): 102 for j in range(10): 103 forward(j) 104 left(9) 105 for j in range(10,0,-1): 106 forward(j) 107 left(9) 108 fillcolor(‘pink‘) 109 end_fill() 110 pensize(1) 111 pencolor(‘pink‘) 112 begin_fill() 113 penup() 114 goto(40,50) 115 pendown() 116 seth(-90) 117 for i in range(2): 118 for j in range(10): 119 forward(j) 120 left(9) 121 for j in range(10,0,-1): 122 forward(j) 123 left(9) 124 fillcolor(‘pink‘) 125 end_fill() 126 x.penup() 127 y.penup() 128 while True: 129 speed(1) 130 for i in range(-20,20): 131 x.fd(10) 132 y.fd(10) 133 x.fd(-10) 134 y.fd(-10) 135 exitonclick()