Turtle库画小猫咪
from turtle import *
#两个函数用于画心
def curvemove():
for i in range(200):
right(1)
forward(0.1)
def heart(x,y,s):
pu()
goto(x,y)
seth(s)
pendown()
begin_fill()
left(140)
forward(11.1)
curvemove()
left(120)
curvemove()
forward(11.1)
end_fill()
#初始化
setup(600,600)
pu()
goto(60,100)
pensize(4)
pendown()
#画左半边的头
for i in range(150,212,2):
seth(i)
fd(3)
seth(145)
fd(50)
left(125)
fd(50)
for i in range(240,318,2):
if i==290:
seth(190)
fd(10)
seth(10)
fd(10)
elif i==300:
seth(200)
fd(10)
seth(20)
fd(10)
seth(i)
fd(3)
#画右半边的头
pu()
goto(60,100)
pendown()
seth(45)
fd(50)
right(125)
fd(50)
for i in range(-60,-138,-2):
if i==-110:
seth(-10)
fd(10)
seth(170)
fd(10)
elif i==-120:
seth(-20)
fd(10)
seth(160)
fd(10)
seth(i)
fd(3)
#头部到这里就画好外观了
seth(-40)
fd(52)
seth(-135)
fd(45)
pu()
seth(-105)
fd(5)
pendown()
fd(17)
for i in range(130,106,-3):
seth(i)
fd(2.5)
for i in range(106,30,-10):
seth(i)
fd(2)
seth(38)
fd(25)
seth(135)
fd(31)
seth(169)
fd(6)
seth(270)
fd(105)
#右边的身子画好了
#开始画左边的身子
pu()
goto(-52,-30)
pendown()
seth(220)
fd(48)#
seth(250)
fd(3)
seth(270)
fd(3)
seth(290)
fd(2)
seth(-40)
fd(44)
seth(228)
fd(20)
seth(5)
fd(22)
#画叉腰的动作
pu()
goto(-52,-84)
seth(133)
pendown()
fd(22)
seth(90)
fd(2)
seth(60)
fd(2)
seth(45)
fd(29)
seth(0)
fd(3)
seth(-93)
fd(102)
#叉腰动作结束 接下来画嘴巴 眼睛
pu()
goto(-43,38)
seth(0)
pendown()
begin_fill()
circle(5)
end_fill()
pu()
fd(108)
pendown()
begin_fill()
circle(5)
end_fill()
#调色环节
pu()
goto(60,24)
pencolor("pink")
pensize(6)
seth(225)
pendown()
fd(7)
pu()
goto(70,24)
seth(225)
pendown()
fd(7)
#右半边调色完毕
pu()
goto(-49,24)
seth(225)
pendown()
fd(7)
#画嘴巴
pu()
pensize(4)
pencolor("black")
goto(5,21)
seth(-45)
pendown()
fd(5)
goto(5,21)
seth(225)
fd(5)
#左边的颜色
pu()
pencolor("pink")
pensize(6)
goto(-39,24)
seth(225)
pendown()
fd(7) #给耳朵填充颜色
pu()
goto(-40,92)
seth(80)
pendown()
fillcolor("pink")
begin_fill()
circle(14,360,3)
end_fill()
pu()
goto(72,100)
seth(-74)
pendown()
begin_fill()
circle(14,360,3)
end_fill()
#酷酷的黑翅膀
pu()
pensize(4)
color('black', 'black')
begin_fill()
goto(-90,-35)
seth(135)
pendown()
fd(25)
seth(225)
fd(45)
seth(25)
fd(15)
seth(-80)
pensize(2)
fd(15)
seth(55)
fd(15)
seth(25)
fd(10)
seth(-80)
fd(15)
seth(75)
fd(15)
goto(-90,-35)
end_fill()
#最后一个翅膀
pu()
goto(125,-30)
seth(45)
pendown()
begin_fill()
fd(25)
seth(-45)
fd(45)
seth(155)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
seth(170)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
goto(125,-30)
end_fill() #画5颗心
speed(10)
color('red', 'pink')
pensize(2)
heart(0,140,0)
heart(-125,0,30)
heart(140,0,-30)
heart(145,-85,-30)
heart(-132,-85,30)
exitonclick()
Turtle库画小猫咪的更多相关文章
- 用Turtle库画一个爱心
---恢复内容开始--- 用Python中的turtle库画一个爱心 这个学期,我学了Python语言,并学到其中的一个库:turtle库.用turtle库可以画一些你想画的图片,所以我就想画一个爱心 ...
- 一篇文教你使用python Turtle库画出“精美碎花小清新风格树”快来拿代码!
Turtle库手册可以查询查询 python图形绘制库turtle中文开发文档及示例大全,手册中现有示例,不需要自己动手就可以查看演示. 使用Turtle画树,看了一下网上的代码,基本上核心的方法是使 ...
- 课程作业——Python基础之使用turtle库画出红旗
代码如下: import turtle # 设置画笔和背景颜色 turtle.color('yellow') turtle.bgcolor('red') # 通过偏移量和尺寸大小画星星 def dra ...
- Python语言程序设计之二--用turtle库画围棋棋盘和正、余弦函数图形
这篇笔记依然是在做<Python语言程序设计>第5章循环的习题.其中有两类问题需要记录下来. 第一是如何画围棋棋盘.围棋棋盘共有19纵19横.其中,位于(0,0)的星位叫天元,其余8个星位 ...
- 使用turtle库画国际象棋棋盘
import turtle n = 60 # 每行间隔,小格子边长 x = -300 # x初始值 y = -300 # x初始值 def main(): turtle.speed(11) turtl ...
- 使用turtle库画一朵玫瑰花带文字
参考链接:https://jingyan.baidu.com/article/d169e18689f309026611d8c8.html https://blog.csdn.net/weixin_41 ...
- 使用Python的turtle库画圣诞树
代码如下: from turtle import * import random import time n = 80.0 speed("fastest") screensize( ...
- 使用turtle库画太极图
from turtle import * pensize(3) penup() pencolor("black") reset() speed(10) pendown() circ ...
- 使用turtle库画同切圆
import turtle as t t.setup(600,600,None,None) t.pensize(5) t.penup() t.pendown() t.pencolor("re ...
随机推荐
- 处理python错误问题
------------恢复内容开始------------ 调试过程中遇到的问题 (1)爬取首页源码出现中文乱码 解决方案: 将网页编码强制转换成gbk,并去除解决乱码问题的三行代码. (2)程序运 ...
- 在Android8.0以上收不到广播问题(AppWidget)
对Intent指定组件 //安卓8.0必须添加 intent.setComponent(new ComponentName(context,MyAppWidgetProvider.class)); 问 ...
- ELECTRON 打包
安装electron-packager cnpm install electron-packager -g 配置package.json "scripts": { "st ...
- 小程序 wxs时间戳转字符串
function formatDate(value) { //不能使用 new Date() var time = getDate(value); var year = time.getFullYea ...
- About Spring MVC
一.简介 1.Springmvc是什么 Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解 ...
- CentOS7 PHP增加连接Sqlserver扩展
扩展插件下载地址 https://github.com/Microsoft/msphpsql/tags 本机PHP版本7.2,非线程安全 https://github.com/microsoft/ms ...
- 转载-对于Python中@property的理解和使用
原文链接:https://blog.csdn.net/u013205877/article/details/77804137 重看狗书,看到对User表定义的时候有下面两行 @property def ...
- Django:forms局部函数、cookie、sesion、auth模块
一.forms组件 二.cookie和session组件 三.auth组件 一.forms组件 1.校验字段功能 针对一个实例:注册用户讲解 模型:models class UserInfo(mode ...
- E - GCD HDU - 2588
The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the ...
- 一图一知-TS之Interface接口