python turtle 画 派大星

本文详细描述了如何使用Python的turtle库,通过一系列绘图指令,创建了一个卡通角色的图形设计,包括头部、身体、手脚等部分,展示了编程艺术在图形设计中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

import turtle
t = turtle.Turtle()

t.penup()
t.goto(-200,297)
t.speed(400)
t.pensize(3)
t.pencolor("black")
#背景框
t.begin_fill()
t.fillcolor("lightpink")
t.penup()
t.goto(-200,-83)
t.seth(0)
t.pendown()
t.forward(380)
t.seth(90)
t.forward(380)
t.seth(180)
t.forward(380)
t.seth(270)
t.forward(380)
t.end_fill()
t.penup()

#turtle.screensize(800,600,"lightpink")

#t.pendown()

#头部
#t.pencolor("black")
#t.pensize(3)
t.penup()
t.goto(-65,170)
t.seth(70)
t.pendown()
t.forward(70)

t.seth(10)
t.circle(-120,35)

t.seth(-90)
t.forward(100)

#右腮帮
t.penup()
t.goto(65,100)
t.pendown()
t.circle(-25,360)


#右手
t.penup()
t.goto(52,75)
t.seth(-60)
t.pendown()
t.circle(-300,25)
t.seth(130)
t.forward(110)


#身体
t.penup()
t.goto(63,-20)
t.seth(200)
t.pendown()
t.circle(-300,34)
t.seth(85)
t.circle(-300,20)


#左腮帮
t.penup()
t.goto(-100,110)
t.pendown()
t.circle(-26,360)


#左手
t.penup()
t.goto(-88,77)
t.seth(-120)
t.pendown()
t.circle(350,24)

t.seth(60)
t.circle(350,8)


#眉毛
t.penup()
t.goto(-60,200)
t.seth(15)
t.pensize(8)
t.pencolor("black")
t.pendown()
t.forward(14)
t.penup()

t.goto(0,200)
t.seth(-25)
t.pendown()
t.forward(15)


#嘴巴
t.penup()
t.goto(-40,85)
t.seth(-15)
t.pensize(2)
t.pencolor("black")
t.pendown()
t.circle(15,80)

t.seth(25)
t.circle(-15,55)

t.penup()
t.goto(-35,78)
t.pendown()
t.circle(15,80)

#肚脐
t.penup()
t.goto(-50,-18)
t.seth(35)
t.pendown()
t.circle(-30,85)
t.penup()

t.goto(-30,-23)
t.pensize(6)
t.pendown()
t.forward(1)


#帽子
t.penup()
t.goto(-42,235)
t.seth(70)
t.pensize(2)
t.pendown()
t.begin_fill()
t.fillcolor("#000080")
t.forward(15)
t.seth(25)
t.circle(-75,53)
t.seth(-85)
t.forward(20)
t.seth(160)
t.circle(125,37)

t.penup()

t.goto(-39,250)
t.seth(145)
t.pendown()
t.forward(5)
t.circle(-25,180)
t.forward(25)
t.seth(-5)
t.forward(20)
t.circle(-20,180)
t.end_fill()


#红飘带
t.penup()
t.goto(45,260)
t.seth(-75)
t.begin_fill()
t.fillcolor("red")
t.pendown()
t.forward(40)
t.seth(145)
t.forward(10)
t.seth(-135)
t.forward(10)
t.seth(85)
t.forward(35)
t.end_fill()


#裤子
t.penup()
t.goto(-110,-33)
t.seth(-88)
t.begin_fill()
t.fillcolor("#00EE00")
t.pendown()
t.forward(50)
t.seth(0)
t.forward(80)
t.seth(65)
t.forward(15)
t.seth(-65)
t.forward(15)
t.seth(0)
t.forward(80)
t.seth(90)
t.forward(60)
t.goto(63,-20)
t.seth(200)
t.circle(-300,34)
t.end_fill()
t.penup()

#裤子上的紫色花纹
t.goto(-109,-60)
t.seth(-45)
t.begin_fill()
t.fillcolor("purple")
t.pendown()
t.circle(25,160)
t.seth(175)
t.forward(41)
t.end_fill()
t.penup()

t.goto(-12,-82)
t.seth(90)
t.begin_fill()
t.fillcolor("purple")
t.pendown()
t.circle(-25,180)
t.end_fill()



#左眼睛
t.penup()
t.goto(-50,100)
t.pendown()
t.begin_fill()
t.fillcolor("white")

t.setheading(0)
for i in range(2):      #2*10*9*2=360
    for j in range(10):
        t.forward(j)
        t.left(9)
    for j in range(10,0,-1):
        t.forward(j)
        t.left(9)
t.end_fill()

#右眼睛
t.penup()
t.goto(-5,100)
t.begin_fill()
t.fillcolor("white")
t.pendown()
t.setheading(0)
for i in range(2):      #2*5*18*2=360
    for j in range(10):
        t.forward(j)
        t.left(9)
    for j in range(10,0,-1):
        t.forward(j)
        t.left(9)
t.end_fill()
t.penup()

#黑眼球
t.goto(-45,130)
t.begin_fill()
t.fillcolor("black")
t.pendown()
t.setheading(0)
for i in range(2):      #2*10*9*2=360
    for j in range(5):
        t.forward(j)
        t.left(18)
    for j in range(5,0,-1):
        t.forward(j)
        t.left(18)
t.end_fill()
t.penup()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值