失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 12 python 海龟绘图 turtle

12 python 海龟绘图 turtle

时间:2021-04-29 09:06:55

相关推荐

12 python 海龟绘图 turtle

海归绘图

import turtle #导入 turtle 模块

turtle.showturtle() #显示箭头

turtle.write("木槿") #写字符串

turtle.forward(300) #前进 300 像素

turtle.color("red") #画笔颜色改为 red

turtle.left(90) #箭头左转 90 度

turtle.forward(300)

turtle.goto(0,50) #去坐标(0,50)

turtle.goto(0,0)

turtle.penup() #抬笔。这样,路径就不会画出来

turtle.goto(0,300)

turtle.pendown() #下笔。这样,路径就会画出来

turtle.circle(100) #画圆

绘制的奥运五环

import turtle

turtle.width(10)

turtle.color("blue")

turtle.circle(50)

turtle.penup()

turtle.goto(120,0)

turtle.pendown()

turtle.color("black")

turtle.circle(50)

turtle.penup()

turtle.goto(240,0)

turtle.pendown()

turtle.color("red")

turtle.circle(50)

turtle.penup()

turtle.goto(60,-50)

turtle.pendown()

turtle.color("yellow")

turtle

如果觉得《12 python 海龟绘图 turtle》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。