快捷搜索:  汽车  科技

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)turtle.circle(50)然后先画一个圆​首先引入turtle海龟绘图程序包​

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(1)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(2)

然后我们再用海龟绘图去 画个奥运五环

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(3)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(4)

去新建一个文件

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(5)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(6)

首先引入turtle海龟绘图程序包

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(7)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(8)

然后先画一个圆

turtle.circle(50)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(9)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(10)

去看看

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(11)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(12)

然后再去

turtle.goto(100 0) 这个坐标 然后再去画个圆

turtle.circle(50) 画一个圆

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(13)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(14)

可以看到画出了第二个圆

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(15)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(16)

然后再去turtle.goto(120 0)

turtle.circle(50) 这里把那个100 调整一下 调整成120 横坐标

这样的话 会有间隔 看起来好看一些

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(17)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(18)

看看效果 有间隔了

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(19)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(20)

然后再去画下一个圆

turtle.goto(240 0)

turtle.circle(50)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(21)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(22)

可以看到第三个圆也画出来了

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(23)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(24)

然后再去

turtle.goto(50 -50)

turtle.circle(50)

再去画下一个圆

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(25)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(26)

可以看到效果

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(27)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(28)

需要再去调整一下 x坐标向右移动一点10个像素

turtle.goto(60 -50)

turtle.circle(50)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(29)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(30)

可以看到效果可以了

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(31)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(32)

然后再去画下一个圆

turtle.goto(180 -50)

turtle.circle(50)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(33)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(34)

去看看效果

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(35)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(36)

然后我们 这些圆 都是连着线的 我们去

画完第一个圆以后 我们

turtle.penup() 抬起画笔 然后

再把画笔移动到turtle.goto(120 0) 的位置 然后再去

turtle.pendown()再放下画笔.

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(37)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(38)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(39)

看看效果没问题

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(40)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(41)

然后我们把其他圆的连起来的线也去掉

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(42)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(43)

可以看到效果就有了

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(44)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(45)

然后我们再去 加粗一下画笔 turtle.width(10)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(46)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(47)

可以看到变粗了

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(48)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(49)

然后我们再去替换一下 画每个圆的颜色

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(50)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(51)

替换以后 我们执行去看看

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(52)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(53)

报错了对吧.因为yelllow 写错了 多谢了个l 修改以后

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(54)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(55)

再去执行看效果

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(56)

python海龟绘图实例(python海龟绘图画出奥运五环图---python工作笔记014)(57)

可以看到没问题了对吧 一个简单的 奥运五环就画好了

猜您喜欢: