python画图比赛_Python选修课第二届Turtle绘图大赛

20181101173,荀梓恒

20181101197,叶普旭

代码如下:

import turtle as t

t.setup(width=0.5, height=0.75, startx=None, starty=None)

t.hideturtle()

t.speed(10)

t.pensize(2)

t.penup()

t.goto(100,200)

t.pendown()

t.setheading(90)

t.begin_fill()

t.colormode(255)

t.fillcolor(255,69,0)

t.circle(100,180)

t.left(7)

t.forward(100)

a=1

for i in range(45):

if 0<=i<30:

a=a+0.2

t.lt(3)

t.fd(a)

else:

a=a-0.2

t.lt(3)

t.fd(a)

t.left(30)

t.forward(110)

t.end_fill()

t.pensize(1)

t.penup()

t.goto(17,252.5)

t.pendown()

t.goto(-23,252.5)

t.penup()

t.goto(-48,265)

t.pendown()

t.goto(-53,285)

t.penup()

t.goto(42,265)

t.pendown()

t.goto(47,288)

t.penup()

t.goto(-73,155)

t.pendown()

t.goto(-93,145)

t.penup()

t.goto(68,155)

t.pendown()

t.goto(90,145)

t.penup()

t.goto(-42,73)

t.pendown()

t.goto(-45,59)

t.penup()

t.goto(44,73)

t.pendown()

t.goto(47,60)

#头部

t.pensize(2)

t.penup()

t.goto(-97,175)

t.setheading(180)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,0,0)

t.forward(5)

t.setheading(264)

t.circle(160,30)

t.setheading(20)

t.forward(1)

t.end_fill()

t.penup()

t.goto(97,177)

t.setheading(0)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,0,0)

t.forward(5)

t.setheading(95)

t.circle(160,-30)

t.setheading(160)

t.forward(2)

t.end_fill()

#耳朵

t.penup()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,255,0)

t.goto(-58,260)

t.pendown()

t.goto(-78,120)

t.goto(-38,70)

t.goto(-32,78)

t.setheading(190)

t.circle(180,-20)

t.goto(40,70)

t.goto(72,120)

t.goto(52,260)

t.goto(22,275)

t.goto(12,230)

t.goto(-18,230)

t.goto(-28,275)

t.goto(-58,260)

t.end_fill()

#脸型

t.penup()

t.goto(-58,150)

t.pendown()

t.setheading(-15)

t.circle(220,30)

t.penup()

t.goto(-58,150)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(244,255,255)

t.goto(-60,132)

t.goto(-18,132)

t.goto(-18,142)

t.end_fill()

t.penup()

t.goto(55,150)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(244,255,255)

t.goto(57,132)

t.goto(15,132)

t.goto(15,142)

t.end_fill()

#眼

t.penup()

t.goto(-33,55)

t.setheading(225)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,0,0)

t.circle(40,270)

t.end_fill()

t.penup()

t.goto(-5,30)

t.setheading(0)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(244,255,255)

t.circle(7,360)

t.end_fill()

t.penup()

t.goto(-37,6)

t.pendown()

t.goto(-28,20)

t.goto(18,20)

t.goto(28,3)

t.penup()

t.goto(-42,35)

t.setheading(150)

t.pendown()

t.pensize(1)

t.circle(40,-30)

t.penup()

t.goto(18,20)

t.setheading(245)

t.pendown()

t.circle(40,-37)

#身体

t.begin_fill()

t.colormode(255)

t.fillcolor(255,69,0)

t.penup()

t.goto(-40,8)

t.pendown()

t.pensize(2)

t.goto(-70,-80)

t.goto(-75,-85)

t.goto(-50,-85)

t.goto(-20,-50)

t.goto(10,-50)

t.goto(45,-85)

t.goto(70,-85)

t.goto(65,-80)

t.goto(30,8)

t.goto(15,-7)

t.goto(-25,-7)

t.goto(-40,8)

t.end_fill()

#腿

t.penup()

t.goto(-25,-7)

t.pendown()

t.goto(-15,-30)

t.goto(5,-30)

t.goto(15,-7)

t.penup()

t.goto(-45,-10)

t.pendown()

t.goto(-20,-20)

t.penup()

t.goto(10,-20)

t.pendown()

t.goto(35,-10)

t.penup()

t.goto(-50,-20)

t.begin_fill()

t.colormode(255)

t.fillcolor(255,255,0)

t.goto(-50,-85)

t.goto(-75,-85)

t.goto(-20,-50)

t.end_fill()

t.penup()

t.goto(40,-20)

t.begin_fill()

t.colormode(255)

t.fillcolor(255,255,0)

t.goto(45,-85)

t.goto(70,-85)

t.goto(10,-50)

t.end_fill()

#腰带

t.penup()

t.goto(-45,59)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,255,0)

t.circle(12,80)

t.goto(-42,40)

t.end_fill()

t.penup()

t.goto(-50,43)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,69,0)

t.goto(-100,-70)

t.goto(-42,40)

t.end_fill()

t.penup()

t.goto(38,60)

t.setheading(140)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,255,0)

t.circle(12,-80)

t.goto(30,42)

t.end_fill()

t.penup()

t.goto(40,46)

t.pendown()

t.begin_fill()

t.colormode(255)

t.fillcolor(255,69,0)

t.goto(100,-70)

t.goto(33,42)

t.end_fill()

#手部

import random

for i in range(20):

m=random.randint(10,30)

x=random.randint(-600,500)

y=random.randint(-600,500)

r=random.randint(1,255)

g=random.randint(1,255)

b=random.randint(1,255)

t.pencolor((r,g,b))

t.penup()

t.goto(x,y)

t.pendown()

t.write("I am Iron Man.", font=("Times", m, "bold"))

for i in range(2):

n=random.randint(10,30)

x=random.randint(-600,500)

y=random.randint(-600,500)

r=random.randint(1,255)

g=random.randint(1,255)

b=random.randint(1,255)

t.pencolor((r,g,b))

t.penup()

t.goto(x,y)

t.pendown()

t.write("I love you three thousand times.", font=("Times", n, "bold"))

#文字

t.mainloop()

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/296849.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为什么不能一次走遍哥尼斯堡的7座桥

全世界只有3.14 % 的人关注了爆炸吧知识数学的快乐到底有多简单今天&#xff0c;8岁表妹问了一个问题&#xff1a;看到这种类似11&#xff1f;的问题&#xff0c;超模君几乎不用思考就已经知道答案。但为了体现让表妹系统的理解知识&#xff0c;所以我决定......发生在哥尼斯堡…

官宣,11月8号,.NET6+64位VS璀璨面世!

12号&#xff0c;.NET6 RC2发布&#xff0c;13号&#xff0c;VS2022 RC版发布&#xff0c;11月8号&#xff0c;.NET6VS2022C#10 正式版将同时发布&#xff0c;.NET开发将步入全新篇章&#xff0c;各种新语法、新框架、新技术都如约而至&#xff0c;令人期待&#xff01;然而&am…

IUnknown接口QueryInterface函数介绍

一、COM组件的目标&#xff1a; COM组件的一个主要优势是&#xff1a;便于升级。 要实现这个优势需要满足一下两个条件&#xff1a; 1、运行时从客户程序动态加载和卸载&#xff0c;采用DLL技术可以实现。 2、为了更好的突出DLL的优势&#xff0c;还需要信息隐藏&#xff0c;即…

stc单片机c语言 pdf,STC单片机C语言程序设计 第13章 STC单片机C语言指针.pdf

STC单片机C语言指针主讲&#xff1a;何宾Email &#xff1a;hebinmail.buct.edu.cn2016.03C51编译器中指针的分类Cx51编译器支持使用字符“*”声明变量指针。C51编译器可以执行在标准C中所提供的所有操作。但是&#xff0c;由于8051独一无二的结构以及特点&#xff0c;C51编译器…

小猿学python_小猿圈python入门之转行零基础该如何学Python?

转行零基础学Python编程开发难度大吗&#xff1f;从哪学起&#xff1f;近期很多小伙伴问我&#xff0c;如果自己转行学习Python&#xff0c;完全0基础能否学会呢&#xff1f;Python的难度到底有多大&#xff1f;今天&#xff0c;小编就来为大家解决一下疑惑。学习Python难吗&am…

dojo Quick Start/dojo入门手册--json

那要是我想更换获取到的数据类型&#xff0c;比如json&#xff1f;xml&#xff1f;修改handleAs即可&#xff0c;如&#xff1a; handleAs: "json" dojo.xhrGet({ url: "http://localhost/hello/sayHello.jsp", handleAs: "json", load…

Python-技巧

0.推荐的扩展 requests urilib的替代品 BeautifulSoup4 解析HTML代码 rq 任务队列 selenium 自动化测试工具&#xff0c;模拟浏览器 1.sys.modules, 根据已加载的模块创建对象, 其中 page 为类名 if hasattr(sys.modules[__name__], page):setattr(self, page, getattr(sys.mod…

暴击!被初中生碾压智商!这份被国家数学集训队采用的初中奥数资料究竟有多厉害?...

全世界只有3.14 % 的人关注了爆炸吧知识提高版&#xff0c;来了&#xff01;这一份大部分人都没有见过的资料。它是我国出版的第一套数学竞赛的系列图书。前段时间&#xff0c;超模君给大家分享了这一系列的初中版奥数基础篇&#xff0c;得到了大家热烈的反响。于是&#xff0c…

COSCon21 开源文化 (GL) 论坛介绍

“ 点击蓝字 / 关注我们 ”| 作者、编辑&#xff1a;袁睿斌| 设计&#xff1a;朱亿钦、宋传琪第六届中国开源年会 (COSCon21) 将于 10月30-31日 由开源社举办。本次年会重新回归线下&#xff0c;让小伙伴们的面基成为了可能。届时&#xff0c;北京、上海、深圳、成都、珠海、大…

pythonopencv显示图像_OpenCV-Python 读取显示图像 | 五

目标在这里&#xff0c;你将学习如何读取图像&#xff0c;如何显示图像以及如何将其保存回去你将学习以下功能&#xff1a;cv.imread()&#xff0c;cv.imshow()&#xff0c;cv.imwrite()(可选)你将学习如何使用Matplotlib显示图像使用OpenCV读取图像使用cv.imread()函数读取图像…

android wifi

<!-- 以下是使用wifi访问网络所需要的权限 --> <uses-permission android:name"android.permission.CHANGE_NETWORK_STATE"/> <uses-permission android:name"android.permission.CHANGE_WIFI_STATE"/> <uses-permission android:n…

1.5.2 在IIS上配置ASP.NET(转)

1.5.2 在IIS上配置ASP.NET 在服务器上部署ASP.NET网站时&#xff0c;需要.NET的运行环境.NET Framework。.NET Framework类似于Java的JDK&#xff0c;包含有.NET程序运行环境和命令行编译工具。如果服务器上没有安装.NET Framework&#xff0c;这就需要从微软网站下载&#xf…

51单片机外部地址c语言,cx51与c语言对单片机内部和外部资源变量和地址的定义是否兼容?为什么...

span namewhlm idwhlm原因:classpath没有设置好系统变量->新建->变量名&#xff1a;CLASSPATH 变量值&#xff1a;.;%JAVA_HOME%\lib(CLASSPATH中有一英文句号“.”后跟一个分号&#xff0c;表示当前路径的意思)在Classpath里面你可以直接指定一个包名&#xff0c;比如你…

Resin的安全性ip限制

转载自resin的log、安全性ip限制、内存jvm、keepalive、代码的更新检测等在webapp标签下&#xff0c;可以有很多种安全性配置&#xff0c;下面介绍ip限制、用户米密码限制两种。ip限制在正常访问的web-app标签下&#xff0c;增加一个security-constrain标签即可&#xff0c;如下…

你和女朋友的婚后老年生活!

1 厉害了&#xff0c;连扇子都是爱你的形状~2 一个漂亮的后空翻3 长得大了不起啊&#xff01;4 哈哈哈哈哈哈哈是这样5 哈哈哈哈哈防不胜防&#xff01;6 教科书般的标准答案你点的每个赞&#xff0c;我都认真当成了喜欢

实现一个基于 IConfiguration 的低配版 FeatureFlag

实现一个基于 IConfiguration 的低配版 FeatureFlagIntro在我们的应用中&#xff0c;可能有一些配置开关的需求&#xff0c;某些功能是否启用使用一个配置开关&#xff0c;用的时候就打开&#xff0c;不用的时候就关掉&#xff0c;于是基于 .NET Core 的里配置体系写了一个简单…

矩阵键盘逐行扫描C语言,(原创)51单片机C语言程序设计--速学教程实例(入门篇)之矩阵键盘(逐行扫描法).pdf...

(原创)51单片机C语言程序设计--速学教程实例(入门篇)之矩阵键盘(逐行扫描法).pdf/******************************************************************//* 名称&#xff1a;矩阵键盘逐行扫描法 *//* 作者&#xff1a;苏涛 *//* 时间&#xff1a;2011-01-15 *//* 单位&#xf…

slider节点透明背景_【Cocos Creator 实战教程(1)】——人机对战五子棋(节点事件相关)...

一、涉及知识点场景切换按钮事件监听节点事件监听节点数组循环中闭包的应用动态更换sprite图片定时器预制资源二、步骤2.1 准备工作首先&#xff0c;我们要新建一个空白工程&#xff0c;并在资源管理器中新建几个文件夹​在这些文件夹中&#xff0c;我们用来存放不同的资源&…

《奠基计算机网络》清华大学出版社 之 IPv6和IPv4共存技术

2011年8月 ISATAP隧道 ISATAP &#xff08; Intra-Site Automatic Tunnel Addressing Protocol&#xff0c;站间自动隧道寻址协议&#xff09;是一种地址分配和主机到主机、主机到路由器和路由器到主机的自动隧道技术.它为IPv6主机之间提供了跨越IPv4内部网络的单播IPv6连通性。…

霍金竟然亲口承认自己是个赌徒!明明失败了不止一次,“菜鸡”却成了神话!...

全世界只有3.14 % 的人关注了爆炸吧知识科学“赌徒”在线发牌 一直以来他像一个深渊的幽灵&#xff0c;似乎无处不在他影响了无数的天体&#xff0c;却又无影无踪他永远只停留在人们的推断真实的图像&#xff0c;交错的数据他究竟是神仙的化身&#xff0c;还是地狱的使者没人…