Python——绘制埃菲尔铁塔
from turtle import *
import turtle
colormode(255) #设置turtle颜色模式
speed(0) #速度
setup(800,800,720,0) #画布大小
##############--背景--######################
pensize(10) #背景画笔尺寸
a=0
for i in range(150):
penup()
goto(-400,400-6a)
pendown()
red=int(1.5a)
green=int(2*a)
blue=int(255)
if red>255 or green>255 or blue>255 or red<0 or green<0 or blue<0:
break
pencolor(red,green,blue)
fd(900)
a += 1
penup()
pencolor("black") #画笔颜色
pensize(1) #画笔尺寸
home() #返回初始位置
seth(0)
fd(400)
right(90)
fd(200) #两部分颜色上下调整点
pendown()
右边树颜色
pencolor(76,123,96)
fillcolor(76,123,96)
begin_fill()
seth(200)
fd(274)
fd(-274)
seth(270)
fd(100)
seth(190)
fd(245)
seth(110)
fd(52)
end_fill()
左边树颜色
penup()
seth(180)
fd(286)
pendown()
fillcolor(76,123,96)
begin_fill()
seth(160)
fd(274)
seth(270)
fd(100)
seth(350)
fd(245)
seth(70)
fd(52)
end_fill()
seth(330)
fillcolor(103,158,99)
begin_fill()
circle(286,60)
seth(110)
fd(-52)
seth(190)
fd(-235)
seth(270)
fd(100)
seth(180)
fd(800)
seth(90)
fd(102)
seth(170)
fd(-252)
seth(70)
fd(52)
end_fill()
####################--图名称--#################
字框
turtle.pensize(2)
x,y=-380,350
turtle.penup()#l
turtle.goto(x,y)
turtle.pendown()
turtle.fillcolor(246,246,246)
for i in range(5):
turtle.pencolor("blue")
turtle.begin_fill()
if i == 0:
penup()
goto(x,y)
pendown()
begin_fill()
seth(180)
circle(-4,90)
fd(45)
circle(-4,90)
fd(38)
circle(-4,90)
fd(45)
circle(-4,90)
fd(38)
else:
penup()
goto(x,305-(i-1)*40)
pendown()
begin_fill()
seth(180)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
turtle.end_fill()
字
pencolor("red")
penup()
goto(x,y-0)
pendown()
write("埃 ",font=("size","30"))
penup()
goto(x,y-40)
pendown()
write("菲 ",font=("size","20"))
penup()
goto(x,y-80)
pendown()
write("尔 ",font=("size","20"))
penup()
goto(x,y-120)
pendown()
write("铁 ",font=("size","20"))
penup()
goto(x,y-160)
pendown()
write("塔 ",font=("size","20"))
################-作者名称--###################
字框
a,b = -320,140
turtle.penup()
turtle.goto(a,b)
turtle.pendown()
turtle.fillcolor(246,246,246)
for i in range(6):
fillcolor("white")
pencolor("blue")
begin_fill()
penup()
goto(a,135-(i-1)*40)
pendown()
begin_fill()
seth(180)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
circle(-4,90)
fd(28)
end_fill()
字
pencolor("red")
penup()
goto(a,b+40)
pendown()
write("作",font=("size","20"))
penup()
goto(a,b)
pendown()
write("者",font=("size","20"))
penup()
goto(a,b-40)
seth(0)
fd(7)
pendown()
write("|",font=("size","20"))
penup()
goto(a,b-80)
pendown()
write("康",font=("size","20"))
penup()
goto(a,b-120)
pendown()
write("建",font=("size","20"))
penup()
goto(a,b-160)
pendown()
write("民",font=("size","20"))
############################################
penup()
goto(0,300) #起点位置
pendown()
第一部分
##############--塔台1--#####################
seth(90)
pencolor("black")
pensize(5)
fd(50)
seth(270)
fd(50)
pensize(10)
fd(20)
pensize(1)
seth(315)
fd(30)
seth(360)
fd(-42)
seth(45)
fd(30)
fd(-30)
left(45)
fd(-5)
right(90)
fd(42)
left(90)
fd(5)
fd(-5)
right(90)
fd(4)
right(90)
fd(5)
right(90)
fd(50)
right(90)
fd(5)
right(90)
fd(5)
left(180)
fd(5)
left(90)
fd(8)
left(45)
fd(12)
seth(90)
fd(12)
fd(-20)
left(40)
fd(13)
right(40)
fd(10)
fd(-10)
left(40)
fd(-15)
seth(0)
fd(30)
left(90)
fd(20)
right(90)
fd(10)
right(90)
fd(10)
right(40)
fd(15)
penup()
seth(93)
fd(10)
pendown()
right(50)
fd(15)
下一部分连接点
penup()
fd(-15)
seth(90)
fd(-17)
seth(0)
fd(-14)
seth(270)
fd(150)
seth(0)
pendown()
####################--塔身1--####################
中右边线1
right(90)
fd(100)
left(10)
fd(40)
penup()
fd(-143)
seth(0)
fd(14)
pendown()
中左边线1
right(90)
fd(100)
right(10)
fd(40)
seth(0)
fd(28)
penup()
seth(90)
fd(140)
pendown()
seth(-90)
右边线1
left(5)
fd(80)
left(5)
fd(61)
seth(180)
fd(20)
左边线1
penup()
seth(90)
fd(140)
seth(180)
fd(35)
pendown()
seth(270)
right(5)
fd(80)
right(5)
fd(61)
seth(0)
fd(50)
#################--内部线条1--###################
left(45)
fd(30)
circle(3)
left(90)
fd(48)
circle(3)
right(90)
fd(35)
circle(3)
left(90)
fd(33)
circle(3)
right(90)
fd(30)
circle(3)
left(95)
fd(30)
circle(3)
left(90)
fd(35)
circle(3)
left(90)
fd(30)
right(90)
fd(44)
circle(3)
left(90)
fd(34)
right(100)
fd(43)
circle(3)
left(90)
fd(20)
left(90)
fd(20)
circle(3)
left(90)
fd(35)
circle(3)
right(80)
fd(44)
circle(3)
left(90)
fd(28)
circle(3)
right(90)
fd(39)
circle(3)
left(90)
fd(28)
seth(0)
penup()
fd(40)
pendown()
right(138)
fd(30)
left(95)
fd(28)
circle(3)
right(90)
fd(36)
left(90)
fd(40)
circle(3)
right(90)
fd(33)
circle(3)
left(90)
fd(33)
第二部分
######################--塔台2--####################
seth(0)
fd(18)
right(45)
fd(5)
seth(180)
fd(98)
left(45)
fd(-6)
seth(0)
fd(8)
fd(-3)
penup()
right(90)
fd(4)
pendown()
fd(3)
fillcolor("black")
begin_fill()
left(20)
fd(12)
seth(0)
fd(66)
left(60)
fd(14)
seth(180)
fd(78)
end_fill()
######################--塔身2--#######################
左边线2
seth(270)
right(15)
fd(30)
right(5)
fd(74)
fd(-99)
seth(0)
fd(30)
中左边线2
right(100)
fd(30)
right(10)
fd(70)
fd(-100)
seth(0)
fd(15)
中右边线2
seth(270)
left(10)
fd(30)
left(10)
fd(70)
fd(-110)
seth(0)
fd(36)
右边线2
seth(270)
left(15)
fd(30)
left(5)
fd(80)
fd(-100)
seth(180)
fd(14)
left(105)
fd(30)
left(5)
fd(70)
seth(0)
fd(15)
fd(-31)
##################--内部线条2--#####################
left(45)
fd(35)
circle(3)
a = 0
while a < 3:
if a == 2:
penup()
left(135)
fd(34)
pendown()
right(135)
fd(35)
else:
penup()
left(135)
fd(34)
pendown()
right(135)
fd(35)
circle(3)
a += 1
seth(0)
fd(-64)
right(100)
fd(30)
right(10)
fd(70)
seth(0)
fd(-16)
fd(34)
b = 0
while b < 3:
if b == 2:
left(135)
fd(35)
circle(3)
penup()
right(135)
fd(31)
pendown()
else:
left(135)
fd(35)
circle(3)
penup()
right(135)
fd(33)
pendown()
b += 1
left(145)
fd(36)
penup()
seth(270)
right(15)
fd(30)
right(3)
fd(68)
pendown()
seth(0)
left(28)
fd(50)
circle(3)
for i in range(3):
penup()
left(152)
fd(35)
pendown()
right(152)
fd(50)
circle(3)
seth(0)
fd(10)
right(35)
fd(44)
for i in range(3):
if i == 0:
penup()
right(145)
fd(30)
pendown()
circle(3)
left(151-(2i))
fd(48)
else:
penup()
right(150)
fd(33)
pendown()
circle(3)
left(151-(2i))
fd(48)
第三部分
####################--塔台3--#######################
fillcolor("black")
begin_fill()
seth(2)
fd(5)
left(70)
fd(20)
seth(180)
fd(170)
right(60)
fd(-17)
seth(0)
fd(5)
seth(60)
fd(13)
seth(0)
fd(140)
right(90)
fd(18)
seth(0)
fd(5)
right(60)
fd(2)
right(120)
fd(165)
seth(30)
fd(5)
seth(0)
fd(160)
end_fill()
seth(90)
fd(5)
seth(180)
fd(160)
left(60)
fd(10)
for i in range(6):
seth(0)
fd(20)
pensize(1.5)
left(90)
fd(22)
seth(0)
fd(5)
right(90)
fd(22)
seth(0)
fd(15)
left(90)
fd(10)
seth(180)
fd(160)
seth(265)
fd(10)
pensize(1)
fd(10)
seth(0)
fd(164)
left(80)
fd(10)
seth(180)
fd(165)
seth(265)
fd(10)
seth(0)
fd(165)
seth(90)
fd(3)
seth(180)
fd(165)
left(60)
fd(30)
seth(0)
fd(198)
left(120)
fd(30)
for i in range(8):
seth(180)
fd(20) #左
left(90) #下
fd(26)
fd(-26)
penup()
seth(180)
fd(15)
left(90)
fd(10)
pendown()
fd(15)
left(145)
fd(28)
right(106)
fd(30)
for i in range(3):
left(100)
fd(30)
right(99)
fd(30)
fd(3)
seth(0)
fd(20)
left(90)
fd(30)
fd(-30)
seth(0)
fd(5)
seth(45)
fd(10)
left(100)
fd(16)
seth(90)
fd(10)
seth(235)
fd(33)
seth(0)
fd(20)
seth(134)
fd(32)
left(100)
fd(30)
seth(125)
fd(32)
left(100)
fd(33)
seth(130)
fd(32)
left(100)
fd(33)
seth(130)
fd(32)
left(108)
fd(30)
seth(130)
fd(22)
seth(270)
fd(15)
seth(0)
fd(34)
pensize(3) #画笔大小
#######################--塔身3--##########################
中左边线条3
seth(180)
left(60)
fd(140)
fd(-140)
seth(0)
fd(118)
中右边线条3
right(60)
fd(140)
fd(-83)
圆弧
pensize(2)
seth(120)
circle(100,120)
fd(15)
penup()
seth(0)
fd(190)
seth(120)
fd(-10)
pendown()
circle(115,100)
fd(25)
圆弧里面
pensize(1.5)
penup()
seth(0)
fd(185)
seth(138)
fd(40)
pendown()
seth(45)
fd(5)
fd(-5)
seth(152)
fd(20)
seth(45)
fd(10)
fd(-10)
seth(160)
fd(20)
seth(50)
fd(10)
fd(-10)
seth(180)
fd(20)
seth(90)
fd(13)
fd(-13)
seth(190)
fd(20)
seth(100)
fd(13)
fd(-13)
seth(190)
fd(20)
seth(105)
fd(13)
fd(-13)
seth(200)
fd(20)
seth(115)
fd(10)
fd(-10)
seth(205)
fd(20)
seth(120)
fd(6)
fd(-6)
pensize(1)
seth(220)
fd(30)
seth(240)
fd(-64)
seth(180)
fd(23)
左中线
seth(270)
right(25)
fd(30)
right(5)
fd(110)
fd(-140)
seth(180)
fd(22)
左边线
pensize(2)
seth(270)
right(25)
fd(30)
right(5)
fd(110) #左边线长度
seth(0)
fd(41)
左边里面
a = 0
for i in range(4):
if i == 0 or i == 1:
left(135)
fd(38)
seth(0)
fd(40)
else:
a += 2
left(135)
fd(38-a)
seth(0)
fd(40+a-2)
for i in range(4):
if i == 0:
seth(202)
fd(62)
seth(0)
fd(45)
else:
seth(206)
fd(60)
seth(0)
fd(42-a)
seth(60)
fd(140)
for i in range(4):
seth(0)
fd(-10)
seth(60)
fd(-18)
fd(18)
fd(-5)
seth(0)
fd(40)
fd(-40)
for i in range(2):
seth(60)
fd(-5)
seth(0)
fd(40)
fd(-40)
seth(60)
fd(15)
中右
seth(0)
fd(180)
pensize(1)
seth(270)
left(25)
fd(30)
left(5)
fd(110)
fd(-140)
右
pensize(2)
seth(0)
fd(22)
seth(270)
left(25)
fd(30)
left(5)
fd(110)
seth(180)
fd(37)
右边内部
for i in range(4):
right(135)
fd(34)
seth(180)
fd(38)
for i in range(4):
if i != 3:
left(154)
fd(56)
seth(180)
fd(36)
else:
left(155)
fd(54)
seth(180)
fd(36)
seth(120)
fd(140)
for i in range(4):
seth(0)
fd(10)
seth(116)
fd(-28)
fd(28)
seth(0)
for i in range(3):
seth(116)
fd(-6)
seth(0)
fd(-40)
fd(40)
################--塔身--###################
penup()
pensize(1)
fd(5)
seth(90)
fd(464)
seth(180)
fd(115)
pendown()
中
left(90)
fd(158)
fd(-158)
左
seth(180)
fd(10)
left(90)
fd(50)
right(2)
fd(50)
right(3)
fd(60)
penup()
fd(-60)
left(2)
fd(-50)
seth(270)
fd(-50)
pendown()
右
seth(0)
fd(22)
right(90)
fd(50)
left(2)
fd(50)
left(3)
fd(60)
内部线条
seth(135)
fd(46)
circle(2)
seth(0)
penup()
fd(29)
pendown()
seth(135)
fd(39)
circle(2)
seth(0)
penup()
fd(26)
pendown()
seth(135)
fd(35)
circle(2)
seth(0)
penup()
fd(23)
pendown()
seth(135)
fd(31.5)
circle(2)
seth(0)
penup()
fd(22)
pendown()
seth(135)
fd(30)
circle(2)
seth(0)
penup()
fd(20)
pendown()
seth(135)
fd(29)
circle(2)
seth(0)
penup()
fd(21)
pendown()
circle(2)
right(135)
fd(30)
seth(0)
penup()
fd(21)
pendown()
circle(2)
right(135)
fd(28)
seth(0)
penup()
fd(20)
pendown()
circle(2)
right(135)
fd(33)
seth(0)
penup()
fd(25)
pendown()
circle(2)
right(135)
fd(35)
seth(0)
penup()
fd(26)
pendown()
circle(2)
right(135)
fd(37)
seth(0)
penup()
fd(28)
pendown()
circle(2)
right(140)
fd(45)
circle(3)
seth(0)
penup()
fd(37)
pendown()
circle(3)
hideturtle() #隐藏小乌龟
Python——绘制埃菲尔铁塔的更多相关文章
- Python绘制PDF文件~超简单的小程序
Python绘制PDF文件 项目简介 这次项目很简单,本次项目课,代码不超过40行,主要是使用 urllib和reportlab模块,来生成一个pdf文件. reportlab官方文档 http:// ...
- Python绘制3d螺旋曲线图实例代码
Axes3D.plot(xs, ys, *args, **kwargs) 绘制2D或3D数据 参数 描述 xs, ys X轴,Y轴坐标定点 zs Z值,每一个点的值都是1 zdir 绘制2D集合时使用 ...
- python 绘制柱状图
python 绘制柱状图 import matplotlib.pyplot as plt import numpy as np # 创建一个点数为 8 x 6 的窗口, 并设置分辨率为 80像素/每英 ...
- 运用python绘制小猪佩奇
用python绘制小猪佩奇 1.打开idle 2.点击File-New Files 3.输入以下代码 1. from turtle import * 2. 3. def nose(x,y):#鼻子 4 ...
- 使用python绘制根轨迹图
最近在学自动控制原理,发现根轨迹这一张全是绘图的,然而书上教的全是使用matlab进行计算机辅助绘图.但国内对于使用python进行这种绘图的资料基本没有,后来发现python-control包已经将 ...
- ROC,AUC,PR,AP介绍及python绘制
这里介绍一下如题所述的四个概念以及相应的使用python绘制曲线: 参考博客:http://kubicode.me/2016/09/19/Machine%20Learning/AUC-Calculat ...
- Python绘制奥运五环
绘制奥运五环主要涉及到Python中的turtle绘图库运用: turtle.forward(distance) 向当前画笔方向移动distance像素长度 turtle.backward(dista ...
- Python绘制正态分布曲线
使用Python绘制正态分布曲线,借助matplotlib绘图工具: \[ f(x) = \dfrac{1}{\sqrt{2\pi}\sigma}\exp(-\dfrac{(x-\mu)^2}{2 ...
- 使用python绘制词云
最近在忙考试的事情,没什么时间敲代码,一个月也没几天看代码,最近看到可视化的词云,看到网上也很多这样的工具, 但是都不怎么完美,有些不支持中文,有的中文词频统计得莫名其妙.有的不支持自定义形状.所有的 ...
随机推荐
- 落谷 P1410 子序列
题目链接. Discription 给定长度为 \(n\) 的序列 \(A\)(\(n\) 为偶数),判断是否能将其划分为两个长度为 \(\dfrac{N}{2}\) 的严格递增子序列. Soluti ...
- 算法——1~n 整数中 1 出现的次数
输入一个整数 n ,求1-n这n个整数的十进制表示中1出现的次数. 例如,输入12,1-12这些整数中包含1 的数字有1.10.11和12,1一共出现了5次. leetcode 解题思路:依次遍历每一 ...
- Windows10自带截屏快捷键
Windows10自带截屏快捷键使用方法大全我们知道,QQ和微信以及第三方浏览器等软件都支持截图功能,但是这个都是基于软件的一个功能,如果我们不打开这些软件的话,就不能实现截图功能,但其实window ...
- 编译opencv4.5.0
1. 环境vs2017或其它版本cmake-3.18设置环境变量OPENCV_TEST_DATA_PATH 值设置为 D:\sdk\vs2017\opencv-4.5.0\opencv_extra-4 ...
- docker redis 设置和使用
1 开启docker 拉取redis镜像 1.1 桌面版docker 在镜像所在位置命令行执行 docker load -i redis.tar 1.2 开启redis docker run -p ...
- 2020-2021-1 20209307 《Linux内核原理与分析》第二周作业
1.寻址方式和常用汇编指令 寄存器寻址:movl %eax,%edx 相当于edx=eax 立即寻址:movl $0x123,%edx 相当于edx=0x123 直接寻址:movl 0x123, ...
- [日常摸鱼]POJ2187 BeautyContest-旋转卡壳
原来这个念 旋转卡qia壳ke- 题意:求平面内给定点集里的最远点对,$n \leq 5e4$ 做法就是旋转卡壳啦,话说这题数据范围应该可以再大挺多的. #include<cstdio> ...
- 多任务-python实现-进程,协程,线程总结(2.1.16)
@ 目录 1.类比 2.总结 关于作者 1.类比 一个生产玩具的工厂: 一个生产线成为一个进程,一个生产线有多个工人,所以工人为线程 单进程-多线程:一条生产线,多个工人 多进程-多线程:多条生产线, ...
- BUUCTF 刮开有奖 WriteUp
题目链接 https://buuoj.cn/challenges#%E5%88%AE%E5%BC%80%E6%9C%89%E5%A5%96 题解 用IDA打开,按F5反编译,双击进入DialogFun ...
- 用Python分析北京市蛋壳公寓租房数据
本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理 近期,蛋壳公寓"爆雷"事件持续发酵,期间因拖欠房东房租与租客退款,蛋壳公寓陷入讨 ...