首页 > 编程语言 > 详细

python 的turtle 简易画图,第一次

时间:2017-10-25 16:21:41      阅读:425      评论:0      收藏:0      [点我收藏+]
import turtle

bob = turtle.Turtle()

#画四方形
def square(t,length):


for i in range(4):
t.lt(90)
t.fd(length)

square(bob,200)

#画多边形
def polygon(t,length,n):


for i in range(n):

t.lt(360/n)
t.fd(length)


polygon(bob,50,30)


#画圆形
def circle(t,r):

for i in range(1000):
t.lt(360 / 1000)
t.fd(3.14*2*r/1000)

circle(bob,100)

python 的turtle 简易画图,第一次

原文:http://www.cnblogs.com/xiaorourou/p/7729389.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!