Python·turtle库编程之:怎么画一个五角星? |
您所在的位置:网站首页 › 机器人move指令画五角星 › Python·turtle库编程之:怎么画一个五角星? |
文章目录
前言源码附:
前言
大家好,我是BoBo仔,这节课我要带来一期turtle库的使用教程——画五角星。话不多说,我们直接上代码。 源码 import turtle as t t.pencolor('yellow') t.fillcolor("yellow") t.penup() t.goto(0, 0) t.pendown() t.begin_fill() for i in range(1,6): t.forward(100) # 向前100 t.right(144) # 顺时针旋转144° t.end_fill() t.hideturtle() t.done()这就是全过程了,效果如下: 更多turtle库内容,欢迎关注我哟,进入我的主页,即可享受turtle库讲解! 附:上2节turtle讲解链接 第一讲: https://editor.csdn.net/md/?articleId=136085783 第二讲: https://editor.csdn.net/md/?articleId=136089890 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |