当前位置: 首页 > news >正文

广州做包包的网站好北京网站制作公司

广州做包包的网站好,北京网站制作公司,asp网站管理系统源码,网站打开慢原因海龟绘图(turtle)是一个Python内置的绘图库,也被称为“Turtle Graphics”或简称“Turtles”。它采用了一种有趣的绘图方式,模拟一只小海龟在屏幕上爬行,而小海龟爬行的路径就形成了绘制的图形。这种绘图方式最初源自20…

海龟绘图(turtle)是一个Python内置的绘图库,也被称为“Turtle Graphics”或简称“Turtles”。它采用了一种有趣的绘图方式,模拟一只小海龟在屏幕上爬行,而小海龟爬行的路径就形成了绘制的图形。这种绘图方式最初源自20世纪60年代的Logo编程语言,后来一些Python程序员构建了turtle库,使得其他程序员可以通过简单的import turtle命令,在Python中使用海龟作图。

今天就来简单举几个例子!

一,小猪佩奇

from turtle import *def nose(x, y):  # 鼻子penup()  # 提起笔goto(x, y)  # 定位pendown()  # 落笔,开始画setheading(-30)  # 将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南)begin_fill()  # 准备开始填充图形a = 0.4for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a = a + 0.08left(3)  # 向左转3度forward(a)  # 向前走a的步长else:a = a - 0.08left(3)forward(a)end_fill()  # 填充完成penup()setheading(90)forward(25)setheading(0)forward(10)pendown()pencolor(255, 155, 192)  # 画笔颜色setheading(10)begin_fill()circle(5)color(160, 82, 45)  # 返回或设置pencolor和fillcolorend_fill()penup()setheading(0)forward(20)pendown()pencolor(255, 155, 192)setheading(10)begin_fill()circle(5)color(160, 82, 45)end_fill()def head(x, y):  # 头color((255, 155, 192), "pink")penup()goto(x, y)setheading(0)pendown()begin_fill()setheading(180)circle(300, -30)circle(100, -60)circle(80, -100)circle(150, -20)circle(60, -95)setheading(161)circle(-300, 15)penup()goto(-100, 100)pendown()setheading(-30)a = 0.4for i in range(60):if 0 <= i < 30 or 60 <= i < 90:a = a + 0.08lt(3)  # 向左转3度fd(a)  # 向前走a的步长else:a = a - 0.08lt(3)fd(a)end_fill()def cheek(x, y):  # 腮color((255, 155, 192))penup()goto(x, y)pendown()setheading(0)begin_fill()circle(30)end_fill()def mouth(x, y):  # 嘴color(239, 69, 19)penup()goto(x, y)pendown()setheading(-80)circle(30, 40)circle(40, 80)def setting():  # 参数设置pensize(4)hideturtle()  # 使乌龟无形(隐藏)colormode(255)  # 将其设置为1.0或255.随后 颜色三元组的r,g,b值必须在0 .. cmode范围内color((255, 155, 192), "pink")setup(840, 500)speed(100)def ears(x, y):color((255, 155, 192), "pink")penup()goto(x, y)pendown()begin_fill()setheading(100)circle(-50, 50)circle(-10, 120)circle(-50, 54)end_fill()penup()setheading(90)forward(-12)setheading(0)forward(30)pendown()begin_fill()setheading(100)circle(-50, 50)circle(-10, 120)circle(-50, 56)end_fill()def eyes(x, y):color((255, 155, 192), "pink")fillcolor('white')penup()goto(x, y)pendown()begin_fill()setheading(0)circle(20)end_fill()color((255, 155, 192))fillcolor('white')penup()goto(x, y)begin_fill()forward(80)pendown()setheading(100)circle(20)end_fill()color('black')penup()goto(x-7, y+13)pendown()begin_fill()setheading(0)circle(5)end_fill()penup()goto(x, y)begin_fill()forward(60)pendown()setheading(100)circle(5)end_fill()def body(x, y):width(5)color('firebrick')list = ['orangered', 'firebrick']up()goto(x, y)down()setheading(-105)begin_fill()fillcolor(list[0])circle(250, 30)setheading(0)forward(138)setheading(75)circle(250, 30)end_fill()setheading(-45)forward(70)begin_fill()fillcolor(list[1])circle(5)end_fill()up()goto(x, y)down()setheading(-145)forward(70)begin_fill()circle(5)end_fill()up()goto(x+20, y-250/2-4)down()setheading(270)forward(50)left(90)width(10)color('black')forward(13)width(5)color('firebrick')up()goto(x + 120, y - 250 / 2-4)down()setheading(270)forward(50)left(90)width(10)color('black')forward(13)def main():body(-25, -15)setting()  # 画布、画笔设置nose(-100, 100)  # 鼻子head(-69, 167)  # 头ears(0, 160)  # 耳朵eyes(-15, 100)  # 眼睛cheek(80, 10)  # 腮mouth(-20, 30)  # 嘴done()if __name__ == '__main__':main()

运行结果:

二,哆啦A梦

import turtle as tt2=t.Turtle()def funa(x,y):t.pu()t.goto(x,y)t.dot(10,'red')t2.clear()t2.write('{},{}'.format(x,y),align='center',font=('黑体',20,'bold'))def huxian(x,y,r,a):t.pu()t.goto(x,y)t.pd()t.circle(r,a)def line2(x1,y1,x2,y2,c='black',size=1):t.color(c)t.pensize(size)t.pu()t.goto(x1,y1)t.pd()t.goto(x2,y2)def sanjiao(x,y,m,c,fc='black'):t.color(fc,c)t.pu()t.goto(x,y)t.pd()t.seth(90)t.begin_fill()t.circle(m,180)t.end_fill()def tuoyuan(x,y,st,s,c,b,ps=1,ang=0):t.pensize(ps)t.pu()t.goto(x,y)t.pd()t.seth(ang)a=stt.color(c,b)t.begin_fill()for i in range(120):if 0<=i<30 or 60<=i<90:a+=0.01*st.lt(3)t.fd(a)else:a-=0.01*st.lt(3)t.fd(a)t.end_fill()def head():tuoyuan(0,-44,7.0,0.0,'black','#00A0DE')tuoyuan(0,-49,6.0,0.03,'black','white')def eyes():tuoyuan(-25,133,1.0,4.0,'black','white')tuoyuan(32,133,1.0,4.0,'black','white')tuoyuan(-15,161,0.0,2,'black','black',1)          tuoyuan(23,161,0.0,2,'black','black',1)tuoyuan(-15,161,0.0,1,'black','white',1)    tuoyuan(23,161,0.0,1,'black','white',1)    def huzi():tuoyuan(-77,118,0.7,0,'#FFC5C8','#FFC5C8')tuoyuan(75,113,0.7,0,'#FFC5C8','#FFC5C8')    line2(-53,118,-136,149)line2(-50,95,-146,95)line2(-51,78,-139,52)line2(54,118,135,145)line2(55,95,150,95)line2(52,79,141,53)  def nose():tuoyuan(4,100,1,0.1,'black','#DB3A49')#line2(4,101,4,43)t.color('black')t.pu()t.goto(4,101)t.seth(-80)t.pd()t.circle(-300,12)tuoyuan(15,117,0.0,1.0,'white','white',1)  def setting():t.delay(0)  t.ht()#t.bgpic('./DLAM.gif')t.pensize(2)t.color('blue')t.bgcolor('white')t2.ht()t2.pu()t2.goto(0,-280)def mouth():t.pu()t.goto(-73,59)t.seth(-24)t.pd()t.color('black','#E92A14')t.begin_fill()t.circle(200,45)t.seth(-98)   t.circle(-77,165)t.end_fill()t.pu()t.goto(-32,2)t.seth(24)t.pd()t.color('black','#E74810')t.begin_fill()t.circle(-150,35)t.seth(-130)   t.circle(-70,90)t.end_fill()def xianglian():t.pu()t.goto(-66,-30)t.pd()t.color('black','#F53338')t.begin_fill()t.seth(-15)t.circle(260,26)t.seth(-80)t.fd(10)t.seth(-167)t.circle(-240,30)  t.seth(80) t.fd(12)t.end_fill()def lingdang():tuoyuan(-10,-80,1.0,0.1,'black','#FFD957',1)line2(-30,-60,10,-60,c='#E89F10',size=3)          line2(-10,-70,-10,-80,c='black') t.pu()t.goto(-10,-70)t.pd()t.color('black')t.begin_fill()t.seth(0)t.circle(2.5)t.end_fill()  t.pu()t.goto(-3,-50)  t.pd()t.pensize(3)t.color('white')t.seth(-50)t.circle(-100,2)def dupi():t.pu()t.goto(-50,-40)t.pd()t.color('black','white')t.begin_fill()t.seth(-140)t.circle(60,280)t.end_fill()t.pu()t.goto(-40,-90)t.pd()t.color('black','white')t.begin_fill()t.seth(0)t.fd(60)t.seth(-90)t.circle(-30,180)t.end_fill()  def body():t.color('black','#00A0DE')t.pu()t.goto(-73,-40)t.pd()t.begin_fill()t.seth(-140)t.circle(360,15)t.seth(-40)  t.fd(40) t.pu()t.goto(-89,-84)t.pd()t.seth(-90)t.circle(360,15)t.pu()t.goto(53,-176)t.pd()t.seth(80)t.circle(360,15)t.pu()t.goto(76,-134)t.pd()t.seth(40)  t.fd(40) t.seth(120)t.circle(330,15)t.end_fill()sanjiao(2,-178,10,'white')def feet():t.pu()t.goto(-113,-135)t.pd()t.color('black','white')t.begin_fill()t.seth(0)t.circle(23)t.end_fill()    t.pu()t.goto(85,-135)t.pd()t.color('black','white')t.begin_fill()t.seth(0)t.circle(23)t.end_fill()tuoyuan(-13,-192,1.0,5.0,'black','white',ang=90)tuoyuan(63,-192,1.0,5.0,'black','white',ang=90)def cat_name():t.pu()t.goto(80,-50)t.color('#0180DD')t.write('ドラえもん',font=('宋体',24,'normal'))   t.goto(120,-22)t.color('#dddddd')t.write('Doraemon',font=('宋体',20,'italic'))setting()head()eyes()
nose()
mouth()
huzi()
body()
dupi()
xianglian()
feet()
lingdang()cat_name()t.done()

http://www.mmbaike.com/news/35941.html

相关文章:

  • 郑州做公司网站的如何优化网络速度
  • 广州seo网站推广地推接单平台找推网
  • 网站建设课程设计实验报告个人网站模板建站
  • 个人网站建设与维护seo信息网
  • 淘宝网站小视频怎么做博客网站登录
  • react做前台网站bt磁力搜索引擎在线
  • 广西知名网站设计搜索引擎优化策略有哪些
  • wordpress作者函数青岛seo网站建设公司
  • 北京文化馆设计公司怎么看北京外贸网站优化
  • 绵阳科技网站建设百度推广渠道代理
  • dedecms产品展示织梦模板(营销型网站)网站关键词如何优化
  • 有做赛车网站的吗山东网络推广优化排名
  • 如何给网站做高质量外链慧生活798app下载
  • 单位网站建设意见学网络营销
  • 网站建设 的介绍石家庄网站seo
  • 平顶山网站建设电话百度注册入口
  • 做刀网站竞价网站推广
  • 网站备案信息可以更改吗seo网站推广是什么
  • 百科网wordpressseo实战培训
  • seo网站三要素怎么做怎么建立企业网站免费的
  • 做网站需要买注册网站在哪里注册
  • 网站建设策划书的编制网店代运营骗局
  • 台州做网站的公司seo搜索引擎优化心得体会
  • 外部调用wordpress站点文章百度网页版登录首页
  • 外贸网站建设需要注意事项seo推广排名公司
  • 深圳有哪些网站公司搜索引擎的网站
  • 电脑版 做网站尺寸南京seo招聘
  • 2021四川成都疫情最新消息抖音优化
  • 什么是网站架构项目推广方案
  • 有什么平面设计的网站百度指数在线查询小程序