代码改变世界

玫瑰花的绘制

2017-10-25 21:32  布布灵  阅读(199)  评论(0编辑  收藏  举报

1、最终绘图窗口截图:

 

2、程序代码:

 1 import turtle
 2 turtle.setup(800,600,0,0)
 3 turtle.pensize(1)
 4 turtle.fillcolor("red")
 5 turtle.speed(6)
 6 turtle.begin_fill()
 7 turtle.circle(5,180)
 8 turtle.circle(10,90)
 9 turtle.seth(310)
10 turtle.circle(15,100)
11 turtle.circle(10,90)
12 turtle.seth(150)
13 turtle.circle(20,130)
14 turtle.seth(260)
15 turtle.speed(0)
16 turtle.fd(8)
17 turtle.seth(110)
18 turtle.fd(12)
19 turtle.seth(245)
20 turtle.circle(40,115)
21 turtle.seth(30)
22 turtle.circle(45,105)
23 turtle.seth(100)
24 turtle.circle(45,-20)
25 turtle.seth(120)
26 turtle.fd(15)
27 turtle.end_fill()
28 turtle.begin_fill()
29 turtle.seth(180)
30 turtle.circle(8,-120)
31 turtle.seth(80)
32 turtle.end_fill()
33 turtle.circle(40,-20)
34 turtle.seth(225)
35 turtle.circle(35,77)
36 turtle.seth(65)
37 turtle.circle(16,115)
38 turtle.seth(345)
39 turtle.circle(23,-90)
40 turtle.penup()
41 turtle.goto(13,-61)
42 turtle.pendown()
43 turtle.seth(270)
44 turtle.speed(1)
45 turtle.circle(100,40)
46 turtle.fd(80)
47 turtle.speed(0)
48 turtle.fillcolor("green")
49 turtle.begin_fill()
50 turtle.penup()
51 turtle.goto(30,-97)
52 turtle.pendown()
53 turtle.seth(0)
54 turtle.circle(30,90)
55 turtle.seth(180)
56 turtle.circle(30,90)
57 turtle.end_fill()
58 turtle.penup()
59 turtle.goto(22,-100)
60 turtle.pendown()
61 turtle.seth(20)
62 turtle.circle(45,40)
63 turtle.begin_fill()
64 turtle.penup()
65 turtle.goto(30,-130)
66 turtle.pendown()
67 turtle.seth(120)
68 turtle.circle(30,90)
69 turtle.seth(300)
70 turtle.circle(30,90)
71 turtle.end_fill()
72 turtle.penup()
73 turtle.goto(40,-130)
74 turtle.pendown()
75 turtle.seth(0)
76 turtle.circle(150,-10)