python海龟绘图画科比标志(turtle库)

这篇博客展示了作者利用Python的turtle库绘制科比标志的过程,尽管简陋但已初具雏形。文章包含两版代码,分别展示了科比标志的不同实现,并附带了最终运行效果。还鼓励读者学习提升,并祝愿大家学业进步,生活幸福。
摘要由CSDN通过智能技术生成

闲来无事用海龟绘图画了一个科比的图标,画的比较简陋,有问题欢迎斧正。
话不多说,成品如下(加了个背景)。其中手为科比手是个背景图片,字体和图案为海龟所画。
在这里插入图片描述
代码如下:

import turtle

def top(x1,y1,s1,s2): #标志最上边的两个图形
    turtle.penup() #抬笔
    turtle.goto(x1,y1) #海龟爬到这个坐标,即落笔的地点
    turtle.pendown() #落笔
    turtle.begin_fill() #填充
    turtle.fillcolor("#5c275e") #填充的颜色
    turtle.setheading(90) #海龟朝向90°的方向
    turtle.forward(32) #海龟爬的距离为32
    if x1==-46: #因为用的是left和right,有对称的图像,所以加了个判断,判断是左边还是右边的一个图形
        turtle.left(67) #海龟左转67度
    else:
        turtle.right(67)
    turtle.forward(87)
    if x1==-46:
        turtle.left(52)
    else:
        turtle.right(52)
    turtle.forward(20)
    turtle.goto(x1,y1)
    turtle.end_fill()#结束填充

def mid(x2,y2,s1,s2,s3):
    turtle.penup()
    turtle.goto(x2, y2)
    turtle.pendown()
    turtle.begin_fill()
    turtle.fillcolor("#5c275e")
    turtle.setheading(s1)
    turtle.forward(115)
    turtle.setheading(s2)
    turtle.forward(35)
    turtle.setheading(s3)
    turtle.forward(83)
    turtle.goto(x2,y2)
    turtle.end_fill()


def
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小小个子大大幻想

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值