python中turtle模块之画个小汽车
2016-10-25 23:46
609 查看
</pre><pre name="code" class="python">#!/usr/bin/python #coding: utf-8 import turtle import time t = turtle.Pen() def fun1(t, x, y): t.forward(x) t.left(y) def fun2(t, x, y): t.forward(x) t.right(y) ''' color函数有三个参数 第一个参数指定有多少红色 第二个参数指定有多少绿色 第三个参数指定有多少蓝色 都为0的时候此时为黑色 都为1的时候此时为白色 这种红色,绿色,蓝色的混搭叫做RGB 蓝色和红色混合产生紫色 黄色和红色混合产生橙色 ''' t.color(1, 0, 0) t.begin_fill() fun1(t, 100, 90) fun1(t, 20, 90) fun2(t, 20, 90) fun1(t, 20, 90) fun1(t, 60, 90) fun2(t, 20, 90) fun1(t, 20, 90) t.forward(20) t.end_fill() time.sleep(3) t.color(0, 0, 0) t.up() t.forward(10) t.down() # 开始位置 t.begin_fill() # 画圆 t.circle(10) # 结束位置 t.end_fill() # 设置当前的指定角度为0度 t.setheading(0) t.up() t.forward(90) t.right(90) t.forward(10) t.setheading(0) t.down() t.begin_fill() t.circle(10) t.end_fill() time.sleep(2)
相关文章推荐
- Python GUI:高级作图turtle模块的常用函数.md
- Python——用turtle模块画海龟的第一步
- Python内置模块turtle绘图详解
- python初学者学习turtle(海龟)模块
- 关于Python绘图模块Turtle库详解
- 用Python的turtle模块画国旗
- 使用Python的turtle模块画图的方法
- 用Python中的turtle模块绘图
- python中turtle模块的基本命令
- python中turtle模块的练习
- 通过python turtle画图模块做一个丢骰子的小游戏
- 用python的turtle模块给女票画个小心心
- Python基础(三)——turtle模块
- python中turtle模块画正多边形
- Python模块之turtle使用大全!
- python学习-turtle模块(一)
- 解决Ubuntu python 使用turtle显示没有Tkinter模块问题
- 使用Python的turtle模块画出最简单的五角星
- Python turtle 模块函数笔记
- python中turtle(海龟)模块的简单用法