-
Notifications
You must be signed in to change notification settings - Fork 1
/
函数画图的py.py
46 lines (35 loc) · 905 Bytes
/
函数画图的py.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
import turtle
def drawline(x1, y1, x2, y2):
turtle.penup()
turtle.goto(x1, y1)
turtle.pendown()
turtle.goto(x2, y2)
def writeText(s, x, y):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.write(s)
def drawPoint(x, y):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.begin_fill()
turtle.circle(3)
turtle.end_fill()
def drawCircle(x=0, y=0, radius=10):
turtle.penup()
turtle.goto(x, y - radius)
turtle.pendown()
turtle.circle(radius)
def drawRectangle(x=0, y=0, width=10, height=10):
turtle.penup()
turtle.goto(x + width / 2, y + width / 2)
turtle.pendown()
turtle.right(90)
turtle.forward(height)
turtle.right(90)
turtle.forward(width)
turtle.right(90)
turtle.forward(height)
turtle.right(90)
turtle.forward(width)