码迷,mamicode.com
首页 > 编程语言 > 详细

python-turtle库,心得随心画~~

时间:2020-03-24 23:20:25      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:imp   mda   image   png   图片   eve   range   height   splay   

画画篮球场——→

代码如下:

技术图片
  1 import turtle
  2 turtle.pu()
  3 turtle.left(90)
  4 turtle.fd(250)
  5 turtle.left(90)
  6 turtle.fd(70)
  7 turtle.left(20)
  8 turtle.pd()
  9 turtle.pensize(3)
 10 
 11 turtle.color(gold,pink)
 12 turtle.begin_fill()
 13 turtle.fd(150)          #三分圈
 14 turtle.circle(200,55)
 15 turtle.left(5)
 16 turtle.circle(250,10)
 17 turtle.circle(200,10)
 18 turtle.left(5)
 19 turtle.circle(200,20)
 20 turtle.right(5)
 21 turtle.circle(180,20)
 22 turtle.circle(400,20)
 23 turtle.circle(600,16)
 24 turtle.right(5)
 25 turtle.circle(600,20)
 26 turtle.left(12)
 27 turtle.fd(150)
 28 turtle.left(113)
 29 turtle.pencolor(purple)
 30 turtle.fd(602)
 31 turtle.end_fill()
 32 
 33 
 34 turtle.fd(25)           #边界
 35 turtle.left(65)
 36 turtle.fd(450)
 37 turtle.left(110)
 38 turtle.fd(664)
 39 turtle.left(74)
 40 turtle.fd(500)
 41 turtle.left(111.1)
 42 turtle.fd(245)
 43 
 44 turtle.pencolor(orange)          #小圆
 45 turtle.left(60)
 46 turtle.fd(360)
 47 turtle.circle(-200,35)
 48 turtle.right(5)
 49 turtle.circle(-115,35)
 50 turtle.circle(-60,90)
 51 turtle.right(5)
 52 turtle.left(5)
 53 turtle.circle(-100,23)
 54 turtle.left(10)
 55 turtle.fd(325)
 56 turtle.right(62)
 57 turtle.fd(210)
 58 
 59 turtle.right(120)       #右抢篮板分位块
 60 turtle.fd(105)
 61 turtle.left(120)
 62 turtle.fd(17)
 63 turtle.right(120)
 64 turtle.fd(30)
 65 turtle.right(60)
 66 turtle.fd(17)
 67 turtle.left(60)
 68 
 69 turtle.fd(60)            #右抢篮板分位线1
 70 turtle.left(120)
 71 turtle.fd(17)
 72 turtle.fd(-17)
 73 turtle.right(120)
 74 
 75 turtle.fd(60)             #右线2
 76 turtle.left(120)
 77 turtle.fd(17)
 78 turtle.fd(-17)
 79 turtle.right(120)
 80 
 81 turtle.fd(60)             #右线3
 82 turtle.left(120)
 83 turtle.fd(17)
 84 turtle.fd(-17)
 85 turtle.right(120)
 86 
 87 turtle.fd(45)             #罚球线
 88 turtle.right(70)
 89 turtle.fd(183)
 90 turtle.right(108)
 91 
 92 turtle.fd(35)              #左线3
 93 turtle.left(120)
 94 turtle.fd(17)
 95 turtle.fd(-17)
 96 turtle.right(120)
 97 
 98 turtle.fd(50)              #左线2
 99 turtle.left(120)
100 turtle.fd(17)
101 turtle.fd(-17)
102 turtle.right(120)
103 
104 turtle.fd(50)              #左线1
105 turtle.left(120)
106 turtle.fd(17)
107 turtle.fd(-17)
108 turtle.right(120)
109 
110 turtle.fd(50)               #左抢篮板分位块
111 turtle.left(120)
112 turtle.fd(17)
113 turtle.right(120)
114 turtle.fd(30)
115 turtle.right(60)
116 turtle.fd(17)
117 turtle.left(60)
118 turtle.fd(103)
119 
120 turtle.pensize(2)           #左半柱
121 turtle.right(62)
122 turtle.fd(80)
123 turtle.pencolor(purple)
124 turtle.left(130)
125 turtle.fd(90)
126 turtle.right(130)
127 turtle.fd(10)
128 turtle.left(130)
129 turtle.fd(50)
130 
131 
132 turtle.left(90)             #篮板
133 turtle.fd(45)
134 turtle.right(30)
135 turtle.fd(60)
136 turtle.right(60)
137 turtle.fd(80)
138 turtle.right(120)
139 turtle.fd(120)
140 turtle.right(60)
141 turtle.fd(80)
142 turtle.right(120)
143 turtle.fd(60)
144 
145 
146 turtle.color(purple,pink)     #瞄准框
147 turtle.begin_fill()
148 turtle.right(60)
149 turtle.fd(10)
150 turtle.left(60)
151 turtle.fd(20)
152 turtle.right(60)
153 turtle.fd(30)
154 turtle.right(120)
155 turtle.fd(40)
156 turtle.right(60)
157 turtle.fd(30)
158 turtle.right(120)
159 turtle.fd(20)
160 turtle.end_fill()
161 
162 turtle.left(10)             #篮筐
163 turtle.circle(80,50)
164 turtle.left(110)
165 turtle.circle(50,60)
166 turtle.left(5)
167 turtle.circle(50,28)
168 
169 turtle.left(180)            #篮网
170 turtle.fd(70)
171 turtle.right(115)
172 turtle.fd(55)
173 turtle.right(160)
174 turtle.fd(70)
175 turtle.left(170)
176 turtle.fd(68)
177 turtle.left(170)
178 turtle.fd(62)
179 turtle.left(160)
180 turtle.fd(60)
181 turtle.right(170)
182 turtle.fd(60)
183 turtle.left(160)
184 turtle.fd(55)
185 turtle.left(160)
186 turtle.fd(63)
187 turtle.left(115)
188 turtle.fd(25)
189 turtle.left(73)
190 turtle.fd(55)
191 
192 turtle.right(75)            #右半柱
193 turtle.fd(65)
194 turtle.right(92)
195 turtle.fd(65)
196 turtle.left(70)
197 turtle.fd(8)
198 turtle.right(70)
199 turtle.fd(103)
200 turtle.hideturtle()
简约篮球场

运行结果如下:

技术图片

 

 觉得好玩就试一下吧!!!

python-turtle库,心得随心画~~

标签:imp   mda   image   png   图片   eve   range   height   splay   

原文地址:https://www.cnblogs.com/zhENie/p/12562664.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!