1.绘制天安门效果


代码实现:

import turtle as tt.hideturtle()
t.setup(width=0.9,height=0.9,startx=None,starty=None)
t.speed(5)
t.pensize(1)
t.setx(0)
t.sety(0)###base###
t.begin_fill()
t.fillcolor(0.8705,0.0784,0.0784)
t.goto(-250,0)
t.goto(-223.55,150)
t.goto(223.55,150)
t.goto(250,0)
t.goto(0,0)
t.end_fill()##door1#
t.begin_fill()
t.fillcolor("black")
t.goto(20,0)
t.goto(20,40)
t.right(270)
t.circle(20,180)
t.goto(-20,0)
t.goto(0,0)
t.end_fill()##door2##
t.begin_fill()
t.fillcolor("black")
t.right(90)
t.goto(-50,0)
t.goto(-50,30)
t.right(90)
t.circle(15,180)
t.goto(-80,0)
t.goto(0,0)
t.end_fill()##door3##
t.begin_fill()
t.fillcolor("black")
t.right(90)
t.goto(-105,0)
t.goto(-105,30)
t.right(90)
t.circle(15,180)
t.goto(-135,0)
t.goto(0,0)
t.end_fill()##door4##
t.begin_fill()
t.fillcolor("black")
t.right(90)
t.goto(80,0)
t.goto(80,30)
t.right(90)
t.circle(15,180)
t.goto(50,0)
t.goto(0,0)
t.end_fill()##door5##
t.begin_fill()
t.fillcolor("black")
t.right(90)
t.goto(135,0)
t.goto(135,30)
t.right(90)
t.circle(15,180)
t.goto(105,0)
t.goto(0,0)
t.end_fill()##under##
t.penup()
t.goto(-249.12,5)
t.pendown()
t.begin_fill()
t.fillcolor("yellow")
t.goto(-249.12,5)
t.goto(249.12,5)
t.goto(250,0)
t.goto(-250,0)
t.goto(-249.12,5)
t.end_fill()##up##
t.penup()
t.goto(-224.43,145)
t.pendown()
t.begin_fill()
t.fillcolor("yellow")
t.goto(224.43,145)
t.goto(223.55,150)
t.goto(-223.55,150)
t.end_fill()##leftword##
t.penup()
t.fillcolor(0.9372,0.9294,0.9294)
t.goto(-180,140)
t.pendown()
t.begin_fill()
t.goto(-60,140)
t.goto(-60,120)
t.goto(-180,120)
t.goto(-180,140)
t.goto(-180,120)
t.end_fill()
t.penup()
t.fillcolor(0.929,0.180,0.180)
t.goto(-177,137)
t.pendown()
t.begin_fill()
t.goto(-63,137)
t.goto(-63,123)
t.goto(-177,123)
t.goto(-177,137)
t.end_fill()
t.penup()
t.goto(-177,123)
t.pendown()
t.color("white")
t.write("中华人民共和国万岁",align="left",font=("华文中宋","10","normal"))
t.color("black")##rightword##
t.penup()
t.fillcolor(0.9372,0.9294,0.9294)
t.goto(180,140)
t.pendown()
t.begin_fill()
t.goto(60,140)
t.goto(60,120)
t.goto(180,120)
t.goto(180,140)
t.goto(180,120)
t.end_fill()
t.penup()
t.fillcolor(0.929,0.180,0.180)
t.goto(177,137)
t.pendown()
t.begin_fill()
t.goto(63,137)
t.goto(63,123)
t.goto(177,123)
t.goto(177,137)
t.end_fill()
t.penup()
t.goto(63,123)
t.pendown()
t.color("white")
t.write("世界人民大团结万岁",align="left",font=("华文中宋","10","normal"))
t.color("black")##face##
t.penup()
t.goto(-25,140)
t.pendown()
t.begin_fill()
t.fillcolor(0.9647,0.71764,0.04313)
t.goto(25,140)
t.goto(25,80)
t.goto(-25,80)
t.goto(-25,140)
t.end_fill()
t.penup()
t.goto(-23,138)
t.pendown()
t.begin_fill()
t.fillcolor(0.9686,0.8078,0.36862)
t.goto(23,138)
t.goto(23,83)
t.goto(-23,83)
t.goto(-23,137)
t.end_fill()###floor##
t.penup()
t.fillcolor(0.8705,0.0784,0.0784)
t.goto(0,151)
t.pendown()
t.begin_fill()
t.goto(160,151)
t.goto(160,185.63)
t.goto(-160,185.63)
t.goto(-160,151)
t.goto(0,151)
t.end_fill()
##on door1##
t.penup()
t.goto(-155,150)
t.fillcolor(0.6705,0.0588,0.0588)
t.pendown()
t.left(90)
t.begin_fill()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(-147,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(-135,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(-147,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()##on door2##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.begin_fill()
t.goto(-110,150)
t.pendown()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(-102,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(-90,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(-102,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()##on door3##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.goto(-65,150)
t.pendown()
t.begin_fill()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(-56.5,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(-45,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(-56.5,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()###door 4##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.goto(-20,150)
t.pendown()
t.begin_fill()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(30)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()##on door5##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.pendown()
t.begin_fill()
t.goto(130,150)
t.right(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(138.5,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(150,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(138.5,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()##on door4##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.begin_fill()
t.goto(85,150)
t.pendown()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(93.5,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(105,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(93.5,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()
##on door6##
t.penup()
t.fillcolor(0.6705,0.0588,0.0588)
t.goto(40,150)
t.pendown()
t.begin_fill()
t.left(90)
t.fd(25)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(15)
t.right(90)
t.circle(5,90)
t.right(90)
t.fd(25)
t.right(90)
t.fd(25)
t.end_fill()
t.penup()
t.fillcolor("yellow")
t.begin_fill()
t.goto(48.5,180)
t.pendown()
t.left(180)
for i in range(2):t.fd(9)t.right(90)t.fd(2)t.right(90)
t.end_fill()
###lantern##
t.penup()
t.goto(60,172)
t.pendown()
t.fillcolor(0.8705,0.0784,0.0784)
t.begin_fill()
t.setheading(90)
for k in range(2):len=0.2for i in range(60):if i < 30:len +=0.01if i >30:len -=0.01t.fd(len)t.left(3)
t.end_fill()
t.penup()
t.goto(48.5,165)
t.fillcolor("yellow")
t.pendown()
t.begin_fill()
t.right(90)
for i in range(2):t.fd(8)t.right(90)t.fd(10)t.right(90)
t.end_fill()###floor up##
t.penup()
t.goto(0,185)
t.pendown()
t.fillcolor(0.6705,0.0588,0.0588)
t.begin_fill()
t.goto(180,185)
t.goto(190,195)
t.goto(-190,195)
t.goto(-180,185)
t.goto(0,185)
t.end_fill()##floor upup##
t.penup()
t.goto(0,195)
t.begin_fill()
t.fillcolor(0.9568,0.53333,0.2470)
t.pendown()
t.goto(190,195)
t.goto(190,195+14.7)
t.goto(187.73,195+11.94)
t.goto(147.88,195+15.42)
t.goto(-147.88,195+15.42)
t.goto(-187.73,195+11.94)
t.goto(-190,195+14.7)
t.goto(-190,195)
t.goto(0,195)
t.end_fill()##floor2 under###
t.penup()
t.goto(0,211)
t.pendown()
t.fillcolor(0.4705,0.8431,0.4117)
t.begin_fill()
t.goto(130,211)
t.goto(130,220)
t.goto(-130,220)
t.goto(-130,211)
t.goto(0,211)
t.end_fill()
##floor2##
t.penup()
t.goto(0,221)
t.pendown()
t.fillcolor(0.6705,0.0588,0.0588)
t.begin_fill()
t.goto(140,221)
t.goto(150,230)
t.goto(-150,230)
t.goto(-140,221)
t.goto(0,221)
t.end_fill()##country##
t.penup()
t.goto(0,206.5)
t.fillcolor(0.9803,0.9490,0.03137)
t.pendown()
t.begin_fill()
t.circle(8,360)
t.end_fill()
t.penup()
t.goto(0,208)
t.fillcolor(0.6705,0.0588,0.0588)
t.pendown()
t.begin_fill()
t.circle(6,360)
t.end_fill()
##floor2 up##
t.penup()
t.goto(0,230)
t.begin_fill()
t.fillcolor(0.9568,0.53333,0.2470)
t.pendown()
t.goto(150,230)
t.goto(150,240)
t.goto(130.08,242.37)
t.goto(130.08,277.37)
t.goto(127.28,273.77)
t.goto(124.23,150+125.51)
t.goto(121.5,265.23)
t.goto(-121.5,265.23)
t.goto(-124.23,150+125.51)
t.goto(-127.28,273.77)
t.goto(-130.08,277.37)
t.goto(-130.08,242.37)
t.goto(-150,240)
t.goto(-150,230)
t.goto(0,230)
t.end_fill()t.exitonclick()

Python练习---turtle绘图之绘制天安门相关推荐

  1. Python中Turtle绘图函数-绘制时钟程序

    Turtle常用的一些函数, 参考博客:http://blog.csdn.net/zengxiantao1994/article/details/76588580 时钟代码设计 我们可以通过main函 ...

  2. python turtle循环图案-Python内置模块turtle绘图详解

    urtle库是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x.纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的 ...

  3. Python使用turtle绘图

    Python使用turtle绘图 1.画直线 """ 海龟画直线: 1.召唤海龟 2.给海龟一支笔 3.下达画直线的命令 """ impor ...

  4. python 画柱状图-python使用Plotly绘图工具绘制柱状图

    本文实例为大家分享了python使用Plotly绘图工具绘制柱状图的具体代码,供大家参考,具体内容如下 使用Plotly绘制基本的柱状图,需要用到的函数是graph_objs 中 Bar函数 通过参数 ...

  5. 【python】turtle绘图几个超好看的颜色

    推荐给大家python中turtle绘图几个超好看的颜色 color = [ 'lightcoral', 'coral', 'darkorange', 'gold', 'palegreen', 'pa ...

  6. python绘图实例-Python中turtle绘图学习笔记和实例

    一.既然本次讲的主角是turtle函数库,那肯定得先了解一下它是什么 turtle库是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x.纵轴为y的坐标系原点,(0,0)位 ...

  7. 从Python的turtle绘图开始学习图形化程序设计

    Turtle python2.6版本中后引入的一个简单的绘图工具,叫做海龟绘图(Turtle Graphics),turtle库是python的内部库,使用导入即可 : import turtle 画 ...

  8. python image清除_60秒掌握Python内置模块Turtle的用法——绘制漫天雪花

    前言 Turtle模块是Python的一个内置模块,这个模块的开发的初衷是通过绘图来教小孩学习编程,当时十分流行:现在也用在零基础入门的学习者的教学中.这个绘图模块使用简单,十分容易上手,在零基础入门 ...

  9. python学习turtle(移动和绘制)

    2019独角兽企业重金招聘Python工程师标准>>> turtle绘图学习记录. 移动和绘制 turtle.forward(distance) turtle.fd(distance ...

  10. Python系列 | Turtle绘图学习之羽毛球随机点训练场

    绘图之前先要安装turtle模块: python 2: pip install turtle python 3: pip3 install turtle 绘图思路: 首先绘制出外正方形和内线,然后使用 ...

最新文章

  1. mysql 图形化工具
  2. POJ 2356 (抽屉原理)
  3. 昨晚通宵把服务器格式化,重新配置环境。
  4. lamp安全审计之php代码审计_paper,PHP实战开发及代码审计之PHP代码审计
  5. 页面显示pdf_PDF怎样合并?在Mac上合并PDF文件的最佳方法
  6. vue锚链接可以从指定位置显示么_onenote链接系列⑥:链接笔记如何产生?与插入链接的区别...
  7. 3.3、苏宁百万级商品爬取 代码讲解 商品爬取
  8. html禁用选择,html – 设置可选的禁用属性
  9. 序列化和反序列化(六)——Java对象的网络传输(一)
  10. koa2从搭建项目到实现API
  11. Android的Theme主题切换
  12. mysql的skip-slave-start参数
  13. java写一个泡泡龙小游戏
  14. 2019--Target Speaker Extraction for Multi-Talker Speaker Verification
  15. Every plan I should insist on !!
  16. 电子警察的系统结构和功能设计
  17. idea pom引入依赖 Dependency ‘xxx‘ not found less... (Ctrl+F1) Inspect
  18. 戴尔服务器虚拟机巨兽龙在哪,dell服务器安装的vmware esxi 虚拟机紫萍
  19. pikachu——简介
  20. 使用Javascript制作声音按钮

热门文章

  1. LaTeX引文.bib方式插入——misplaced alignment tab character . ...ock{\em IEEE Transactions onSystems Man
  2. 周期性行业是什么意思_周期性股票是什么意思 周期性股票的特征有哪些
  3. 前工程师讲解:开关电源设计-LLC电源
  4. Mysql驱动程序是什么?
  5. B站商业化驶入深水区
  6. Apple Store的错误
  7. Frogs' Neighborhood POJ - 1659
  8. Dynamics CRM调用选择用户弹窗
  9. 罗辑回归,Logistic Regression(or sigmoid function)
  10. 微信重磅更新!上线4个实用功能,尝鲜体验有木有你想要的功能