用turtle画一只坤坤

用turtle画一只坤坤

在这里插入图片描述

import turtle as t
import time
#t.bgpic("./2562.png")#这里是我下面p的那张无角色站台
t.tracer(1)
screen = t.Screen()
canvas = t.getcanvas()
p=t.Pen()
p.speed(5)
r=5
p.pensize(4)
def moveto(x,y):
    p.penup()
    p.goto(x,y)
    p.pendown()
def Quan(c1,c2,r,w=360):
    p.color(c1,c2)
    p.begin_fill()
    p.circle(r)
    p.end_fill()
def lanqiu():
    moveto(-135.00,-175.00)
    Quan("black","chocolate",50)
    moveto(-181.00,-125.00)
    p.seth(350)
    p.circle(355,16)
    moveto(-180,-110)
    p.seth(21)
    p.circle(-145,20)
    p.seth(0)
    p.circle(-30,180)
    p.circle(-145,20)
def head():
    moveto(-5.16,-41.65)
    p.seth(0)
    Quan("black","#EFCB00",105)
    moveto(-80.16,28.35)
    p.pensize(2)
    Quan("black","#E70700",20)
    moveto(74.84,28.35)
    Quan("black","#E70700",20)
    
    moveto(-40.16,58.35)
    Quan("black","#F0DDD6",35)
    moveto(-45.16,98.35)
    p.dot(25)
    moveto(29.84,58.35)
    Quan("black","#F0DDD6",35)
    moveto(29.84,98.35)
    p.dot(25)

    p.color("#FD9D02")
    p.begin_fill()
    moveto(-49.84,48.35)
    p.goto(-49.84,58.35)
    p.goto(-5.16,78.35)
    p.goto(35.16,58.35)
    p.goto(35.16,48.35)
    p.seth(250)
    p.circle(-45,142)
    p.goto(-49.84,48.35)
    p.end_fill()
    p.seth(353)
    p.pensize(4)
    p.color("#FA6C01")
    p.circle(355,13)
def hair():
    p.pensize(1)
    moveto(-110.00,45.00)
    p.color("#CABDB5")
    p.begin_fill()
    p.seth(100.0)
    p.circle(-20,130)
    p.seth(90.0)
    p.circle(-110,52)
    p.seth(333)
    p.circle(-180,10)
    p.circle(5,90)
    p.seth(53)
    p.circle(-60,33)
    p.seth(325)
    p.circle(-80,50)
    p.seth(320.0)
    p.circle(10,60)
    p.goto(75.88,94.78)
    p.goto(75.88,64.78)
    p.seth(315.0)
    p.circle(10,60)
    p.goto(100.54,62.19)
    p.goto(105.54,52.19)
    p.circle(115,23)
    p.seth(98.0)
    p.circle(170,67)
    p.seth(205.0)
    p.circle(70,30)
    p.seth(135.0)
    p.circle(55,35)
    p.seth(180.0)
    p.circle(85,60)
    p.seth(230.0)
    p.circle(160,43)
    p.goto(-110.00,45.00)
    p.end_fill()
def lingzi():
    moveto(-105.00,5.00)
    p.color("#161010")
    p.begin_fill()
    p.seth(20.0)
    p.circle(-135,43)
    p.seth(347.0)
    p.circle(150,40)
    p.circle(-5,90)
    p.seth(237.0)
    p.circle(-130,108)
    p.goto(-105.00,5.00)
    p.end_fill()
def clothing():
    p.color("#12100E")
    p.begin_fill()
    moveto(-90.00,-20.00)
    p.goto(-85.00,-25.00)
    p.seth(180.0)
    p.circle(95,60)
    p.seth(270.0)
    p.circle(8,100)
    p.seth(350)
    p.circle(200,19)
    p.seth(279)
    p.circle(215,8)
    p.seth(272)
    p.circle(195,25)
    p.goto(-68.98,-201.90)
    p.goto(-73.98,-211.90)
    p.seth(342)
    p.circle(110,35)
    p.goto(-7.83,-202.48)
    p.goto(-12.83,-187.48)
    p.seth(147)
    p.circle(-25,290)
    p.goto(15.83,-191.48)
    p.goto(10.83,-201.48)
    p.goto(10.83,-211.48)
    p.seth(337)
    p.circle(95,40)
    p.seth(77)
    p.circle(40,42)
    p.seth(64)
    p.circle(125,35)
    p.seth(289)
    p.circle(30,40)
    p.circle(15,70)
    p.seth(69)
    p.circle(95,72)
    p.seth(212)
    p.circle(-165,65)
    p.goto(-90.00,-20.00)
    p.end_fill()
def necklace():
    p.color("#E2D5C5")
    p.pensize(8)
    moveto(-68.00,-46.00)
    p.seth(340)
    p.circle(185,42)
    moveto(-5.42,-58.69)
    p.goto(-5.42,-68)
    p.seth(0)
    p.goto(-15.42,-68.00)
    p.begin_fill()
    for i in range(2):
        p.forward(23)
        p.right(90)
        p.forward(26)
        p.right(90)
    p.end_fill()
def rompers():
    p.pensize(18)
    p.color("#EEE0D3")
    moveto(-90.00,-25.00)
    p.goto(-70.00,-105.00)
    moveto(87.00,-25.00)
    p.goto(83.00,-30.00)
    p.goto(72.00,-100.00)
    p.color("#BBB0AA")
    p.begin_fill()
    moveto(-79.81,-111.31)
    p.pensize(5)
    p.seth(350)
    p.circle(455,21)
    p.seth(286)
    p.circle(-100,45)
    p.seth(161)
    p.circle(110,33)
    p.goto(9.93,-173.18)
    p.seth(124)
    p.circle(10,90)
    p.goto(-8.95,-185.48)
    p.seth(154)
    p.circle(75,50)
    p.seth(109)
    p.circle(-235,18.5)
    p.goto(-79.81,-111.31)
    p.end_fill()
lanqiu()
head()
hair()
lingzi()
clothing()
necklace()
rompers()
t.done()

在这里插入图片描述
在这里插入图片描述

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是使用Pythonturtle库来绘制一只小狗的代码: ```python import turtle # 设置布大小和背景颜色 turtle.setup(600, 600) turtle.bgcolor("#FBEFFB") # 绘制狗的头部 turtle.penup() turtle.goto(-50, 50) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(50) turtle.end_fill() # 绘制狗的眼睛 turtle.penup() turtle.goto(-30, 80) turtle.pendown() turtle.begin_fill() turtle.color("#FFFFFF") turtle.circle(10) turtle.end_fill() turtle.penup() turtle.goto(-30, 80) turtle.pendown() turtle.begin_fill() turtle.color("#000000") turtle.circle(5) turtle.end_fill() # 绘制狗的耳朵 turtle.penup() turtle.goto(-80, 100) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(20, 90) turtle.goto(-80, 110) turtle.end_fill() turtle.penup() turtle.goto(-80, 110) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(10, 90) turtle.goto(-70, 100) turtle.end_fill() # 绘制狗的身体 turtle.penup() turtle.goto(0, 0) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(100) turtle.end_fill() # 绘制狗的腿 turtle.penup() turtle.goto(-70, -70) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(20, 90) turtle.goto(-70, -100) turtle.end_fill() turtle.penup() turtle.goto(-70, -100) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(10, 90) turtle.goto(-60, -110) turtle.end_fill() turtle.penup() turtle.goto(70, -70) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(20, -90) turtle.goto(70, -100) turtle.end_fill() turtle.penup() turtle.goto(70, -100) turtle.pendown() turtle.begin_fill() turtle.color("#A52A2A") turtle.circle(10, -90) turtle.goto(60, -110) turtle.end_fill() # 绘制狗的尾巴 turtle.penup() turtle.goto(80, 50) turtle.pendown() turtle.color("#A52A2A") turtle.pensize(10) turtle.right(45) turtle.forward(50) turtle.right(45) turtle.forward(50) turtle.right(135) turtle.forward(80) turtle.done() ``` 绘制完成后,可以得到以下小狗的图像: ![小狗](https://i.imgur.com/9f7LGuI.png)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值