Python画熊猫代码——Python画椭圆

 这只熊猫用了circle里的椭圆形,脑袋方方的,很是可爱

展示代码:

import turtle as t

t.title("熊猫宝宝")
t.shape("classic")
t.pensize(3)
t.color("black")
t.fillcolor("black")
t.speed(100)
t.hideturtle()
#左耳
t.penup()
t.goto(-105, 97)
t.setheading(160)
t.begin_fill()
t.pendown()
t.circle(-30, 230)
t.setheading(180)
t.circle(37, 90)
t.end_fill()
#右耳
t.penup()
t.goto(105, 97)
t.setheading(20)
t.begin_fill()
t.pendown()
t.circle(30, 230)
t.setheading(0)
t.circle(-37, 90)
t.end_fill()
#头部轮廓
t.penup()
t.goto(-67, 140)
t.setheading(30)
t.pendown()
t.circle(-134, 60)

t.penup()
t.goto(-50, -25)
t.setheading(180)
t.pendown()
t.circle(-100, 30)
t.circle(-30, 90)
t.setheading(100)
t.circle(-200, 20)

t.penup()
t.goto(50, -25)
t.setheading(0)
t.pendown()
t.circle(100, 30)
t.circle(30, 90)
t.setheading(80)
t.circle(200, 20)

#两熊猫眼
#左眼
t
  • 5
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是用 Python 熊猫代码: ```python import turtle # 定义圆函数 def draw_circle(x, y, radius, color): turtle.penup() turtle.goto(x, y - radius) turtle.pendown() turtle.fillcolor(color) turtle.begin_fill() turtle.circle(radius) turtle.end_fill() # 定义方形函数 def draw_square(x, y, length, color): turtle.penup() turtle.goto(x - length/2, y - length/2) turtle.pendown() turtle.fillcolor(color) turtle.begin_fill() for i in range(4): turtle.forward(length) turtle.left(90) turtle.end_fill() # 熊猫身体(黑色圆) draw_circle(0, 0, 200, "black") # 熊猫头部(白色圆) draw_circle(0, 100, 150, "white") # 熊猫的左耳朵(黑色圆) draw_circle(-75, 220, 50, "black") # 熊猫的右耳朵(黑色圆) draw_circle(75, 220, 50, "black") # 熊猫的左眼睛(白色圆) draw_circle(-50, 50, 30, "white") # 熊猫的左眼珠(黑色圆) draw_circle(-50, 50, 10, "black") # 熊猫的右眼睛(白色圆) draw_circle(50, 50, 30, "white") # 熊猫的右眼珠(黑色圆) draw_circle(50, 50, 10, "black") # 熊猫的鼻子(黑色圆) draw_circle(0, 0, 30, "black") # 熊猫的嘴巴(黑色方形) draw_square(0, -60, 80, "black") # 熊猫的左手(黑色圆) draw_circle(-140, -120, 50, "black") # 熊猫的右手(黑色圆) draw_circle(140, -120, 50, "black") # 熊猫的左脚(黑色圆) draw_circle(-70, -220, 50, "black") # 熊猫的右脚(黑色圆) draw_circle(70, -220, 50, "black") # 隐藏笔 turtle.hideturtle() # 等待关闭窗口 turtle.done() ``` 运行以上代码后,会弹出一个窗口显示出出的熊猫。注意要安装并导入 turtle 库。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值