-
Notifications
You must be signed in to change notification settings - Fork 3
/
Assignment4_3.py
80 lines (70 loc) · 1.57 KB
/
Assignment4_3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
'''
Created on May 17, 2015
A program, which draws a human face with falling tear drops.
@author: Likai
'''
import turtle
window = turtle.Screen()
brad = turtle.Turtle()
brad.shape('turtle')
brad.speed(100)
brad.penup()
def drawTears(brad, x=0, y=0, times=4):
brad.speed(3)
brad.setheading(-90)
for i in range(times):
brad.goto(x, y - i * 40)
brad.pendown()
brad.dot(20, 'blue')
brad.penup()
brad.goto(x-295, y - i * 40)
brad.pendown()
brad.dot(20, 'blue')
brad.penup()
def drawEye(brad, x=0, y=0):
brad.goto(x, y)
brad.pendown()
brad.setheading(135)
brad.circle(150, 90)
brad.penup()
brad.setheading(90)
brad.goto(x - 55, y -30)
brad.pendown()
brad.color('red')
brad.begin_fill()
brad.circle(50)
brad.end_fill()
brad.color('black')
brad.penup()
brad.goto(x - 105, y -30)
brad.pendown()
brad.dot(10)
brad.penup()
def drawNose(brad, x=0, y=0):
brad.goto(x, y)
brad.pendown()
brad.setheading(120)
brad.forward(120)
brad.left(120)
brad.forward(120)
brad.left(120)
brad.forward(120)
brad.penup()
def drawMouth(brad, x=0, y=0):
brad.goto(x, y)
brad.pendown()
brad.setheading(-90)
brad.circle(100, 180)
brad.penup()
def drawHead(brad, x=0, y=0):
brad.goto(x, y)
brad.pendown()
brad.circle(300)
brad.penup()
drawEye(brad, -45, 120)
drawEye(brad, 250, 120)
drawNose(brad, 60, -60)
drawMouth(brad, -100, -120)
drawHead(brad, 300, 0)
drawTears(brad, 144, 14)
window.exitonclick()