turtle海龟作图
个人心得:python这么火是有他的原因的,突然发现他的语言很有趣,库函数也很多。
这次是第一步,简单了解了一下turtle函数
- import turtle
- import time
- def drawSnake(rad, angle, len,neckrad ):
- for i in range(len):
- turtle.circle(rad,angle)
- turtle.circle(-rad,angle)
- turtle.circle(rad,angle/2)
- turtle.fd(rad)
- turtle.circle(neckrad+1, 180)
- turtle.fd(rad/2*3)
- def drakSnack_c(rad,len):
- turtle.seth(0)
- turtle.fd(rad)
- turtle.seth(120)
- turtle.fd(rad)
- turtle.seth(240)
- turtle.fd(rad)
- turtle.fd(50)
- turtle.circle(len*2)
- def main():
- turtle.setup(0.85,0.6,0,0)
- pythonsize = 1
- speed = 5
- turtle.speed(speed)
- turtle.pensize(pythonsize)
- #turtle.pencolor("red")
- #turtle.seth(-40)
- #drawSnake(40,80,5,pythonsize/2)
- getflower()
- def text():
- turtle.write("hello world!",font=("Arial",23,"bold"))
- time.sleep(2)
- def getflower():
- turtle.bgpic("timg.gif")
- turtle.color("red","yellow")
- turtle.begin_fill();
- for i in range(50):
- turtle.fd(200)
- turtle.left(170)
- turtle.end_fill()
- time.sleep(2)
- main()
turtle海龟作图的更多相关文章
- 开个小灶——turtle 海龟图形
turtle 海龟图形 turtle数据库是python语言中最流行的绘制函数图形的数据库,绘制笔头像个小海龟,因此一般称为 海龟图形.海龟数据库的导入 import turtle 1 画布大小设 ...
- 小白学Python(20)—— Turtle 海龟绘图
Turtle库是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x.纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行 ...
- turtle海龟库
•turtle的使用 #设置窗体大小 startx,starty非必需,默认在屏幕中间 turtle.setup(width,height,startx,starty) #海龟到(x,y)坐标 tur ...
- 递归可视化之汉诺塔的动画实现(turtle海龟)
import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): def push(self, ite ...
- 海龟绘图turtle模块的使用
在本章中,我们将编写简短的.简单的程序来创建漂亮的.复杂的视觉效果.为了做到这一点,我们可以使用海龟作图软件.在海龟作图中,我们可以编写指令让一个虚拟的(想象中的)海龟在屏幕上来回移动.这个海龟带着一 ...
- python之海龟绘图
1. 基本功能介绍 在海龟作图中,我们可以编写指令让一个虚拟的(想象中的)海龟在屏幕上来回移动.这个海龟带着一只钢笔,我们可以让海龟无论移动到哪都使用这只钢笔来绘制线条.通过编写代码,以各种很酷的模式 ...
- Python语言程序设计(3)--实例2-python蟒蛇绘制-turtle库
1. 2. 3.了解turtle库 Turtle,也叫海龟渲染器,使用Turtle库画图也叫海龟作图.Turtle库是Python语言中一个很流行的绘制图像的函数库.海龟渲染器,和各种三维软件都有着良 ...
- 初始Turtle
---恢复内容开始--- turtle库介绍 海龟作图最初源自20世纪60年代的Logo(创建于1967年,是一种教育编程语言)编程语言. 常用函数说明 画笔的属性 设置画笔的宽度 t.pensi ...
- turtle 20秒画完小猪佩奇“社会人”
转载:https://blog.csdn.net/csdnsevenn/article/details/80650456 图片源自网络 作者 丁彦军 如需转载,请联系原作者授权. 今年社交平台上最火的 ...
随机推荐
- xdebug 常用函数
转自:http://blog.csdn.net/samxx8/article/details/7050282 string xdebug_call_class()返回当前被调用的函数或方法所属的类的类 ...
- shell基本认识
shell基本认识 bash # echo $BASH /bin/bash 第一个shell脚本first_shell.sh #!/bin/bash echo "Hello world!&q ...
- springboot统一异常处理及返回数据的处理
一.返回code数据的处理 代码: Result.java /** * http请求返回的最外层对象 * Created by 廖师兄 * 2017-01-21 13:34 */ public cla ...
- angular中的cookies与cookieStore区别
设置cookie用put()方法: $cookies.put(key, value[, options]); $cookieStore.put(key, value); 例如设置一个cookie,名为 ...
- Python读取指定文件夹(包括当前目录、子目录、子文件)
http://blog.csdn.net/lsq2902101015/article/details/51305825
- Eclipse-环境搭建(缅怀篇)
JDK 下载jdk安装并配置环境变量运行java -version查看是否安装配置成功 Eclipse 下载eclipse,直接解压到目录 eclipse配置jre 设置complie编译等级 Ecl ...
- Nginx 出现413 Request Entity Too Large得解决方法
Nginx 出现413 Request Entity Too Large得解决方法 默认情况下使用nginx反向代理上传超过2MB的文件,会报错413 Request Entity Too Large ...
- garylog学习篇
官方文档:https://www.graylog.org/ 简介 Graylog 是一个简单易用.功能较全面的日志管理工具,相比 ELK 组合, 优点: 部署维护简单查询语法简单易懂(对比ES的语法… ...
- URAL 1830 Help in the RNOS 思路,读题 难度:1
http://acm.timus.ru/problem.aspx?space=1&num=1830 这道题需要理解题目操作的意思, 要更改第i位的状态,第i-1位必须激活为1,0-i-2位必须 ...
- 【2018多校第一场】hdu6308-Time Zone(日期)
Problem Description Chiaki often participates in international competitive programming contests. The ...