python学习之Turtle 4
2017-10-09 22:46
357 查看
继续学习turtle
参考书目 趣学Python编程——Python for kids
参考书目 趣学Python编程——Python for kids
小汽车
0小汽车#车身主体 >>> t.reset() >>> t.color(1,0,0) #颜色设置(RGB) >>> t.begin_fill() #充填颜色begin >>> t.forward(100) >>> t.left(90) >>> t.forward(20) >>> t.left(90) >>> t.forward(20) >>> t.right(90) >>> t.forward(20) >>> t.left(90) >>> t.forward(60) >>> t.left(90) >>> t.forward(20) >>> t.right(90) >>> t.forward(20) >>> t.right(90) >>> t.right(180) >>> t.forward(20) >>> t.end_fill() #充填颜色end #大轮子 >>> t.color(0,0,0) #颜色设置(RGB) >>> t.up() >>> t.forward(10) >>> t.down() >>> t.begin_fill() #充填颜色begin >>> t.circle(20) #画圆r = 20 >>> t.end_fill() #充填颜色end #小轮子 >>> t.setheading(0) #设置画笔的朝向,画笔默认朝向为正右方 >>> t.up() >>> t.forward(90) >>> t.right(90) >>> t.forward(10) >>> t.setheading(0) #设置画笔的朝向,画笔默认朝向为正右方 >>> t.begin_fill() >>> t.down() >>> t.circle(10) >>> t.end_fill()
圆圆圆
>>> t.reset() # 画圆函数 >>> def mycircle(red, green, blue): t.color(red, green, blue) t.begin_fill() t.circle(50) t.end_fill()
>>> mycircle(0,1,0)
>>> mycircle(1,0,0)
>>> mycircle(0,0,1)
画方块
>>> t.reset() >>> def mysquare(size): for x in range(1,5): t.forward(size) t.left(90) >>> mysquare(25) >>> mysquare(50) >>> mysquare(75) >>> mysquare(100) >>> mysquare(125) >>> mysquare(150)
相关文章推荐
- python初学者学习turtle(海龟)模块
- python学习turtle(移动和绘制)
- python学习turtle(龟图标状态)
- python学习turtle(笔控制)
- python学习之Turtle 1
- python学习笔记-turtle类库实例
- python学习之Turtle 2
- Python学习笔记-Turtle库简单实例之日期时间显示
- python学习笔记 turtle类使用
- python学习-turtle模块(一)
- python学习之Turtle 5
- python学习之输入输出,if,while,for,简单的turtle使用
- 学习笔记_python_turtle
- python学习笔记9--用turtle简单绘图2
- python学习turtle(告诉龟的状态,量度设置)
- 海龟绘图-python turtle学习笔记2
- 海龟绘图-python turtle学习笔记1
- python入门学习-turtle
- python学习-turtle模块(二)
- 海龟绘图-python turtle学习笔记3